Library for TM1640 LED controller Initial version

Dependents:   mbed_TM1640

Embed: (wiki syntax)

« Back to documentation index

TM1640_LM1640 Class Reference

Constructor for class for driving TM1640 controller as used in LM1640. More...

#include <TM1640.h>

Inherits TM1640.

Public Types

enum  Icon {
  DP1 = ( 1<<24) | S7_DP1, DP2 = ( 2<<24) | S7_DP2, DP3 = ( 3<<24) | S7_DP3, DP4 = ( 4<<24) | S7_DP4,
  DP5 = ( 5<<24) | S7_DP5, DP6 = ( 6<<24) | S7_DP6, DP7 = ( 7<<24) | S7_DP7, DP8 = ( 8<<24) | S7_DP8,
  DP9 = ( 9<<24) | S7_DP9, DP10 = (10<<24) | S7_DP10, DP11 = (11<<24) | S7_DP11, DP12 = (12<<24) | S7_DP12,
  DP13 = (13<<24) | S7_DP13, DP14 = (14<<24) | S7_DP14, DP15 = (15<<24) | S7_DP15, DP16 = (16<<24) | S7_DP16
}
 

Enums for Icons.

More...
typedef char DisplayData_t [TM1640_DISPLAY_MEM]
 Datatype for displaydata.

Public Member Functions

 TM1640_LM1640 (PinName mosi, PinName sclk)
 Constructor for class for driving TM1640 LED controller as used in LM1640.
int putc (int c)
 Write a character to the Display.
int printf (const char *format,...)
 Write a formatted string to the Display.
void locate (int column)
 Locate cursor to a screen column.
void cls (bool clrAll=false)
 Clear the screen and locate to 0.
void setIcon (Icon icon)
 Set Icon.
void clrIcon (Icon icon)
 Clr Icon.
void setUDC (unsigned char udc_idx, int udc_data)
 Set User Defined Characters (UDC)
int columns ()
 Number of screen columns.
void writeData (char data, int address)
 Write databyte to TM1640.
void writeData (DisplayData_t data, int length=(LM1640_NR_GRIDS *TM1640_BYTES_PER_GRID), int address=0)
 Write Display datablock to TM1640.
void cls ()
 Clear the screen and locate to 0.
void setBrightness (char brightness=TM1640_BRT_DEF)
 Set Brightness.
void setDisplay (bool on)
 Set the Display mode On/off.

Protected Member Functions

virtual int _putc (int value)
 Write a single character (Stream implementation)

Detailed Description

Constructor for class for driving TM1640 controller as used in LM1640.

Supports 16 Digits of 7 Segments + DP.

Parameters:
PinNamemosi Serial bus MOSI pin
PinNamesclk Serial bus SCLK pin

Definition at line 210 of file TM1640.h.


Member Typedef Documentation

typedef char DisplayData_t[TM1640_DISPLAY_MEM] [inherited]

Datatype for displaydata.

Definition at line 109 of file TM1640.h.


Member Enumeration Documentation

enum Icon

Enums for Icons.

Enumerator:
DP1 

Decimal Point 1.

DP2 

Decimal Point 2.

DP3 

Decimal Point 3.

DP4 

Decimal Point 4.

DP5 

Decimal Point 5.

DP6 

Decimal Point 6.

DP7 

Decimal Point 7.

DP8 

Decimal Point 8.

DP9 

Decimal Point 9.

DP10 

Decimal Point 10.

DP11 

Decimal Point 11.

DP12 

Decimal Point 12.

DP13 

Decimal Point 13.

DP14 

Decimal Point 14.

DP15 

Decimal Point 15.

DP16 

Decimal Point 16.

Definition at line 215 of file TM1640.h.


Constructor & Destructor Documentation

TM1640_LM1640 ( PinName  mosi,
PinName  sclk 
)

Constructor for class for driving TM1640 LED controller as used in LM1640.

Supports 16 Digits of 7 Segments + DP.

Parameters:
PinNamemosi Serial bus MOSI pin
PinNamesclk Serial bus SCLK pin

Supports 8 Digits of 7 Segments + DP.

Parameters:
PinNamemosi Serial bus MOSI pin
PinNamesclk Serial bus SCLK pin

Definition at line 215 of file TM1640.cpp.


Member Function Documentation

int _putc ( int  value ) [protected, virtual]

Write a single character (Stream implementation)

Definition at line 339 of file TM1640.cpp.

void clrIcon ( Icon  icon )

Clr Icon.

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

Definition at line 306 of file TM1640.cpp.

void cls ( bool  clrAll = false )

Clear the screen and locate to 0.

Parameters:
boolclrAll Clear Icons also (default = false)

Definition at line 263 of file TM1640.cpp.

void cls (  ) [inherited]

Clear the screen and locate to 0.

Definition at line 58 of file TM1640.cpp.

int columns (  )

Number of screen columns.

Parameters:
none
Returns:
columns

Definition at line 255 of file TM1640.cpp.

void locate ( int  column )

Locate cursor to a screen column.

Parameters:
columnThe horizontal position from the left, indexed from 0

Definition at line 241 of file TM1640.cpp.

int printf ( const char *  format,
  ... 
)

Write a formatted string to the Display.

Parameters:
formatA printf-style format string, followed by the variables to use in formatting the string.
int putc ( int  c )

Write a character to the Display.

Parameters:
cThe character to write to the display
void setBrightness ( char  brightness = TM1640_BRT_DEF ) [inherited]

Set Brightness.

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

Definition at line 75 of file TM1640.cpp.

void setDisplay ( bool  on ) [inherited]

Set the Display mode On/off.

Parameters:
booldisplay mode

Definition at line 86 of file TM1640.cpp.

void setIcon ( Icon  icon )

Set Icon.

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

Definition at line 288 of file TM1640.cpp.

void setUDC ( unsigned char  udc_idx,
int  udc_data 
)

Set User Defined Characters (UDC)

Parameters:
unsignedchar udc_idx The Index of the UDC (0..7)
intudc_data The bitpattern for the UDC (16 bits)
unsignedchar udc_idx The Index of the UDC (0..7)
intudc_data The bitpattern for the UDC (8 bits)

Definition at line 325 of file TM1640.cpp.

void writeData ( char  data,
int  address 
)

Write databyte to TM1640.

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

Reimplemented from TM1640.

Definition at line 306 of file TM1640.h.

void writeData ( DisplayData_t  data,
int  length = (LM1640_NR_GRIDS * TM1640_BYTES_PER_GRID),
int  address = 0 
)

Write Display datablock to TM1640.

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

Reimplemented from TM1640.

Definition at line 316 of file TM1640.h.