diff --git a/lib/Font.cpp b/lib/Font.cpp index 7ebcbc6..b583ae3 100644 --- a/lib/Font.cpp +++ b/lib/Font.cpp @@ -28,93 +28,96 @@ #include "Charliplexing.h" #include -const uint8_t PROGMEM letters_71[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,1, 1,7, 2,1, 2,4, 2,7, 3,1, 3,2, 3,4, 3,5, 3,6, 3,7, 9,9 }; -const uint8_t PROGMEM letters_83[] = { 0,2, 0,3, 0,7, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,1, 3,5, 3,6, 9,9 }; -const uint8_t PROGMEM letters_67[] = { 0,2, 0,3, 0,4, 0,5, 0,6, 1,1, 1,7, 2,1, 2,7, 3,1, 3,7, 9,9 }; -const uint8_t PROGMEM letters_76[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,7, 2,7, 3,7, 9,9 }; -const uint8_t PROGMEM letters_89[] = { 0,1, 0,2, 1,3, 2,4, 2,5, 2,6, 2,7, 3,3, 4,1, 4,2, 9,9 }; -const uint8_t PROGMEM letters_82[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,1, 1,4, 2,1, 2,4, 2,5, 3,1, 3,4, 3,6, 4,2, 4,3, 4,7, 9,9 }; -const uint8_t PROGMEM letters_79[] = { 0,2, 0,3, 0,4, 0,5, 0,6, 1,1, 1,7, 2,1, 2,7, 3,2, 3,3, 3,4, 3,5, 3,6, 9,9 }; -const uint8_t PROGMEM letters_33[] = { 1,1, 1,2, 1,3, 1,4, 1,5, 1,7, 9,9 }; -const uint8_t PROGMEM letters_65[] = { 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,1, 1,4, 2,1, 2,4, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7, 9,9 }; -const uint8_t PROGMEM letters_87[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,6, 2,5, 3,6, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7, 9,9 }; -const uint8_t PROGMEM letters_69[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,1, 3,4, 3,7, 9,9 }; -const uint8_t PROGMEM letters_80[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,1, 1,4, 2,1, 2,4, 3,2, 3,3, 9,9 }; -const uint8_t PROGMEM letters_50[] = { 0,2, 0,5, 0,6, 0,7, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,1, 3,4, 3,7, 4,2, 4,3, 4,7, 9,9 }; -const uint8_t PROGMEM letters_49[] = { 1,2, 1,7, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7, 3,7, 9,9 }; -const uint8_t PROGMEM letters_74[] = { 0,7, 1,1, 1,7, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 3,1, 9,9 }; -const uint8_t PROGMEM letters_68[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,1, 1,7, 2,1, 2,7, 3,2, 3,3, 3,4, 3,5, 3,6, 9,9 }; -const uint8_t PROGMEM letters_90[] = { 0,1, 0,6, 0,7, 1,1, 1,5, 1,7, 2,1, 2,4, 2,7, 3,1, 3,3, 3,7, 4,1, 4,2, 4,7, 9,9 }; -const uint8_t PROGMEM letters_70[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,1, 1,4, 2,1, 2,4, 3,1, 3,4, 9,9 }; -const uint8_t PROGMEM letters_88[] = { 0,1, 0,2, 0,6, 0,7, 1,3, 1,5, 2,4, 3,3, 3,5, 4,1, 4,2, 4,6, 4,7, 9,9 }; -const uint8_t PROGMEM letters_75[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,4, 2,3, 2,5, 3,1, 3,2, 3,6, 3,7, 9,9 }; -const uint8_t PROGMEM letters_53[] = { 0,1, 0,2, 0,3, 0,4, 0,7, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,1, 3,4, 3,7, 4,1, 4,5, 4,6, 9,9 }; -const uint8_t PROGMEM letters_48[] = { 0,2, 0,3, 0,4, 0,5, 0,6, 1,1, 1,7, 2,1, 2,7, 3,1, 3,7, 4,2, 4,3, 4,4, 4,5, 4,6, 9,9 }; -const uint8_t PROGMEM letters_77[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,2, 2,3, 3,2, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7, 9,9 }; -const uint8_t PROGMEM letters_54[] = { 0,2, 0,3, 0,4, 0,5, 0,6, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,1, 3,4, 3,7, 4,2, 4,5, 4,6, 9,9 }; -const uint8_t PROGMEM letters_39[] = { 1,3, 2,1, 2,2, 9,9 }; -const uint8_t PROGMEM letters_85[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 1,7, 2,7, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 9,9 }; -const uint8_t PROGMEM letters_57[] = { 0,2, 0,3, 0,7, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,1, 3,4, 3,7, 4,2, 4,3, 4,4, 4,5, 4,6, 9,9 }; -const uint8_t PROGMEM letters_78[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,2, 2,3, 3,4, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7, 9,9 }; -const uint8_t PROGMEM letters_84[] = { 0,1, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, 2,1, 9,9 }; -const uint8_t PROGMEM letters_81[] = { 0,2, 0,3, 0,4, 0,5, 0,6, 1,1, 1,7, 2,1, 2,5, 2,7, 3,1, 3,6, 4,2, 4,3, 4,4, 4,5, 4,7, 9,9 }; -const uint8_t PROGMEM letters_51[] = { 0,2, 0,6, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,1, 3,4, 3,7, 4,2, 4,3, 4,5, 4,6, 9,9 }; -const uint8_t PROGMEM letters_86[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 1,6, 2,7, 3,6, 4,1, 4,2, 4,3, 4,4, 4,5, 9,9 }; -const uint8_t PROGMEM letters_72[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,4, 2,4, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7, 9,9 }; -const uint8_t PROGMEM letters_73[] = { 0,1, 0,7, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, 2,1, 2,7, 9,9 }; -const uint8_t PROGMEM letters_44[] = { 1,7, 2,5, 2,6, 9,9 }; -const uint8_t PROGMEM letters_56[] = { 0,2, 0,3, 0,5, 0,6, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,1, 3,4, 3,7, 4,2, 4,3, 4,5, 4,6, 9,9 }; -const uint8_t PROGMEM letters_66[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,2, 3,3, 3,5, 3,6, 9,9 }; -const uint8_t PROGMEM letters_52[] = { 0,4, 0,5, 1,3, 1,5, 2,2, 2,5, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7, 4,5, 9,9 }; -const uint8_t PROGMEM letters_55[] = { 0,1, 1,1, 2,1, 2,5, 2,6, 2,7, 3,1, 3,3, 3,4, 4,1, 4,2, 9,9 }; - -const uint8_t* const font[] = { letters_33 /*!*/, 0, 0, 0, 0, 0, letters_39 /*'*/, 0, 0, 0, 0, letters_44 /*,*/, 0, 0, 0, +#define C(c,r) ((c << 4) | r) + +PROGMEM const uint8_t letters_33[] = { C(1,1), C(1,2), C(1,3), C(1,4), C(1,5), C(1,7), 255 }; +PROGMEM const uint8_t letters_39[] = { C(1,3), C(2,1), C(2,2), 255 }; +PROGMEM const uint8_t letters_44[] = { C(1,7), C(2,5), C(2,6), 255 }; +PROGMEM const uint8_t letters_48[] = { C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(1,1), C(1,7), C(2,1), C(2,7), C(3,1), C(3,7), C(4,2), C(4,3), C(4,4), C(4,5), C(4,6), 255 }; +PROGMEM const uint8_t letters_49[] = { C(1,2), C(1,7), C(2,1), C(2,2), C(2,3), C(2,4), C(2,5), C(2,6), C(2,7), C(3,7), 255 }; +PROGMEM const uint8_t letters_50[] = { C(0,2), C(0,5), C(0,6), C(0,7), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,4), C(3,7), C(4,2), C(4,3), C(4,7), 255 }; +PROGMEM const uint8_t letters_51[] = { C(0,2), C(0,6), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,4), C(3,7), C(4,2), C(4,3), C(4,5), C(4,6), 255 }; +PROGMEM const uint8_t letters_52[] = { C(0,4), C(0,5), C(1,3), C(1,5), C(2,2), C(2,5), C(3,1), C(3,2), C(3,3), C(3,4), C(3,5), C(3,6), C(3,7), C(4,5), 255 }; +PROGMEM const uint8_t letters_53[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,7), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,4), C(3,7), C(4,1), C(4,5), C(4,6), 255 }; +PROGMEM const uint8_t letters_54[] = { C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,4), C(3,7), C(4,2), C(4,5), C(4,6), 255 }; +PROGMEM const uint8_t letters_55[] = { C(0,1), C(1,1), C(2,1), C(2,5), C(2,6), C(2,7), C(3,1), C(3,3), C(3,4), C(4,1), C(4,2), 255 }; +PROGMEM const uint8_t letters_56[] = { C(0,2), C(0,3), C(0,5), C(0,6), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,4), C(3,7), C(4,2), C(4,3), C(4,5), C(4,6), 255 }; +PROGMEM const uint8_t letters_57[] = { C(0,2), C(0,3), C(0,7), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,4), C(3,7), C(4,2), C(4,3), C(4,4), C(4,5), C(4,6), 255 }; +PROGMEM const uint8_t letters_65[] = { C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,1), C(1,4), C(2,1), C(2,4), C(3,2), C(3,3), C(3,4), C(3,5), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_66[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,2), C(3,3), C(3,5), C(3,6), 255 }; +PROGMEM const uint8_t letters_67[] = { C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(1,1), C(1,7), C(2,1), C(2,7), C(3,1), C(3,7), 255 }; +PROGMEM const uint8_t letters_68[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,1), C(1,7), C(2,1), C(2,7), C(3,2), C(3,3), C(3,4), C(3,5), C(3,6), 255 }; +PROGMEM const uint8_t letters_69[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,4), C(3,7), 255 }; +PROGMEM const uint8_t letters_70[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,1), C(1,4), C(2,1), C(2,4), C(3,1), C(3,4), 255 }; +PROGMEM const uint8_t letters_71[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,1), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,2), C(3,4), C(3,5), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_72[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,4), C(2,4), C(3,1), C(3,2), C(3,3), C(3,4), C(3,5), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_73[] = { C(0,1), C(0,7), C(1,1), C(1,2), C(1,3), C(1,4), C(1,5), C(1,6), C(1,7), C(2,1), C(2,7), 255 }; +PROGMEM const uint8_t letters_74[] = { C(0,7), C(1,1), C(1,7), C(2,1), C(2,2), C(2,3), C(2,4), C(2,5), C(2,6), C(3,1), 255 }; +PROGMEM const uint8_t letters_75[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,4), C(2,3), C(2,5), C(3,1), C(3,2), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_76[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,7), C(2,7), C(3,7), 255 }; +PROGMEM const uint8_t letters_77[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,2), C(2,3), C(3,2), C(4,1), C(4,2), C(4,3), C(4,4), C(4,5), C(4,6), C(4,7), 255 }; +PROGMEM const uint8_t letters_78[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,2), C(2,3), C(3,4), C(4,1), C(4,2), C(4,3), C(4,4), C(4,5), C(4,6), C(4,7), 255 }; +PROGMEM const uint8_t letters_79[] = { C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(1,1), C(1,7), C(2,1), C(2,7), C(3,2), C(3,3), C(3,4), C(3,5), C(3,6), 255 }; +PROGMEM const uint8_t letters_80[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,1), C(1,4), C(2,1), C(2,4), C(3,2), C(3,3), 255 }; +PROGMEM const uint8_t letters_81[] = { C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(1,1), C(1,7), C(2,1), C(2,5), C(2,7), C(3,1), C(3,6), C(4,2), C(4,3), C(4,4), C(4,5), C(4,7), 255 }; +PROGMEM const uint8_t letters_82[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,1), C(1,4), C(2,1), C(2,4), C(2,5), C(3,1), C(3,4), C(3,6), C(4,2), C(4,3), C(4,7), 255 }; +PROGMEM const uint8_t letters_83[] = { C(0,2), C(0,3), C(0,7), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,5), C(3,6), 255 }; +PROGMEM const uint8_t letters_84[] = { C(0,1), C(1,1), C(1,2), C(1,3), C(1,4), C(1,5), C(1,6), C(1,7), C(2,1), 255 }; +PROGMEM const uint8_t letters_85[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(1,7), C(2,7), C(3,1), C(3,2), C(3,3), C(3,4), C(3,5), C(3,6), 255 }; +PROGMEM const uint8_t letters_86[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(1,6), C(2,7), C(3,6), C(4,1), C(4,2), C(4,3), C(4,4), C(4,5), 255 }; +PROGMEM const uint8_t letters_87[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,6), C(2,5), C(3,6), C(4,1), C(4,2), C(4,3), C(4,4), C(4,5), C(4,6), C(4,7), 255 }; +PROGMEM const uint8_t letters_88[] = { C(0,1), C(0,2), C(0,6), C(0,7), C(1,3), C(1,5), C(2,4), C(3,3), C(3,5), C(4,1), C(4,2), C(4,6), C(4,7), 255 }; +PROGMEM const uint8_t letters_89[] = { C(0,1), C(0,2), C(1,3), C(2,4), C(2,5), C(2,6), C(2,7), C(3,3), C(4,1), C(4,2), 255 }; +PROGMEM const uint8_t letters_90[] = { C(0,1), C(0,6), C(0,7), C(1,1), C(1,5), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,3), C(3,7), C(4,1), C(4,2), C(4,7), 255 }; + +#ifdef LOWERCASE +// This section of the font works now, but doesn't appear to be correct. +PROGMEM const uint8_t letters_97[] = { C(0,6), C(0,7), C(1,3), C(1,5), C(1,7), C(2,3), C(2,5), C(2,7), C(3,4), C(3,5), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_98[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,4), C(1,7), C(2,4), C(2,7), C(3,5), C(3,6), 255 }; +PROGMEM const uint8_t letters_99[] = { C(0,5), C(0,6), C(1,4), C(1,7), C(2,4), C(2,7), 255 }; +PROGMEM const uint8_t letters_100[] = { C(0,5), C(0,6), C(1,4), C(1,7), C(2,4), C(2,7), C(3,1), C(3,2), C(3,3), C(3,4), C(3,5), C(3,6), C(3,7), 255 }; +//PROGMEM const uint8_t letters_100[] = { C(0,2), C(0,3), C(1,1), C(1,4), C(1,7), C(2,1), C(2,4), C(2,7), C(3,1), C(3,2), C(3,3), C(3,4), C(3,5), C(3,6), 255 }; +PROGMEM const uint8_t letters_101[] = { C(0,4), C(0,5), C(0,6), C(1,3), C(1,5), C(1,7), C(2,3), C(2,5), C(2,7), C(3,4), C(3,5), C(3,7), 255 }; +PROGMEM const uint8_t letters_102[] = { C(0,4), C(1,1), C(1,2), C(1,3), C(1,4), C(1,5), C(1,6), C(1,7), C(2,1), C(2,4), C(3,1), 255 }; +PROGMEM const uint8_t letters_103[] = { C(0,4), C(0,5), C(0,8), C(1,3), C(1,6), C(1,8), C(2,3), C(2,6), C(2,8), C(3,3), C(3,4), C(3,5), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_104[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,4), C(2,4), C(3,5), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_105[] = { C(0,2), C(0,4), C(0,5), C(0,6), C(0,7), 255 }; +PROGMEM const uint8_t letters_106[] = { C(0,8), C(1,2), C(1,4), C(1,5), C(1,6), C(1,7), C(1,8), 255 }; +PROGMEM const uint8_t letters_107[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), C(1,5), C(2,4), C(2,6), C(3,3), C(3,7), 255 }; +PROGMEM const uint8_t letters_108[] = { C(0,1), C(0,2), C(0,3), C(0,4), C(0,5), C(0,6), C(0,7), 255 }; +PROGMEM const uint8_t letters_109[] = { C(0,4), C(0,5), C(0,6), C(0,7), C(1,4), C(2,5), C(2,6), C(2,7), C(3,4), C(4,5), C(4,6), C(4,7), 255 }; +PROGMEM const uint8_t letters_110[] = { C(0,4), C(0,5), C(0,6), C(0,7), C(1,4), C(2,4), C(3,5), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_111[] = { C(0,5), C(0,6), C(1,4), C(1,7), C(2,4), C(2,7), C(3,5), C(3,6), 255 }; +PROGMEM const uint8_t letters_112[] = { C(0,4), C(0,5), C(0,6), C(0,7), C(0,8), C(1,4), C(1,7), C(2,4), C(2,7), C(3,5), C(3,6), 255 }; +PROGMEM const uint8_t letters_113[] = { C(0,5), C(0,6), C(1,4), C(1,7), C(2,4), C(2,7), C(3,4), C(3,5), C(3,6), C(3,7), C(3,8), 255 }; +PROGMEM const uint8_t letters_114[] = { C(0,4), C(0,5), C(0,6), C(0,7), C(1,4), C(2,4), 255 }; +PROGMEM const uint8_t letters_115[] = { C(0,3), C(0,4), C(0,7), C(1,3), C(1,5), C(1,7), C(2,3), C(2,5), C(2,7), C(3,3), C(3,5), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_116[] = { C(0,4), C(1,3), C(1,4), C(1,5), C(1,6), C(1,7), C(2,4), C(2,7), C(3,7), 255 }; +PROGMEM const uint8_t letters_117[] = { C(0,4), C(0,5), C(0,6), C(1,7), C(2,7), C(3,4), C(3,5), C(3,6), C(3,7), 255 }; +PROGMEM const uint8_t letters_118[] = { C(0,4), C(0,5), C(0,6), C(1,7), C(2,4), C(2,5), C(2,6), 255 }; +PROGMEM const uint8_t letters_119[] = { C(0,4), C(0,5), C(0,6), C(1,7), C(2,4), C(2,5), C(2,6), C(3,7), C(4,4), C(4,5), C(4,6), 255 }; +PROGMEM const uint8_t letters_120[] = { C(0,4), C(0,7), C(1,5), C(1,6), C(2,4), C(2,7), 255 }; +#endif + +const unsigned char fontMin=33; +#ifdef LOWERCASE +const unsigned char fontMax=120; +#else +const unsigned char fontMax=90; +#endif + +PROGMEM const uint8_t* const font[] = { letters_33 /*!*/, 0, 0, 0, 0, 0, letters_39 /*'*/, 0, 0, 0, 0, letters_44 /*,*/, 0, 0, 0, letters_48 /*0*/, letters_49 /*1*/, letters_50 /*2*/, letters_51 /*3*/, letters_52 /*4*/, letters_53 /*5*/, letters_54 /*6*/, letters_55 /*7*/, letters_56 /*8*/, letters_57 /*9*/, 0, 0, 0, 0, 0, 0, 0, letters_65 /*A*/, letters_66 /*B*/, letters_67 /*C*/, letters_68 /*D*/, letters_69 /*E*/, letters_70 /*F*/, letters_71 /*G*/, letters_72 /*H*/, letters_73 /*I*/, letters_74 /*J*/, letters_75 /*K*/, letters_76 /*L*/, letters_77 /*M*/, letters_78 /*N*/, letters_79 /*O*/, letters_80 /*P*/, letters_81 /*Q*/, letters_82 /*R*/, letters_83 /*S*/, letters_84 /*T*/, letters_85 /*U*/, letters_86 /*V*/, letters_87 /*W*/, letters_88 /*X*/, letters_89 /*Y*/, -letters_90 /*Z*/ -}; - - -const unsigned char fontMin=33; -const unsigned char fontMax=90; - -#if 0 - -// This section of the font works now, but doesn't appear to be correct. - -const uint8_t PROGMEM letters_117[] = { 0,4, 0,5, 0,6, 1,7, 2,7, 3,4, 3,5, 3,6, 3,7, 9,9 }; -const uint8_t PROGMEM letters_104[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,4, 2,4, 3,5, 3,6, 3,7, 9,9 }; -const uint8_t PROGMEM letters_109[] = { 0,4, 0,5, 0,6, 0,7, 1,4, 2,5, 2,6, 2,7, 3,4, 4,5, 4,6, 4,7, 9,9 }; -const uint8_t PROGMEM letters_114[] = { 0,4, 0,5, 0,6, 0,7, 1,4, 2,4, 9,9 }; -const uint8_t PROGMEM letters_108[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 9,9 }; -const uint8_t PROGMEM letters_116[] = { 0,2, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, 2,2, 2,7, 3,7, 9,9 }; -const uint8_t PROGMEM letters_107[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,5, 2,4, 2,6, 3,3, 3,7, 9,9 }; -const uint8_t PROGMEM letters_118[] = { 0,4, 0,5, 1,6, 2,7, 3,6, 4,4, 4,5, 9,9 }; -const uint8_t PROGMEM letters_98[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,4, 1,7, 2,4, 2,7, 3,5, 3,6, 9,9 }; -const uint8_t PROGMEM letters_120[] = { 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 1,5, 2,4, 2,6, 3,3, 3,7, 9,9 }; -const uint8_t PROGMEM letters_119[] = { 0,4, 0,5, 1,6, 1,7, 2,4, 2,5, 3,6, 3,7, 4,4, 4,5, 9,9 }; -const uint8_t PROGMEM letters_111[] = { 0,5, 0,6, 1,4, 1,7, 2,4, 2,7, 3,5, 3,6, 9,9 }; -const uint8_t PROGMEM letters_105[] = { 0,1, 0,3, 0,4, 0,5, 0,6, 0,7, 9,9 }; -const uint8_t PROGMEM letters_110[] = { 0,4, 0,5, 0,6, 0,7, 1,4, 2,4, 3,5, 3,6, 3,7, 9,9 }; -const uint8_t PROGMEM letters_113[] = { 0,4, 0,5, 1,3, 1,6, 2,3, 2,6, 3,3, 3,4, 3,5, 3,6, 3,7, 3,8, 9,9 }; -const uint8_t PROGMEM letters_100[] = { 0,2, 0,3, 1,1, 1,4, 1,7, 2,1, 2,4, 2,7, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 9,9 }; -const uint8_t PROGMEM letters_103[] = { 0,3, 0,4, 0,8, 1,2, 1,5, 1,8, 2,2, 2,5, 2,8, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7, 9,9 }; -const uint8_t PROGMEM letters_112[] = { 0,3, 0,4, 0,5, 0,6, 0,7, 0,8, 1,3, 1,6, 2,3, 2,6, 3,4, 3,5, 9,9 }; -const uint8_t PROGMEM letters_101[] = { 0,4, 0,5, 0,6, 1,3, 1,5, 1,7, 2,3, 2,5, 2,7, 3,4, 3,5, 3,7, 9,9 }; -const uint8_t PROGMEM letters_102[] = { 0,5, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, 2,1, 2,5, 3,1, 9,9 }; -const uint8_t PROGMEM letters_115[] = { 0,3, 0,4, 0,7, 1,3, 1,5, 1,7, 2,3, 2,5, 2,7, 3,3, 3,5, 3,6, 3,7, 9,9 }; -const uint8_t PROGMEM letters_99[] = { 0,5, 0,6, 1,4, 1,7, 2,4, 2,7, 3,4, 3,7, 9,9 }; -const uint8_t PROGMEM letters_106[] = { 0,8, 1,2, 1,4, 1,5, 1,6, 1,7, 1,8, 9,9 }; -const uint8_t PROGMEM letters_97[] = { 0,6, 0,7, 1,3, 1,5, 1,7, 2,3, 2,5, 2,7, 3,4, 3,5, 3,6, 3,7, 9,9 }; - -const uint8_t* const font2[] = { 0, 0, 0, 0, 0, 0, letters_97 /*a*/, letters_98 /*b*/, letters_99 /*c*/, letters_100 /*d*/, letters_101 /*e*/, letters_102 /*f*/, letters_103 /*g*/, letters_104 /*h*/, letters_105 /*i*/, letters_106 /*j*/, letters_107 /*k*/, letters_108 /*l*/, letters_109 /*m*/, letters_110 /*n*/, letters_111 /*o*/, letters_112 /*p*/, letters_113 /*q*/, letters_114 /*r*/, letters_115 /*s*/, letters_116 /*t*/, letters_117 /*u*/, letters_118 /*v*/, letters_119 /*w*/, letters_120 /*x*/ }; -*/ - +letters_90 /*Z*/, +#ifdef LOWERCASE +0, 0, 0, 0, 0, 0, letters_97 /*a*/, letters_98 /*b*/, letters_99 /*c*/, letters_100 /*d*/, letters_101 /*e*/, letters_102 /*f*/, letters_103 /*g*/, letters_104 /*h*/, letters_105 /*i*/, letters_106 /*j*/, letters_107 /*k*/, letters_108 /*l*/, letters_109 /*m*/, letters_110 /*n*/, letters_111 /*o*/, letters_112 /*p*/, letters_113 /*q*/, letters_114 /*r*/, letters_115 /*s*/, letters_116 /*t*/, letters_117 /*u*/, letters_118 /*v*/, letters_119 /*w*/, letters_120 /*x*/, #endif +}; /* ----------------------------------------------------------------- */ /** Draws a figure (0-9). You should call it with c=1, @@ -124,10 +127,7 @@ const uint8_t* const font2[] = { 0, 0, 0, 0, 0, 0, letters_97 /*a*/, lett * @param c is 1 or 0 to draw or clear it */ uint8_t Font::Draw(unsigned char letter, int x, int y, uint8_t c) { - uint8_t maxx=0; - - uint8_t charCol; - uint8_t charRow; + uint8_t maxx=0, data; const uint8_t* character; if (letter==' ') return 3+2; @@ -135,16 +135,11 @@ uint8_t Font::Draw(unsigned char letter, int x, int y, uint8_t c) { return 0; } -// if (letter>90) { -// character = font2[letter-90]; -// } else { - character = font[letter-fontMin]; -// } - - charCol = pgm_read_byte_near(character++); - charRow = pgm_read_byte_near(character++); + character = (const uint8_t *)pgm_read_word_near(&font[letter-fontMin]); + data = pgm_read_byte_near(character++); - while (charRow!=9) { + while (data != 255) { + uint8_t charCol = data >> 4, charRow = data & 15; if (charCol>maxx) maxx=charCol; if ( charCol + x 90) { -// character = font2[letter-90]; -// } else { - character = font[letter-fontMin]; -// } - - charCol = pgm_read_byte_near(character++); - charRow = pgm_read_byte_near(character++); + character = (const uint8_t *)pgm_read_word_near(&font[letter-fontMin]); + data = pgm_read_byte_near(character++); - while (charRow!=9) { + while (data != 255) { + uint8_t charCol = data >> 4, charRow = data & 15; if (charCol>maxx) maxx=charCol; if ( - charRow + x =0 && + 7 - charRow + x =0 && charCol + y =0 ) { LedSign::Set(7 - charRow + x, charCol + y, c); } - charCol = pgm_read_byte_near(character++); - charRow = pgm_read_byte_near(character++); + data = pgm_read_byte_near(character++); } return maxx+2; } - - - - - diff --git a/lib/Font.h b/lib/Font.h index 7c14779..d5a0ba8 100644 --- a/lib/Font.h +++ b/lib/Font.h @@ -27,6 +27,8 @@ #include +#undef LOWERCASE + namespace Font { extern uint8_t Draw(unsigned char letter, int x, int y, uint8_t c=1);