AceSegment
0.8.2
A framework for rendering seven segment LED displays using the TM1637, MAX7219, HT16K33, or 74HC595 controller chips
|
The NumberWriter supports converting decimal and hexadecimal numbers to segment patterns expected by LedModule. More...
#include <NumberWriter.h>
Public Member Functions | |
NumberWriter (T_LED_MODULE &ledModule) | |
Constructor. | |
T_LED_MODULE & | ledModule () |
Get the underlying LedModule. | |
PatternWriter< T_LED_MODULE > & | patternWriter () |
Get the underlying PatternWriter. | |
void | writeHexCharAt (uint8_t pos, hexchar_t c) |
Write the hex character c at position pos . More... | |
void | writeHexCharsAt (uint8_t pos, const hexchar_t s[], uint8_t len) |
Write the len hex characters given by s starting at pos . | |
void | writeHexByteAt (uint8_t pos, uint8_t b) |
Write the 2-digit (8-bit) hexadecimal byte 'b' at pos. | |
void | writeHexWordAt (uint8_t pos, uint16_t w) |
Write the 4 digit (16-bit) hexadecimal word at pos. | |
uint8_t | writeUnsignedDecimalAt (uint8_t pos, uint16_t num, int8_t boxSize=0) |
Write the 16-bit unsigned number num as a decimal number at pos. More... | |
uint8_t | writeSignedDecimalAt (uint8_t pos, int16_t num, int8_t boxSize=0) |
Same as writeUnsignedDecimalAt() but prepends a '-' sign if negative. | |
void | writeUnsignedDecimal2At (uint8_t pos, uint8_t num) |
Write the 2 digit decimal number at pos. More... | |
void | writeDecimalPointAt (uint8_t pos, bool state=true) |
Write the decimal point for the pos. More... | |
void | clear () |
Clear the entire display. | |
void | clearToEnd (uint8_t pos) |
Clear the display from pos to the end. More... | |
The NumberWriter supports converting decimal and hexadecimal numbers to segment patterns expected by LedModule.
The character set includes 0 to F, and a few other characters which should be self-explanatory: kHexCharSpace and kHexCharMinus.
T_LED_MODULE | the class of the underlying LED Module, often LedModule but other classes with the same generic public methods can be substituted |
Definition at line 72 of file NumberWriter.h.
|
inline |
Clear the display from pos
to the end.
Useful after calling writeSignedDecimalAt() and writeUnsignedDecimalAt() which prints a variable number of digits.
Definition at line 204 of file NumberWriter.h.
|
inline |
Write the decimal point for the pos.
Clock LED modules will attach the colon segment to one of the decimal points.
Definition at line 192 of file NumberWriter.h.
|
inline |
Write the hex character c
at position pos
.
If c
falls outside the valid range of the kHexCharPatterns set, a kHexCharSpace
character is printed instead.
Definition at line 90 of file NumberWriter.h.
|
inline |
Write the 2 digit decimal number at pos.
This method always writes 2 characters. The padding is always a space, so 9 is printed as " 9" not "09". If num >= 100, then this prints "99".
This method is meant to be a lighter version of writeUnsignedDecimalAt() when only 2 digits are needed. Seems to save about 110 bytes of flash.
Definition at line 176 of file NumberWriter.h.
|
inline |
Write the 16-bit unsigned number num
as a decimal number at pos.
pos | start position of the number |
num | unsigned decimal number, 0-65535 |
boxSize | size of box. This is meant to be similar to the "%-5d" or "%5d" specifier to the printf() function
|
Definition at line 134 of file NumberWriter.h.