Class for TM1637 Model 4.
More...
#include <TM1637plus.h>
|
| TM1637plus_modelX (uint8_t clock, uint8_t data, int delay, int DisplaySize) |
| Initialize a TM1637 object.
|
|
void | displayBegin (void) |
| Begin method , set and claims GPIO.
|
|
void | displayClose (void) |
| Close method.
|
|
void | displayClear (void) |
| Clears the display.
|
|
void | setBrightness (uint8_t brightness, bool on) |
| Sets the brightness of the display.
|
|
void | setSegments (const uint8_t segments[], uint8_t length, uint8_t pos) |
| Display data on the module.
|
|
void | DisplayDecimal (int num, bool leading_zero, uint8_t length, uint8_t pos) |
| Displays a decimal number.
|
|
void | DisplayDecimalwDot (int num, uint8_t dots, bool leading_zero, uint8_t length, uint8_t pos) |
| Displays a decimal number, with decimal point control.
|
|
int | DisplayString (const char *numStr, uint8_t dots, uint8_t length, uint8_t position) |
| Displays a character array.
|
|
unsigned char | encodeCharacter (unsigned char digit) |
| Translate a single Character into 7 segment code.
|
|
Class for TM1637 Model 4.
◆ TM1637plus_modelX()
TM1637plus_modelX::TM1637plus_modelX |
( |
uint8_t |
clock, |
|
|
uint8_t |
data, |
|
|
int |
delay, |
|
|
int |
displaySize |
|
) |
| |
Initialize a TM1637 object.
- Parameters
-
clock | GPIO connected to the clock pin of the module |
data | GPIO connected to the DIO pin of the module |
delay | microseconds delay, between bit transition on the serial bus connected to the display |
displaySize | number of digits in display. |
◆ displayBegin()
void TM1637plus_modelX::displayBegin |
( |
void |
| ) |
|
Begin method , set and claims GPIO.
- Note
- Call in Setup
◆ DisplayDecimal()
void TM1637plus_modelX::DisplayDecimal |
( |
int |
number, |
|
|
bool |
leading_zero, |
|
|
uint8_t |
length, |
|
|
uint8_t |
position |
|
) |
| |
Displays a decimal number.
Displays the given argument as a decimal number
- Parameters
-
number | The number to be shown |
leading_zero | When true, leading zeros are displayed. Otherwise unnecessary digits are blank |
length | The number of digits to set. The user must ensure that the number to be shown fits to the number of digits requested (for example, if two digits are to be displayed, the number must be between 0 to 99) |
position | The position most significant digit (0 - leftmost, 3 - rightmost) |
◆ DisplayDecimalwDot()
void TM1637plus_modelX::DisplayDecimalwDot |
( |
int |
number, |
|
|
uint8_t |
dots, |
|
|
bool |
leading_zero, |
|
|
uint8_t |
length, |
|
|
uint8_t |
position |
|
) |
| |
Displays a decimal number, with decimal point control.
Displays the given argument as a decimal number. The dots between the digits (or colon) can be individually controlled
- Parameters
-
number | The number to be shown |
dots | decimal point enable. The argument is a bitmask, with each bit corresponding to a dot between the digits (or colon mark, as implemented by each module). The MSB is the leftmost dot of the digit being update. For example, if pos is 1, the MSB of dots will correspond the dot near digit no. 2 from the left. Dots are updated only on those digits actually being update (that is, no more than len digits) For model 4 semi-colon display set to 0x40 to turn on the colon. |
leading_zero | When true, leading zeros are displayed. Otherwise unnecessary digits are blank |
length | The number of digits to set. The user must ensure that the number to be shown fits to the number of digits requested (for example, if two digits are to be displayed, the number must be between 0 to 99) |
position | The position least significant digit (0 - leftmost, 3 - rightmost) |
◆ DisplayString()
int TM1637plus_modelX::DisplayString |
( |
const char * |
numStr, |
|
|
uint8_t |
dots, |
|
|
uint8_t |
length, |
|
|
uint8_t |
position |
|
) |
| |
Displays a character array.
- Parameters
-
numStr | The character array to be shown |
dots | decimal point enable. The argument is a bitmask, with each bit corresponding to a dot between the digits (or colon mark, as implemented by each module). The MSB is the leftmost dot of the digit being update. For example, if pos is 1, the MSB of dots will correspond the dot near digit no. 2 from the left. Dots are updated only on those digits actually being update (that is, no more than len digits) For model 4 semi-colon display set to 0x40 to turn on the colon. |
length | The number of digits to set. The user must ensure that the number to be shown fits to the number of digits requested |
position | The position most significant digit (0 - leftmost, 3 - rightmost) |
- Returns
- Zero for success , -2 for nullptr, -3 input string size not equal to specified length.
◆ encodeCharacter()
unsigned char TM1637plus_modelX::encodeCharacter |
( |
unsigned char |
digit | ) |
|
Translate a single Character into 7 segment code.
The method accepts a ASCII character and converts it to the seven segment code required to display the number on a 7 segment display. by referencing the ASCII font table on file.
- Parameters
-
- Returns
- A code representing the 7 segment image of the digit (LSB - segment A; bit 6 - segment G; bit 7 - always zero) from the font. Will return zero(0x3F) if ASCII digit not in font.
◆ setBrightness()
void TM1637plus_modelX::setBrightness |
( |
uint8_t |
brightness, |
|
|
bool |
on |
|
) |
| |
Sets the brightness of the display.
- Parameters
-
brightness | A number from 0 to 7 (highest brightness) |
on | Turn display on or off |
- Note
- The setting takes effect when a command is given to change the data being displayed.
◆ setSegments()
void TM1637plus_modelX::setSegments |
( |
const uint8_t |
segments[], |
|
|
uint8_t |
length, |
|
|
uint8_t |
position |
|
) |
| |
Display data on the module.
This function receives segment values as input and displays them. The segment data is given as a byte array, each byte corresponding to a single digit. Within each byte, bit 0 is segment A, bit 1 is segment B etc. The function may either set the entire display or any desirable part on its own. The first digit is given by the reference position argument with 0 being the leftmost digit. The reference length argument is the number of digits to be set. Other digits are not affected.
- Parameters
-
segments | An array of size length containing the raw segment values, check font in seven_segment_font_data.hpp |
length | The number of digits to be modified |
position | The position from which to start the modification (0 - leftmost, 3 - rightmost) |
The documentation for this class was generated from the following files: