Class for Model 1 and Model 3.
More...
#include <TM1638plus.h>
|
| TM1638plus (uint8_t strobe, uint8_t clock, uint8_t data, bool highfreq=false) |
| Constructor for class TM1638plus. More...
|
|
uint8_t | readButtons (void) |
| Read buttons values from display. More...
|
|
void | setLEDs (uint16_t greenred) |
| Set all LED's on or off Model 1 & 3. More...
|
|
void | setLED (uint8_t position, uint8_t value) |
| Set ONE LED on or off Model 1 & 3. More...
|
|
void | displayText (const char *text) |
| Display a text string on display. More...
|
|
void | displayASCII (uint8_t position, uint8_t ascii) |
| Display an ASCII character on display. More...
|
|
void | displayASCIIwDot (uint8_t position, uint8_t ascii) |
| Display an ASCII character with decimal point turned on. More...
|
|
void | displayHex (uint8_t position, uint8_t hex) |
| Send Hexadecimal value to seven segment. More...
|
|
void | display7Seg (uint8_t position, uint8_t value) |
| Send seven segment value to seven segment. More...
|
|
void | displayIntNum (unsigned long number, boolean leadingZeros=true, AlignTextType_e=TMAlignTextLeft) |
| Display an integer and leading zeros optional. More...
|
|
void | DisplayDecNumNibble (uint16_t numberUpper, uint16_t numberLower, boolean leadingZeros=true, AlignTextType_e=TMAlignTextLeft) |
| Display an integer in a nibble (4 digits on display) More...
|
|
| TM1638plus_common () |
| Constructor for class TM1638plus_common.
|
|
void | displayBegin () |
| Begin method , sets pin modes and activate display. More...
|
|
void | reset (void) |
| Reset / clear the display. More...
|
|
void | brightness (uint8_t brightness) |
| Sets the brightness level of segments in display on a scale of brightness. More...
|
|
Class for Model 1 and Model 3.
◆ TM1638plus()
TM1638plus::TM1638plus |
( |
uint8_t |
strobe, |
|
|
uint8_t |
clock, |
|
|
uint8_t |
data, |
|
|
bool |
highfreq = false |
|
) |
| |
Constructor for class TM1638plus.
- Parameters
-
strobe | GPIO STB pin |
clock | GPIO CLK pin |
data | GPIO DIO pin |
highfreq | Changes the value of parameter _HIGH_FREQ which is default false. |
- Note
- _HIGH_FREQ is used when running high freq MCU CPU (~>100Mhz) because of issues with button function. Pass true to turn on.
◆ display7Seg()
void TM1638plus::display7Seg |
( |
uint8_t |
position, |
|
|
uint8_t |
value |
|
) |
| |
Send seven segment value to seven segment.
- Parameters
-
position | The position on display 0-7
|
value | byte of data corresponding to segments (dp)gfedcba |
- Note
- 0b01000001 in value will set g and a on.
◆ displayASCII()
void TM1638plus::displayASCII |
( |
uint8_t |
position, |
|
|
uint8_t |
ascii |
|
) |
| |
Display an ASCII character on display.
- Parameters
-
position | The position on display 0-7
|
ascii | The ASCII value from font table to display |
◆ displayASCIIwDot()
void TM1638plus::displayASCIIwDot |
( |
uint8_t |
position, |
|
|
uint8_t |
ascii |
|
) |
| |
Display an ASCII character with decimal point turned on.
- Parameters
-
position | The position on display 0-7 |
ascii | The ASCII value from font table to display |
◆ DisplayDecNumNibble()
void TM1638plus::DisplayDecNumNibble |
( |
uint16_t |
numberUpper, |
|
|
uint16_t |
numberLower, |
|
|
boolean |
leadingZeros = true , |
|
|
AlignTextType_e |
TextAlignment = TMAlignTextLeft |
|
) |
| |
Display an integer in a nibble (4 digits on display)
- Parameters
-
numberUpper | upper nibble integer 2^16 |
numberLower | lower nibble integer 2^16 |
leadingZeros | leading zeros set, true on , false off |
TextAlignment | left or right text alignment on display |
- Note
- Divides the display into two nibbles and displays a Decimal number in each. takes in two numbers 0-9999 for each nibble.
◆ displayHex()
void TM1638plus::displayHex |
( |
uint8_t |
position, |
|
|
uint8_t |
hex |
|
) |
| |
Send Hexadecimal value to seven segment.
- Parameters
-
position | The position on display 0-7
|
hex | hexadecimal value (DEC) 0-15 (0x00 - 0x0F) |
◆ displayIntNum()
Display an integer and leading zeros optional.
- Parameters
-
number | integer to display 2^32 |
leadingZeros | leading zeros set, true on , false off |
TextAlignment | left or right text alignment on display |
◆ displayText()
void TM1638plus::displayText |
( |
const char * |
text | ) |
|
Display a text string on display.
- Parameters
-
text | pointer to a character array |
- Note
- Dots are removed from string and dot on preceding digit switched on "abc.def" will be shown as "abcdef" with c decimal point turned on.
◆ readButtons()
uint8_t TM1638plus::readButtons |
( |
void |
| ) |
|
Read buttons values from display.
- Returns
- byte with value of buttons 1-8 b7b6b5b4b3b2b1b0 1 pressed, 0 not pressed.
- Note
- User may have to debounce buttons depending on application.
◆ setLED()
void TM1638plus::setLED |
( |
uint8_t |
position, |
|
|
uint8_t |
value |
|
) |
| |
Set ONE LED on or off Model 1 & 3.
- Parameters
-
position | 0-7 == L1-L8 on PCB |
value | 0 off 1 on |
◆ setLEDs()
void TM1638plus::setLEDs |
( |
uint16_t |
ledvalues | ) |
|
Set all LED's on or off Model 1 & 3.
- Parameters
-
ledvalues | see note behaviour differs depending on Model. |
- Note
- Model 3
- Upper byte for the green LEDs, Lower byte for the red LEDs (0xgreenred) (0xGGRR)
- ie. 0xE007 1110 0000 0000 0111 results in L8-L0 GGGX XRRR, L8 is RHS on display
- MODEL 1:
- Upper byte 1 for LED data , Lower byte n/a set to 0x00 (0xleds, 0x00)
- i.e 0xF100 1111 0000 L8-L0 RRRR XXXX , L8 is RHS on display
The documentation for this class was generated from the following files: