AceSegment
0.7.0
A framework for rendering seven segment LED displays using the TM1637, MAX7219, HT16K33, or 74HC595 controller chips
|
25 #ifndef ACE_SEGMENT_LEVEL_WRITER_H
26 #define ACE_SEGMENT_LEVEL_WRITER_H
29 #include "PatternWriter.h"
31 namespace ace_segment {
41 static const uint8_t kLevelLeftPattern = 0b00110000;
43 static const uint8_t kLevelRightPattern = 0b00000110;
64 uint8_t fullDigits = level / 2;
65 uint8_t partialDigit = level & 0x1;
69 while (pos < fullDigits && pos < numDigits) {
71 pos++, kLevelLeftPattern | kLevelRightPattern);
73 if (partialDigit && pos < numDigits) {
LedModule & ledModule() const
Return the underlying LedModule.
void writePatternAt(uint8_t pos, uint8_t pattern)
Write the pattern for a given pos.
LevelWriter(LedModule &ledModule)
Constructor.
General interface that represents a generic seven-segment LED module with multiple digits.
LedModule & ledModule() const
Get the underlying LedModule.
void writeLevel(uint8_t level)
Write out the level bar, 2 levels per digit.
void clearToEnd(uint8_t pos)
Clear the display from pos to the end.
Emulate a level led module using a left vertical bar and a right vertical bar on each digit.
uint8_t getNumDigits() const
Return the number of digits supported by this display instance.
uint8_t getMaxLevel() const
Return the maximum level supported by this LED display.
Write LED segment patterns to the underlying LedModule.