21 0b00000000, 0b01110111, 0b00011111, 0b01001110,
22 0b00111101, 0b01001111, 0b01000111, 0b01011110,
23 0b00010111, 0b00110000, 0b00111100, 0b00000111,
24 0b00001110, 0b01110110, 0b00010101, 0b00011101,
25 0b01100111, 0b01110011, 0b00000101, 0b01011011,
26 0b00001111, 0b00011100, 0b00100111, 0b00111110,
27 0b00110111, 0b00111011, 0b01101101, 0b01001110,
28 0b00010011, 0b01111000, 0b01100010, 0b00001000,
29 0b00000000, 0b00000000, 0b00100010, 0b01100011,
30 0b01011011, 0b01100111, 0b01111101, 0b00000010,
31 0b01001110, 0b01111000, 0b01100011, 0b00110001,
32 0b00000100, 0b00000001, 0b00001000, 0b00100101,
33 0b01111110, 0b00110000, 0b01101101, 0b01111001,
34 0b00110011, 0b01011011, 0b01011111, 0b01110000,
35 0b01111111, 0b01111011, 0b00000000, 0b01000100,
36 0b00110001, 0b00001001, 0b00000111, 0b01100101,
50template <
class SPIDriver = decltype(SPI) &>
84 this->
sendRaw((digit % 8) + 1, value, digit / 8);
113 int16_t
display(
long number, int16_t startDigit = 0,
114 int16_t endDigit = -1) {
119 unsigned long anumber = std::abs(number);
120 int16_t i = startDigit;
124 }
while (anumber && i <= endDigit);
125 if (number < 0 && i <= endDigit) {
129 for (int16_t i = startDigit; i <= endDigit;)
133 while (i <= endDigit)
136 return endDigit - startDigit;
140 int16_t
display(
int number, int16_t startDigit = 0, int16_t endDigit = -1) {
141 return display(
long(number), startDigit, endDigit);
164 int16_t
display(
unsigned long number, int16_t startDigit = 0,
165 int16_t endDigit = -1) {
170 int16_t i = startDigit;
174 }
while (number && i <= endDigit);
176 for (int16_t i = startDigit; i <= endDigit;)
180 while (i <= endDigit)
183 return endDigit - startDigit;
187 int16_t
display(
unsigned int number, int16_t startDigit = 0,
188 int16_t endDigit = -1) {
189 return display((
unsigned long)(number), startDigit, endDigit);
202 int16_t
display(
const char *text, int16_t startPos = 0) {
207 while (*text && (i > 0 || *text ==
'.')) {
219 }
else if (c >=
'@' && c <=
'_')
221 else if (c >=
'!' && c <=
'?')
223 else if (c >=
'a' && c <=
'z')
243 uint8_t c = value >= 0x0A
267 int16_t
displayHex(
unsigned long number, int16_t startDigit = 0,
268 int16_t endDigit = -1) {
273 int16_t i = startDigit;
277 }
while (number && i <= endDigit);
279 for (int16_t i = startDigit; i <= endDigit;)
283 while (i <= endDigit)
286 return endDigit - startDigit;
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
static constexpr const uint8_t * NumericChars
static constexpr const uint8_t * AlphaChars
static constexpr uint8_t SevenSegmentCharacters[0x40]
A lookup table for 7-segment characters, as specified by the Logic Control manual.
#define BEGIN_AH_NAMESPACE
A class for 8-digit 7-segment displays with a MAX7219 driver.
uint8_t getNumberOfDigits() const
Get the total number of digits in this chain of displays, i.e.
int16_t display(unsigned int number, int16_t startDigit=0, int16_t endDigit=-1)
Display a long unsigned integer to the display.
int16_t display(long number, int16_t startDigit=0, int16_t endDigit=-1)
Display a long integer to the display.
int16_t display(const char *text, int16_t startPos=0)
Display a string of text to the display.
int16_t displayHex(unsigned long number, int16_t startDigit=0, int16_t endDigit=-1)
Print a number to the display in hexadecimal format.
int16_t display(int number, int16_t startDigit=0, int16_t endDigit=-1)
Display a long integer to the display.
MAX7219SevenSegmentDisplay(SPIDriver spi, pin_t loadPin, uint8_t chainlength=1)
Create a MAX7219SevenSegmentDisplay.
void sendDigit(uint16_t digit, uint8_t value)
Set the value of a single digit.
int16_t display(unsigned long number, int16_t startDigit=0, int16_t endDigit=-1)
Display a long unsigned integer to the display.
void printHexChar(int16_t digit, uint8_t value)
Print a single hexadecimal digit.
A base class for classes that control MAX7219 LED drivers.
uint8_t getChainLength() const
Get the number of daisy-chained chips.
void sendRaw(uint8_t opcode, uint8_t value, uint8_t chip=0)
Send a raw opcode and value to the given MAX7219.
void begin()
Initialize the Arduino pins, SPI, and the MAX7219.