Library for TM1637 LEDcontroller

Dependents:   mbed_TM1637 TM1637_test

Embed: (wiki syntax)

« Back to documentation index

TM1637 Class Reference

TM1637 Class Reference

A class for driving TM1637 LED controller. More...

#include <TM1637.h>

Inherited by TM1637_CATALEX, TM1637_EYEWINK, and TM1637_ROBOTDYN.

Public Types

typedef char DisplayData_t [TM1637_DISPLAY_MEM]
 Datatype for displaydata.
typedef char KeyData_t
 Datatypes for keymatrix data.

Public Member Functions

 TM1637 (PinName mosi_nc, PinName miso_dio, PinName sclk_clk)
 Constructor for class for driving TM1637 LED controller.
 TM1637 (PinName dio, PinName clk)
 Constructor for class for driving TM1637 LED controller.
void cls ()
 Clear the screen and locate to 0.
void writeData (char data, int address)
 Write databyte to TM1637.
void writeData (DisplayData_t data, int length=(TM1637_MAX_NR_GRIDS *TM1637_BYTES_PER_GRID), int address=0)
 Write Display datablock to TM1637.
bool getKeys (KeyData_t *keydata)
 Read keydata block from TM1637.
void setBrightness (char brightness=TM1637_BRT_DEF)
 Set Brightness.
void setDisplay (bool on)
 Set the Display mode On/off.

Detailed Description

A class for driving TM1637 LED controller.

Supports 6 Grids @ 8 Segments and 16 Keys. Serial bus interface device.

Definition at line 157 of file TM1637.h.


Member Typedef Documentation

typedef char DisplayData_t[TM1637_DISPLAY_MEM]

Datatype for displaydata.

Definition at line 161 of file TM1637.h.

typedef char KeyData_t

Datatypes for keymatrix data.

Definition at line 164 of file TM1637.h.


Constructor & Destructor Documentation

TM1637 ( PinName  mosi_nc,
PinName  miso_dio,
PinName  sclk_clk 
)

Constructor for class for driving TM1637 LED controller.

Constructor for class for driving TM1637 LED controller with Serial bus interface device.

Supports 6 Grids @ 8 segments and 16 Keys. Serial bus interface device. DEPRECATED version

Parameters:
PinNamemosi_nc Serial bus NC pin
PinNamemiso_dio Serial bus DIO pin
PinNamesclk_clk Serial bus CLK pin

Supports 6 Grids @ 8 segments. Also supports upto 16 Keys. Serial bus interface device. DEPRECATED version

Parameters:
PinNamemosi_nc Serial bus NC pin
PinNamemiso_dio Serial bus DIO pin
PinNamesclk_clk Serial bus CLK pin

Definition at line 39 of file TM1637.cpp.

TM1637 ( PinName  dio,
PinName  clk 
)

Constructor for class for driving TM1637 LED controller.

Constructor for class for driving TM1637 LED controller with Serial bus interface device.

Supports 6 Grids @ 8 segments and 16 Keys. Serial bus interface device.

Parameters:
PinNamedio Serial bus DIO pin
PinNamesck Serial bus CLK pin

Supports 6 digits @ 8 segments. Also supports upto 16 Keys.

Parameters:
PinNamedio Serial bus DIO pin
PinNameclk Serial bus CLK pin

Definition at line 50 of file TM1637.cpp.


Member Function Documentation

void cls (  )

Clear the screen and locate to 0.

Definition at line 96 of file TM1637.cpp.

bool getKeys ( KeyData_t keydata )

Read keydata block from TM1637.

Parameters:
*keydataPtr to bytes for keydata
Returns:
bool keypress True when at least one key was pressed

Definition at line 181 of file TM1637.cpp.

void setBrightness ( char  brightness = TM1637_BRT_DEF )

Set Brightness.

Parameters:
charbrightness (3 significant bits, valid range 0..7 (1/16 .. 14/16 dutycycle)
Returns:
none
Parameters:
charbrightness (3 significant bits, valid range 0..7 (1/16 .. 14/14 dutycycle)
Returns:
none

Definition at line 113 of file TM1637.cpp.

void setDisplay ( bool  on )

Set the Display mode On/off.

Parameters:
booldisplay mode

Definition at line 124 of file TM1637.cpp.

void writeData ( char  data,
int  address 
)

Write databyte to TM1637.

Parameters:
chardata byte written at given address
intaddress display memory location to write byte
Returns:
none
Parameters:
intaddress display memory location to write byte
chardata byte written at given address
Returns:
none

Reimplemented in TM1637_CATALEX, TM1637_ROBOTDYN, and TM1637_EYEWINK.

Definition at line 141 of file TM1637.cpp.

void writeData ( DisplayData_t  data,
int  length = (TM1637_MAX_NR_GRIDS * TM1637_BYTES_PER_GRID),
int  address = 0 
)

Write Display datablock to TM1637.

Parameters:
DisplayData_tdata Array of TM1637_DISPLAY_MEM (=6) bytes for displaydata
lengthnumber bytes to write (valid range 0..(TM1637_MAX_NR_GRIDS * TM1637_BYTES_PER_GRID) (=6), when starting at address 0)
intaddress display memory location to write bytes (default = 0)
Returns:
none
Parameters:
DisplayData_tdata Array of TM1637_DISPLAY_MEM (=16) bytes for displaydata
lengthnumber bytes to write (valid range 0..(TM1637_MAX_NR_GRIDS * TM1637_BYTES_PER_GRID) (=16), when starting at address 0)
intaddress display memory location to write bytes (default = 0)
Returns:
none

Reimplemented in TM1637_CATALEX, TM1637_ROBOTDYN, and TM1637_EYEWINK.

Definition at line 157 of file TM1637.cpp.