From 0da161ccd10102616cd7551a39c7a880f9566d69 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Tue, 28 Apr 2020 17:46:40 +0200 Subject: [PATCH] Fonts * Added font_numbers3x3 --- include/fonts.h | 1 + src/fonts.cpp | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/fonts.h b/include/fonts.h index 2217003..d5fb4f7 100644 --- a/include/fonts.h +++ b/include/fonts.h @@ -2,6 +2,7 @@ #include "prototypes.h" extern Font font_numbers3x5; +extern Font font_numbers3x3; extern Font font_numbers3x5_blocky; extern Font font_numbers4x7; extern Font font5x7; diff --git a/src/fonts.cpp b/src/fonts.cpp index 616a1e1..1868d72 100644 --- a/src/fonts.cpp +++ b/src/fonts.cpp @@ -16,6 +16,22 @@ bool font_numbers3x5_check(const char c) { return c>='0' && c<='9'; } uint16_t font_numbers3x5_get(const char c) { return c - '0'; } Font font_numbers3x5 = {3, 5, &font_numbers3x5_data[0], font_numbers3x5_check, font_numbers3x5_get}; +const uint8_t font_numbers3x3_data[] PROGMEM = { + B111, B101, B111, // 0 + B101, B111, B001, // 1 + B100, B111, B001, // 2 + B101, B111, B111, // 3 + B110, B010, B111, // 4 + B001, B111, B100, // 5 + B111, B011, B011, // 6 + B100, B100, B111, // 7 + B011, B111, B111, // 8 + B110, B110, B111, // 9 +}; +bool font_numbers3x3_check(const char c) { return c>='0' && c<='9'; } +uint16_t font_numbers3x3_get(const char c) { return c - '0'; } +Font font_numbers3x3 = {3, 3, &font_numbers3x3_data[0], font_numbers3x3_check, font_numbers3x3_get}; + const uint8_t font_numbers3x5_blocky_data[] PROGMEM = { B11111, B10001, B11111, // 0 B00000, B11111, B00000, // 1 @@ -150,12 +166,6 @@ const uint8_t font5x7_data[] PROGMEM = { 0x08, 0x08, 0x2A, 0x1C, 0x08, // -> 0x08, 0x1C, 0x2A, 0x08, 0x08, // <- }; - bool font5x7_check(const char c) { return c>=' ' && c<='}'; } - uint16_t font5x7_get(const char c) { return c - ' '; } - Font font5x7 = {5, 7, &font5x7_data[0], font5x7_check, font5x7_get}; - - -