AceSegment
0.11.0
A library for rendering seven segment LED displays using the TM1637, TM1638, MAX7219, HT16K33, or 74HC595 controller chips
|
General interface that represents a generic seven-segment LED module with multiple digits. More...
#include <LedModule.h>
Public Member Functions | |
LedModule (uint8_t *patterns, uint8_t numDigits) | |
Constructor. More... | |
uint8_t | getNumDigits () const |
Return the number of digits supported by this display instance. | |
void | setPatternAt (uint8_t pos, uint8_t pattern) |
Set the led digit pattern at position pos. | |
uint8_t | getPatternAt (uint8_t pos) const |
Get the led digit pattern at position pos. | |
void | setBrightness (uint8_t brightness) |
Set global brightness of all digits. More... | |
uint8_t | getBrightness () const |
Get the current brightness. | |
Protected Member Functions | |
void | begin () |
Subclasses should call this from its own begin(). | |
void | end () |
Subclasses should call this from its own end(). More... | |
void | setDigitDirty (uint8_t pos) |
Set the dirty bit of digit pos . | |
void | clearDigitDirty (uint8_t pos) |
Clear the dirty bit of digit pos . | |
bool | isDigitDirty (uint8_t pos) const |
Check the dirty bit of digit pos . | |
void | clearDigitsDirty () |
Clear dirty bits of all digits. | |
bool | isAnyDigitDirty () const |
Return true if any digits are dirty. | |
bool | isBrightnessDirty () const |
Check if the brightness level is dirty. | |
void | setBrightnessDirty () |
Mark the brightness as dirty. | |
void | clearBrightnessDirty () |
Clear the dirty bit for brightness. | |
General interface that represents a generic seven-segment LED module with multiple digits.
Subclasses will support different driver chips (e.g. TM1637, MAX7219, or even a 74HC595).
The digit addressing scheme is normalized at this layer so that digit 0 is the left most digit, and digit 'numDigits-1' is the right most digit. The segment addressing is also normalized so that bit 0 is the 'A' segment, bit 6 is 'G' segment, and bit 7 is the decimal point. If an LED module does not conform to this convention, the implementation class for that hardware must remap the digit and segment addresses.
Definition at line 44 of file LedModule.h.
|
inlineexplicit |
Constructor.
patterns | pointer to an array of bytes representing LED segment patterns |
numDigits | number of digits in the LED module; this value is returned by getNumDigits(). The value is usually a compile-time constant passed in through a template parameter, so it is faster and cheaper to use the template parameterx. However, sometimes the calling code needs this value but it has only a reference or pointer to the LedModule. Then getNumDigits() can be used. |
Definition at line 58 of file LedModule.h.
|
inlineprotected |
Subclasses should call this from its own end().
Currently does nothing.
Definition at line 108 of file LedModule.h.
|
inline |
Set global brightness of all digits.
Different subclasses will interpret the brightness integer value differently.
Definition at line 81 of file LedModule.h.