TEST
Dependents: ADXL345Test ADXL345Test1
Fork of TM1638 by
TM1638 Class Reference
A class for driving TM1638 LED controller. More...
#include <TM1638.h>
Inherited by TM1638_LEDKEY8, TM1638_LKM1638, and TM1638_QYF.
Public Types | |
typedef char | DisplayData_t [TM1638_DISPLAY_MEM] |
Datatype for display data. | |
typedef char | KeyData_t [TM1638_KEY_MEM] |
Datatypes for keymatrix data. | |
Public Member Functions | |
TM1638 (PinName mosi, PinName miso, PinName sclk, PinName cs) | |
Constructor for class for driving TM1638 LED controller. | |
void | cls () |
Clear the screen and locate to 0. | |
void | writeData (char data, int address) |
Write databyte to TM1638. | |
void | writeData (DisplayData_t data, int length=(TM1638_MAX_NR_GRIDS *TM1638_BYTES_PER_GRID), int address=0) |
Write Display datablock to TM1638. | |
bool | getKeys (KeyData_t *keydata) |
Read keydata block from TM1638. | |
void | setBrightness (char brightness=TM1638_BRT_DEF) |
Set Brightness. | |
void | setDisplay (bool on) |
Set the Display mode On/off. |
Detailed Description
A class for driving TM1638 LED controller.
Supports 8 Grids @ 10 Segments. Also supports a scanned keyboard of upto 24 keys. SPI bus interface device.
Definition at line 121 of file TM1638.h.
Member Typedef Documentation
typedef char DisplayData_t[TM1638_DISPLAY_MEM] |
typedef char KeyData_t[TM1638_KEY_MEM] |
Constructor & Destructor Documentation
TM1638 | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk, | ||
PinName | cs | ||
) |
Constructor for class for driving TM1638 LED controller.
Constructor for class for driving TM1638 LED controller with SPI bus interface device.
Supports 8 Grids @ 10 segments. Also supports a scanned keyboard of upto 24 keys. SPI bus interface device.
- Parameters:
-
PinName mosi, miso, sclk, cs SPI bus pins
Supports 8 digits @ 10 segments. Also supports a scanned keyboard of upto 24 keys.
- Parameters:
-
PinName mosi, miso, sclk, cs SPI bus pins
Definition at line 34 of file TM1638.cpp.
Member Function Documentation
void cls | ( | ) |
Clear the screen and locate to 0.
Definition at line 69 of file TM1638.cpp.
bool getKeys | ( | KeyData_t * | keydata ) |
Read keydata block from TM1638.
- Parameters:
-
*keydata Ptr to Array of TM1638_KEY_MEM (=4) bytes for keydata
- Returns:
- bool keypress True when at least one key was pressed
Note: Due to the hardware configuration the TM1638 key matrix scanner will detect multiple keys pressed at same time, but this may result in some spurious keys also being set in keypress data array. It may be best to ignore all keys in those situations. That option is implemented in this method depending on define setting.
- Parameters:
-
*keydata Ptr to Array of TM1638_KEY_MEM (=4) bytes for keydata
- Returns:
- bool keypress True when at least one key was pressed
Note: Due to the hardware configuration the TM1638 key matrix scanner will detect multiple keys pressed at same time, but this may also result in some spurious keys being set in keypress data array. It may be best to ignore all keys in those situations. That option is implemented in this method depending on define setting.
Definition at line 165 of file TM1638.cpp.
void setBrightness | ( | char | brightness = TM1638_BRT_DEF ) |
Set Brightness.
- Parameters:
-
char brightness (3 significant bits, valid range 0..7 (1/16 .. 14/16 dutycycle)
- Returns:
- none
- Parameters:
-
char brightness (3 significant bits, valid range 0..7 (1/16 .. 14/14 dutycycle)
- Returns:
- none
Definition at line 88 of file TM1638.cpp.
void setDisplay | ( | bool | on ) |
void writeData | ( | char | data, |
int | address | ||
) |
Write databyte to TM1638.
- Parameters:
-
char data byte written at given address int address display memory location to write byte
- Returns:
- none
Reimplemented in TM1638_LEDKEY8, TM1638_QYF, and TM1638_LKM1638.
Definition at line 117 of file TM1638.cpp.
void writeData | ( | DisplayData_t | data, |
int | length = (TM1638_MAX_NR_GRIDS * TM1638_BYTES_PER_GRID) , |
||
int | address = 0 |
||
) |
Write Display datablock to TM1638.
- Parameters:
-
DisplayData_t data Array of TM1638_DISPLAY_MEM (=16) bytes for displaydata length number bytes to write (valid range 0..(TM1638_MAX_NR_GRIDS * TM1638_BYTES_PER_GRID) (=16), when starting at address 0) int address display memory location to write bytes (default = 0)
- Returns:
- none
- Parameters:
-
DisplayData_t data Array of TM1638_DISPLAY_MEM (=16) bytes for displaydata length number bytes to write (valid range 0..TM1638_DISPLAY_MEM (=16), when starting at address 0) int address display memory location to write bytes (default = 0)
- Returns:
- none
Reimplemented in TM1638_LEDKEY8, TM1638_QYF, and TM1638_LKM1638.
Definition at line 135 of file TM1638.cpp.
Generated on Tue Jul 12 2022 18:47:06 by 1.7.2