Wim Huiskamp / TM1651

Dependents:   mbed_TM1651

Embed: (wiki syntax)

« Back to documentation index

TM1651_OPENSMART Class Reference

TM1651_OPENSMART Class Reference

Constructor for class for driving TM1651 controller as used in OPENSMART. More...

#include <TM1651.h>

Inherits TM1651.

Public Types

enum  Icon {
  LD12 = ( 1<<24) | R12, LD3 = ( 1<<24) | Y3, LD4 = ( 1<<24) | Y4, LD5 = ( 1<<24) | Y5,
  LD67 = ( 1<<24) | G67, LD89 = ( 1<<24) | G89, LD10 = ( 1<<24) | B10
}
 

Enums for Icons.

More...
enum  Level {
  LVL_0 = ( 1<<24) | R12, LVL_1 = ( 1<<24) | R12 | Y3, LVL_2 = ( 1<<24) | R12 | Y3 | Y4, LVL_3 = ( 1<<24) | R12 | Y3 | Y4 | Y5,
  LVL_4 = ( 1<<24) | R12 | Y3 | Y4 | Y5 | G67, LVL_5 = ( 1<<24) | R12 | Y3 | Y4 | Y5 | G67 | G89, LVL_0 = ( 1<<24) | R12, LVL_1 = ( 1<<24) | R12 | Y3,
  LVL_2 = ( 1<<24) | R12 | Y3 | Y4, LVL_3 = ( 1<<24) | R12 | Y3 | Y4 | Y5, LVL_4 = ( 1<<24) | R12 | Y3 | Y4 | Y5 | G67, LVL_5 = ( 1<<24) | R12 | Y3 | Y4 | Y5 | G67 | G89,
  LVL_6 = ( 1<<24) | R12 | Y3 | Y4 | Y5 | G67 | G89 | B10
}
 

Enums for Batterylevels.

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

Public Member Functions

 TM1651_OPENSMART (PinName dio, PinName clk)
 Constructor for class for driving TM1651 LED controller.
void cls ()
 Clear the screen and locate to 0.
void setIcon (Icon icon)
 Set Icon.
void clrIcon (Icon icon)
 Clr Icon.
void setLevel (Level level)
 Set Level.
void writeData (char data, int address)
 Write databyte to TM1651.
void writeData (DisplayData_t data, int length=(OPENSMART_NR_GRIDS *TM1651_BYTES_PER_GRID), int address=0)
 Write Display datablock to TM1651.
bool getKeys (KeyData_t *keydata)
 Read keydata block from TM1651.
void setBrightness (char brightness=TM1651_BRT_DEF)
 Set Brightness.
void setDisplay (bool on)
 Set the Display mode On/off.

Detailed Description

Constructor for class for driving TM1651 controller as used in OPENSMART.

Supports battery display unit with 10 Segments.

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

Definition at line 292 of file TM1651.h.


Member Typedef Documentation

typedef char DisplayData_t[TM1651_DISPLAY_MEM] [inherited]

Datatype for displaydata.

Definition at line 166 of file TM1651.h.

typedef char KeyData_t [inherited]

Datatypes for keymatrix data.

Definition at line 169 of file TM1651.h.


Member Enumeration Documentation

enum Icon

Enums for Icons.

Enumerator:
LD12 

LED1 (Red) & LED2 (Red)

LD3 

LED3 (Yellow)

LD4 

LED4 (Yellow)

LD5 

LED5 (Yellow)

LD67 

LED6 (Green) & LED7 (Green)

LD89 

LED8 (Green) & LED9 (Green)

LD10 

LED10 (Blue)

Definition at line 297 of file TM1651.h.

enum Level

Enums for Batterylevels.

Enumerator:
LVL_0 

Level 0 = R12.

Level 6 = R12 - B10.

Level 0

LVL_1 

Level 1 = R12 - Y3.

Level 1.

LVL_2 

Level 2 = R12 - Y4.

Level 2.

LVL_3 

Level 3 = R12 - Y5.

Level 3.

LVL_4 

Level 4 = R12 - G67.

Level 4.

LVL_5 

Level 5 = R12 - G89.

Level 5.

LVL_0 

Level 0 = R12.

Level 6 = R12 - B10.

Level 0

LVL_1 

Level 1 = R12 - Y3.

Level 1.

LVL_2 

Level 2 = R12 - Y4.

Level 2.

LVL_3 

Level 3 = R12 - Y5.

Level 3.

LVL_4 

Level 4 = R12 - G67.

Level 4.

LVL_5 

Level 5 = R12 - G89.

Level 5.

LVL_6 

Level 6.

Definition at line 308 of file TM1651.h.


Constructor & Destructor Documentation

TM1651_OPENSMART ( PinName  dio,
PinName  clk 
)

Constructor for class for driving TM1651 LED controller.

Supports battery display unit with 10 Segments. Serial bus interface device.

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

Supports battery display unit with 10 segments. Serial bus interface device.

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

Definition at line 313 of file TM1651.cpp.


Member Function Documentation

void clrIcon ( Icon  icon )

Clr Icon.

Parameters:
Iconicon Enums Icon has Grid position encoded in 8 MSBs, Pattern encoded in 16 LSBs
Returns:
none

Definition at line 353 of file TM1651.cpp.

void cls (  )

Clear the screen and locate to 0.

Parameters:
none
Returns:
none

Reimplemented from TM1651.

Definition at line 321 of file TM1651.cpp.

bool getKeys ( KeyData_t keydata ) [inherited]

Read keydata block from TM1651.

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

Definition at line 151 of file TM1651.cpp.

void setBrightness ( char  brightness = TM1651_BRT_DEF ) [inherited]

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 83 of file TM1651.cpp.

void setDisplay ( bool  on ) [inherited]

Set the Display mode On/off.

Parameters:
booldisplay mode

Definition at line 94 of file TM1651.cpp.

void setIcon ( Icon  icon )

Set Icon.

Parameters:
Iconicon Enums Icon has Grid position encoded in 8 MSBs, Pattern encoded in 16 LSBs
Returns:
none
Parameters:
IconIcon Enums Icon has Grid position encoded in 8 MSBs, Pattern encoded in 16 LSBs
Returns:
none

Definition at line 336 of file TM1651.cpp.

void setLevel ( Level  level )

Set Level.

Parameters:
Levellevel Enums Level indicates the Battery level to be displayed
Returns:
none

Definition at line 371 of file TM1651.cpp.

void writeData ( char  data,
int  address 
)

Write databyte to TM1651.

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

Reimplemented from TM1651.

Definition at line 372 of file TM1651.h.

void writeData ( DisplayData_t  data,
int  length = (OPENSMART_NR_GRIDS * TM1651_BYTES_PER_GRID),
int  address = 0 
)

Write Display datablock to TM1651.

Parameters:
DisplayData_tdata Array of TM1651_DISPLAY_MEM (=4) bytes for displaydata
lengthnumber bytes to write (valid range 0..(OPENSMART_NR_GRIDS * TM1651_BYTES_PER_GRID) (=4), when starting at address 0)
intaddress display memory location to write bytes (default = 0)
Returns:
none

Reimplemented from TM1651.

Definition at line 382 of file TM1651.h.