// ============================================================ // Tiny 5x7 font: digits, letters and punctuation // ============================================================ struct Glyph { char character; uint8_t columns[5]; }; static const Glyph font[] = { {' ', {0x00,0x00,0x00,0x00,0x00}}, {'.', {0x00,0x60,0x60,0x00,0x00}}, {':', {0x00,0x36,0x36,0x00,0x00}}, {'-', {0x08,0x08,0x08,0x08,0x08}}, {'+', {0x08,0x08,0x3E,0x08,0x08}}, {'0', {0x3E,0x51,0x49,0x45,0x3E}}, {'1', {0x00,0x42,0x7F,0x40,0x00}}, {'2', {0x42,0x61,0x51,0x49,0x46}}, {'3', {0x21,0x41,0x45,0x4B,0x31}}, {'4', {0x18,0x14,0x12,0x7F,0x10}}, {'5', {0x27,0x45,0x45,0x45,0x39}}, {'6', {0x3C,0x4A,0x49,0x49,0x30}}, {'7', {0x01,0x71,0x09,0x05,0x03}}, {'8', {0x36,0x49,0x49,0x49,0x36}}, {'9', {0x06,0x49,0x49,0x29,0x1E}}, {'A', {0x7E,0x11,0x11,0x11,0x7E}}, {'C', {0x3E,0x41,0x41,0x41,0x22}}, {'E', {0x7F,0x49,0x49,0x49,0x41}}, {'H', {0x7F,0x08,0x08,0x08,0x7F}}, {'I', {0x00,0x41,0x7F,0x41,0x00}}, {'M', {0x7F,0x02,0x0C,0x02,0x7F}}, {'N', {0x7F,0x04,0x08,0x10,0x7F}}, {'O', {0x3E,0x41,0x41,0x41,0x3E}}, {'P', {0x7F,0x09,0x09,0x09,0x06}}, {'R', {0x7F,0x09,0x19,0x29,0x46}}, {'S', {0x46,0x49,0x49,0x49,0x31}}, {'T', {0x01,0x01,0x7F,0x01,0x01}}, {'U', {0x3F,0x40,0x40,0x40,0x3F}}, {'X', {0x63,0x14,0x08,0x14,0x63}}, {'Y', {0x07,0x08,0x70,0x08,0x07}} }; static const Glyph *find_glyph(char character) { for (const Glyph &glyph : font) { if (glyph.character == character) { return &glyph; } } return nullptr; }