mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Added degree symbol for MAX7219 7-segment display. (#764)
The ascii char to use it is "~" (0x7E). Disclaimer: I didn't test this yet.
This commit is contained in:
parent
e21dbc4b60
commit
d33a158585
1 changed files with 3 additions and 2 deletions
|
@ -14,7 +14,7 @@ static const uint8_t MAX7219_REGISTER_SCAN_LIMIT = 0x0B;
|
||||||
static const uint8_t MAX7219_REGISTER_SHUTDOWN = 0x0C;
|
static const uint8_t MAX7219_REGISTER_SHUTDOWN = 0x0C;
|
||||||
static const uint8_t MAX7219_UNKNOWN_CHAR = 0b11111111;
|
static const uint8_t MAX7219_UNKNOWN_CHAR = 0b11111111;
|
||||||
|
|
||||||
const uint8_t MAX7219_ASCII_TO_RAW[94] PROGMEM = {
|
const uint8_t MAX7219_ASCII_TO_RAW[95] PROGMEM = {
|
||||||
0b00000000, // ' ', ord 0x20
|
0b00000000, // ' ', ord 0x20
|
||||||
0b10110000, // '!', ord 0x21
|
0b10110000, // '!', ord 0x21
|
||||||
0b00100010, // '"', ord 0x22
|
0b00100010, // '"', ord 0x22
|
||||||
|
@ -109,6 +109,7 @@ const uint8_t MAX7219_ASCII_TO_RAW[94] PROGMEM = {
|
||||||
0b00110001, // '{', ord 0x7B
|
0b00110001, // '{', ord 0x7B
|
||||||
0b00000110, // '|', ord 0x7C
|
0b00000110, // '|', ord 0x7C
|
||||||
0b00000111, // '}', ord 0x7D
|
0b00000111, // '}', ord 0x7D
|
||||||
|
0b01100011, // '~', ord 0x7E (degree symbol)
|
||||||
};
|
};
|
||||||
|
|
||||||
float MAX7219Component::get_setup_priority() const { return setup_priority::PROCESSOR; }
|
float MAX7219Component::get_setup_priority() const { return setup_priority::PROCESSOR; }
|
||||||
|
@ -166,7 +167,7 @@ uint8_t MAX7219Component::print(uint8_t start_pos, const char *str) {
|
||||||
uint8_t pos = start_pos;
|
uint8_t pos = start_pos;
|
||||||
for (; *str != '\0'; str++) {
|
for (; *str != '\0'; str++) {
|
||||||
uint8_t data = MAX7219_UNKNOWN_CHAR;
|
uint8_t data = MAX7219_UNKNOWN_CHAR;
|
||||||
if (*str >= ' ' && *str <= '}')
|
if (*str >= ' ' && *str <= '~')
|
||||||
data = pgm_read_byte(&MAX7219_ASCII_TO_RAW[*str - ' ']);
|
data = pgm_read_byte(&MAX7219_ASCII_TO_RAW[*str - ' ']);
|
||||||
|
|
||||||
if (data == MAX7219_UNKNOWN_CHAR) {
|
if (data == MAX7219_UNKNOWN_CHAR) {
|
||||||
|
|
Loading…
Reference in a new issue