/* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ /** library to show BusVoodoo mode information on SSD1306 OLED display: name, activity, pinout (code) * @file busvoodoo_oled.c * @author King Kévin * @date 2018 * @note peripherals used: I2C @ref oled_ssd1306_i2c */ /* standard libraries */ #include // standard integer types #include // boolean type #include // string utilities /* own libraries */ #include "global.h" // global utilities #include "busvoodoo_oled.h" // own definitions #include "oled_ssd1306.h" // OLED display utilities /** if the OLED display is present and setup */ static bool busvoodoo_oled_present = false; /** display pixel buffer */ static uint8_t busvoodoo_oled_display[128*8] = {0}; /** 8x5 px monospace bitmap font (starting with space, first byte is glyph left column, MSb is glyph top pixel) */ static const uint8_t font_king8[95][5] = { {0x00, 0x00, 0x00, 0x00, 0x00, }, // ' ' {0x00, 0x00, 0x5f, 0x00, 0x00, }, // '!' {0x00, 0x03, 0x00, 0x03, 0x00, }, // '"' {0x14, 0x3e, 0x14, 0x3e, 0x14, }, // '#' {0x24, 0x2a, 0x7f, 0x2a, 0x12, }, // '$' {0x63, 0x13, 0x08, 0x64, 0x63, }, // '%' {0x36, 0x49, 0x56, 0x20, 0x50, }, // '&' {0x00, 0x03, 0x00, 0x00, 0x00, }, // ''' {0x00, 0x3c, 0x42, 0x81, 0x00, }, // '(' {0x00, 0x81, 0x42, 0x3c, 0x00, }, // ')' {0x2a, 0x1c, 0x3e, 0x1c, 0x2a, }, // '*' {0x08, 0x08, 0x3e, 0x08, 0x08, }, // '+' {0x00, 0x40, 0x30, 0x00, 0x00, }, // ',' {0x00, 0x08, 0x08, 0x08, 0x00, }, // '-' {0x00, 0x00, 0x30, 0x00, 0x00, }, // '.' {0x60, 0x10, 0x08, 0x04, 0x03, }, // '/' {0x3e, 0x51, 0x49, 0x45, 0x3e, }, // '0' {0x00, 0x42, 0x7f, 0x40, 0x00, }, // '1' {0x00, 0x61, 0x51, 0x49, 0x46, }, // '2' {0x00, 0x41, 0x49, 0x49, 0x36, }, // '3' {0x18, 0x14, 0x12, 0x7f, 0x10, }, // '4' {0x27, 0x45, 0x45, 0x45, 0x39, }, // '5' {0x3e, 0x49, 0x49, 0x49, 0x30, }, // '6' {0x01, 0x71, 0x09, 0x05, 0x03, }, // '7' {0x36, 0x49, 0x49, 0x49, 0x36, }, // '8' {0x06, 0x49, 0x49, 0x49, 0x3e, }, // '9' {0x00, 0x00, 0x36, 0x00, 0x00, }, // ':' {0x00, 0x40, 0x36, 0x00, 0x00, }, // ';' {0x00, 0x08, 0x14, 0x22, 0x00, }, // '<' {0x00, 0x14, 0x14, 0x14, 0x00, }, // '=' {0x00, 0x22, 0x14, 0x08, 0x00, }, // '>' {0x02, 0x01, 0x59, 0x05, 0x02, }, // '?' {0x3e, 0x41, 0x5d, 0x55, 0x5e, }, // '@' {0x7e, 0x09, 0x09, 0x09, 0x7e, }, // 'A' {0x7f, 0x49, 0x49, 0x49, 0x36, }, // 'B' {0x3e, 0x41, 0x41, 0x41, 0x41, }, // 'C' {0x7f, 0x41, 0x41, 0x41, 0x3e, }, // 'D' {0x7f, 0x49, 0x49, 0x49, 0x41, }, // 'E' {0x7f, 0x09, 0x09, 0x09, 0x01, }, // 'F' {0x3e, 0x41, 0x41, 0x49, 0x39, }, // 'G' {0x7f, 0x08, 0x08, 0x08, 0x7f, }, // 'H' {0x00, 0x41, 0x7f, 0x41, 0x00, }, // 'I' {0x00, 0x41, 0x41, 0x3f, 0x00, }, // 'J' {0x7f, 0x08, 0x14, 0x22, 0x41, }, // 'K' {0x7f, 0x40, 0x40, 0x40, 0x40, }, // 'L' {0x7f, 0x02, 0x04, 0x02, 0x7f, }, // 'M' {0x7f, 0x04, 0x08, 0x10, 0x7f, }, // 'N' {0x3e, 0x41, 0x41, 0x41, 0x3e, }, // 'O' {0x7f, 0x09, 0x09, 0x09, 0x06, }, // 'P' {0x3e, 0x41, 0x51, 0x21, 0x5e, }, // 'Q' {0x7f, 0x09, 0x19, 0x29, 0x46, }, // 'R' {0x46, 0x49, 0x49, 0x49, 0x31, }, // 'S' {0x01, 0x01, 0x7f, 0x01, 0x01, }, // 'T' {0x3f, 0x40, 0x40, 0x40, 0x3f, }, // 'U' {0x07, 0x18, 0x60, 0x18, 0x07, }, // 'V' {0x1f, 0x60, 0x18, 0x60, 0x1f, }, // 'W' {0x63, 0x14, 0x08, 0x14, 0x63, }, // 'X' {0x03, 0x04, 0x78, 0x04, 0x03, }, // 'Y' {0x61, 0x51, 0x49, 0x45, 0x43, }, // 'Z' {0x00, 0x7f, 0x41, 0x41, 0x00, }, // '[' {0x03, 0x04, 0x08, 0x10, 0x60, }, // '\' {0x00, 0x41, 0x41, 0x7f, 0x00, }, // ']' {0x00, 0x04, 0x02, 0x04, 0x00, }, // '^' {0x40, 0x40, 0x40, 0x40, 0x40, }, // '_' {0x00, 0x02, 0x04, 0x00, 0x00, }, // '`' {0x20, 0x54, 0x54, 0x78, 0x00, }, // 'a' {0x7e, 0x48, 0x48, 0x30, 0x00, }, // 'b' {0x38, 0x44, 0x44, 0x44, 0x00, }, // 'c' {0x30, 0x48, 0x48, 0x7e, 0x00, }, // 'd' {0x38, 0x54, 0x54, 0x18, 0x00, }, // 'e' {0x08, 0x7c, 0x0a, 0x02, 0x00, }, // 'f' {0x18, 0xa4, 0xa4, 0x78, 0x00, }, // 'g' {0x7e, 0x08, 0x08, 0x70, 0x00, }, // 'h' {0x00, 0x08, 0x7a, 0x00, 0x00, }, // 'i' {0x80, 0x80, 0x7a, 0x00, 0x00, }, // 'j' {0x7e, 0x10, 0x28, 0x44, 0x00, }, // 'k' {0x00, 0x02, 0x3e, 0x40, 0x00, }, // 'l' {0x7c, 0x04, 0x78, 0x04, 0x78, }, // 'm' {0x00, 0x7c, 0x04, 0x78, 0x00, }, // 'n' {0x38, 0x44, 0x44, 0x38, 0x00, }, // 'o' {0xfc, 0x24, 0x24, 0x18, 0x00, }, // 'p' {0x18, 0x24, 0x24, 0xfc, 0x00, }, // 'q' {0x7c, 0x08, 0x04, 0x08, 0x00, }, // 'r' {0x48, 0x54, 0x54, 0x24, 0x00, }, // 's' {0x3e, 0x48, 0x48, 0x40, 0x00, }, // 't' {0x3c, 0x40, 0x40, 0x7c, 0x00, }, // 'u' {0x1c, 0x20, 0x40, 0x20, 0x1c, }, // 'v' {0x3c, 0x40, 0x30, 0x40, 0x3c, }, // 'w' {0x6c, 0x10, 0x10, 0x6c, 0x00, }, // 'x' {0x0c, 0x90, 0x90, 0x7c, 0x00, }, // 'y' {0x64, 0x54, 0x54, 0x4c, 0x00, }, // 'z' {0x08, 0x36, 0x41, 0x00, 0x00, }, // '{' {0x00, 0x00, 0x7f, 0x00, 0x00, }, // '|' {0x00, 0x41, 0x36, 0x08, 0x00, }, // '}' {0x04, 0x02, 0x06, 0x04, 0x02, }, // '~' }; /** 10x6 px monospace bitmap font (starting with space, first element is glyph left column, MSb is glyph top pixel) */ static const uint16_t font_king10[97][6] = { {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }, // ' ' {0x0000, 0x0000, 0x01be, 0x0000, 0x0000, 0x0000, }, // '!' {0x0000, 0x0006, 0x0000, 0x0006, 0x0000, 0x0000, }, // '"' {0x0050, 0x01fc, 0x0050, 0x01fc, 0x0050, 0x0000, }, // '#' {0x008c, 0x0092, 0x01ff, 0x0092, 0x0062, 0x0000, }, // '$' {0x018c, 0x004c, 0x0020, 0x0010, 0x00c8, 0x00c6, }, // '%' {0x00ec, 0x0112, 0x0112, 0x012c, 0x00c0, 0x0120, }, // '&' {0x0000, 0x0000, 0x0006, 0x0000, 0x0000, 0x0000, }, // ''' {0x0000, 0x0078, 0x0186, 0x0201, 0x0000, 0x0000, }, // '(' {0x0000, 0x0201, 0x0186, 0x0078, 0x0000, 0x0000, }, // ')' {0x0024, 0x0018, 0x003c, 0x0018, 0x0024, 0x0000, }, // '*' {0x0010, 0x0010, 0x007c, 0x0010, 0x0010, 0x0000, }, // '+' {0x0000, 0x0000, 0x0200, 0x0180, 0x0000, 0x0000, }, // ',' {0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, }, // '-' {0x0000, 0x0000, 0x0000, 0x0180, 0x0000, 0x0000, }, // '.' {0x0300, 0x00c0, 0x0030, 0x000c, 0x0003, 0x0000, }, // '/' {0x00fe, 0x0121, 0x0111, 0x0109, 0x0105, 0x00fe, }, // '0' {0x0000, 0x0008, 0x0004, 0x0002, 0x01ff, 0x0000, }, // '1' {0x0181, 0x0141, 0x0121, 0x0111, 0x0109, 0x0106, }, // '2' {0x0101, 0x0101, 0x0111, 0x0111, 0x0111, 0x00ee, }, // '3' {0x0030, 0x0028, 0x0024, 0x0022, 0x01ff, 0x0020, }, // '4' {0x008f, 0x0109, 0x0109, 0x0109, 0x0109, 0x00f1, }, // '5' {0x00fe, 0x0111, 0x0111, 0x0111, 0x0111, 0x00e0, }, // '6' {0x0001, 0x0001, 0x01f1, 0x0009, 0x0005, 0x0003, }, // '7' {0x00ee, 0x0111, 0x0111, 0x0111, 0x0111, 0x00ee, }, // '8' {0x000e, 0x0111, 0x0111, 0x0111, 0x0111, 0x00fe, }, // '9' {0x0000, 0x0000, 0x00cc, 0x0000, 0x0000, 0x0000, }, // ':' {0x0000, 0x0100, 0x00cc, 0x0000, 0x0000, 0x0000, }, // ';' {0x0000, 0x0010, 0x0028, 0x0044, 0x0082, 0x0000, }, // '<' {0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0000, }, // '=' {0x0000, 0x0082, 0x0044, 0x0028, 0x0010, 0x0000, }, // '>' {0x0002, 0x0001, 0x0161, 0x0011, 0x0009, 0x0006, }, // '?' {0x0078, 0x0084, 0x0132, 0x014a, 0x014a, 0x017c, }, // '@' {0x01fe, 0x0011, 0x0011, 0x0011, 0x0011, 0x01fe, }, // 'A' {0x01ff, 0x0111, 0x0111, 0x0111, 0x0111, 0x00ee, }, // 'B' {0x00fe, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, }, // 'C' {0x01ff, 0x0101, 0x0101, 0x0101, 0x0101, 0x00fe, }, // 'D' {0x01ff, 0x0111, 0x0111, 0x0111, 0x0111, 0x0101, }, // 'E' {0x01ff, 0x0011, 0x0011, 0x0011, 0x0011, 0x0001, }, // 'F' {0x00fe, 0x0101, 0x0101, 0x0101, 0x0111, 0x00f1, }, // 'G' {0x01ff, 0x0010, 0x0010, 0x0010, 0x0010, 0x01ff, }, // 'H' {0x0101, 0x0101, 0x01ff, 0x0101, 0x0101, 0x0000, }, // 'I' {0x0101, 0x0101, 0x0101, 0x0081, 0x007f, 0x0000, }, // 'J' {0x01ff, 0x0010, 0x0028, 0x0044, 0x0082, 0x0101, }, // 'K' {0x01ff, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, }, // 'L' {0x01ff, 0x0002, 0x0004, 0x0004, 0x0002, 0x01ff, }, // 'M' {0x01ff, 0x0004, 0x0008, 0x0010, 0x0020, 0x01ff, }, // 'N' {0x00fe, 0x0101, 0x0101, 0x0101, 0x0101, 0x00fe, }, // 'O' {0x01ff, 0x0011, 0x0011, 0x0011, 0x0011, 0x000e, }, // 'P' {0x00fe, 0x0101, 0x0101, 0x0141, 0x0081, 0x017e, }, // 'Q' {0x01ff, 0x0011, 0x0031, 0x0051, 0x0091, 0x010e, }, // 'R' {0x010e, 0x0111, 0x0111, 0x0111, 0x0111, 0x00e1, }, // 'S' {0x0001, 0x0001, 0x01ff, 0x0001, 0x0001, 0x0000, }, // 'T' {0x00ff, 0x0100, 0x0100, 0x0100, 0x0100, 0x00ff, }, // 'U' {0x001f, 0x0060, 0x0180, 0x0180, 0x0060, 0x001f, }, // 'V' {0x00ff, 0x0100, 0x00c0, 0x00c0, 0x0100, 0x00ff, }, // 'W' {0x01c7, 0x0028, 0x0010, 0x0010, 0x0028, 0x01c7, }, // 'X' {0x0007, 0x0008, 0x01f0, 0x0008, 0x0007, 0x0000, }, // 'Y' {0x01c1, 0x0121, 0x0111, 0x0109, 0x0105, 0x0103, }, // 'Z' {0x0000, 0x01ff, 0x0101, 0x0101, 0x0101, 0x0000, }, // '[' {0x0000, 0x0003, 0x000c, 0x0030, 0x00c0, 0x0300, }, // '\' {0x0000, 0x0101, 0x0101, 0x0101, 0x01ff, 0x0000, }, // ']' {0x0008, 0x0004, 0x0002, 0x0004, 0x0008, 0x0000, }, // '^' {0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, }, // '_' {0x0000, 0x0002, 0x0004, 0x0008, 0x0000, 0x0000, }, // '`' {0x0080, 0x0150, 0x0150, 0x0150, 0x01e0, 0x0000, }, // 'a' {0x01fe, 0x0110, 0x0110, 0x0110, 0x00e0, 0x0000, }, // 'b' {0x00e0, 0x0110, 0x0110, 0x0110, 0x0110, 0x0000, }, // 'c' {0x00e0, 0x0110, 0x0110, 0x0110, 0x01fe, 0x0000, }, // 'd' {0x00e0, 0x0150, 0x0150, 0x0150, 0x0060, 0x0000, }, // 'e' {0x0010, 0x01fc, 0x0012, 0x0012, 0x0002, 0x0000, }, // 'f' {0x0060, 0x0290, 0x0290, 0x0290, 0x01e0, 0x0000, }, // 'g' {0x01fe, 0x0010, 0x0010, 0x0010, 0x01e0, 0x0000, }, // 'h' {0x0000, 0x0010, 0x01f4, 0x0000, 0x0000, 0x0000, }, // 'i' {0x0000, 0x0200, 0x0210, 0x01f4, 0x0000, 0x0000, }, // 'j' {0x01fe, 0x0020, 0x0050, 0x0188, 0x0000, 0x0000, }, // 'k' {0x0000, 0x0002, 0x00fe, 0x0100, 0x0000, 0x0000, }, // 'l' {0x01f0, 0x0010, 0x01e0, 0x0010, 0x01e0, 0x0000, }, // 'm' {0x0000, 0x01f0, 0x0010, 0x0010, 0x01e0, 0x0000, }, // 'n' {0x00e0, 0x0110, 0x0110, 0x0110, 0x00e0, 0x0000, }, // 'o' {0x03f0, 0x0090, 0x0090, 0x0090, 0x0060, 0x0000, }, // 'p' {0x0060, 0x0090, 0x0090, 0x0090, 0x03f0, 0x0000, }, // 'q' {0x01f0, 0x0020, 0x0010, 0x0010, 0x0020, 0x0000, }, // 'r' {0x0120, 0x0150, 0x0150, 0x0150, 0x0090, 0x0000, }, // 's' {0x0000, 0x00fe, 0x0108, 0x0108, 0x0100, 0x0000, }, // 't' {0x00f0, 0x0100, 0x0100, 0x0100, 0x01f0, 0x0000, }, // 'u' {0x0030, 0x00c0, 0x0100, 0x00c0, 0x0030, 0x0000, }, // 'v' {0x00f0, 0x0100, 0x00e0, 0x0100, 0x00f0, 0x0000, }, // 'w' {0x0110, 0x00a0, 0x0040, 0x00a0, 0x0110, 0x0000, }, // 'x' {0x0070, 0x0280, 0x0280, 0x0280, 0x01f0, 0x0000, }, // 'y' {0x0110, 0x0190, 0x0150, 0x0130, 0x0110, 0x0000, }, // 'z' {0x0000, 0x0010, 0x00ee, 0x0101, 0x0000, 0x0000, }, // '{' {0x0000, 0x0000, 0x01ff, 0x0000, 0x0000, 0x0000, }, // '|' {0x0000, 0x0101, 0x00ee, 0x0010, 0x0000, 0x0000, }, // '}' {0x0010, 0x0008, 0x0008, 0x0010, 0x0010, 0x0008, }, // '~' }; /** 14*9 px monospace bitmap font (starting with space, first element is glyph left column, MSb is glyph top pixel) */ static const uint16_t font_king14[95][9] = { {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }, // ' ' {0x0000, 0x0000, 0x0000, 0x19fe, 0x19fe, 0x0000, 0x0000, 0x0000, 0x0000, }, // '!' {0x0000, 0x001c, 0x001c, 0x0000, 0x0000, 0x001c, 0x001c, 0x0000, 0x0000, }, // '"' {0x0330, 0x0ffc, 0x0ffc, 0x0330, 0x0330, 0x0ffc, 0x0ffc, 0x0330, 0x0000, }, // '#' {0x0638, 0x0e7c, 0x1cee, 0x18c6, 0x3fff, 0x18c6, 0x1dce, 0x0f9c, 0x0718, }, // '$' {0x1e08, 0x1f1c, 0x03b6, 0x01dc, 0x02e8, 0x0770, 0x0db8, 0x071f, 0x020f, }, // '%' {0x079c, 0x1ffe, 0x1863, 0x1863, 0x1cfe, 0x0f9c, 0x0700, 0x0d80, 0x18c0, }, // '&' {0x0000, 0x0000, 0x0000, 0x001c, 0x001c, 0x0000, 0x0000, 0x0000, 0x0000, }, // ''' {0x0000, 0x0000, 0x07f8, 0x0ffc, 0x1c0e, 0x3807, 0x3003, 0x0000, 0x0000, }, // '(' {0x0000, 0x0000, 0x3003, 0x3807, 0x1c0e, 0x0ffc, 0x03f0, 0x0000, 0x0000, }, // ')' {0x0ccc, 0x06d8, 0x03f0, 0x0ffc, 0x0ffc, 0x03f0, 0x06d8, 0x0ccc, 0x0000, }, // '*' {0x0000, 0x00e0, 0x00e0, 0x03f8, 0x03f8, 0x03f8, 0x00e0, 0x00e0, 0x0000, }, // '+' {0x0000, 0x0000, 0x3000, 0x3800, 0x1e00, 0x0e00, 0x0000, 0x0000, 0x0000, }, // ',' {0x0000, 0x00c0, 0x00c0, 0x00c0, 0x00c0, 0x00c0, 0x00c0, 0x00c0, 0x0000, }, // '-' {0x0000, 0x0000, 0x0000, 0x0c00, 0x0c00, 0x0000, 0x0000, 0x0000, 0x0000, }, // '.' {0x3000, 0x3c00, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x000f, 0x0003, 0x0000, }, // '/' {0x0ffc, 0x1ffe, 0x3303, 0x3183, 0x30c3, 0x3063, 0x3033, 0x1ffe, 0x0ffc, }, // '0' {0x0000, 0x0000, 0x0018, 0x001c, 0x001e, 0x3fff, 0x3fff, 0x0000, 0x0000, }, // '1' {0x3c0e, 0x3e0f, 0x3f03, 0x3383, 0x31c3, 0x30e3, 0x3073, 0x303f, 0x301e, }, // '2' {0x3003, 0x3003, 0x30c3, 0x30c3, 0x30c3, 0x30c3, 0x39e7, 0x1ffe, 0x0f3c, }, // '3' {0x03c0, 0x03e0, 0x0370, 0x0338, 0x031c, 0x030e, 0x3fff, 0x3fff, 0x0300, }, // '4' {0x0e3f, 0x1e3f, 0x3833, 0x3033, 0x3033, 0x3033, 0x3873, 0x1fe3, 0x0fc3, }, // '5' {0x0ffc, 0x1ffe, 0x38e7, 0x3063, 0x3063, 0x3063, 0x38e3, 0x1fc3, 0x0f80, }, // '6' {0x0003, 0x0003, 0x0003, 0x3fc3, 0x3fe3, 0x0073, 0x003b, 0x001f, 0x000f, }, // '7' {0x0fbc, 0x1ffe, 0x39e7, 0x30c3, 0x30c3, 0x30c3, 0x39e7, 0x1ffe, 0x0f3c, }, // '8' {0x007c, 0x30fe, 0x31c7, 0x3183, 0x3183, 0x3183, 0x39c7, 0x1ffe, 0x0ffc, }, // '9' {0x0000, 0x0000, 0x0000, 0x0e38, 0x0e38, 0x0000, 0x0000, 0x0000, 0x0000, }, // ':' {0x0000, 0x0000, 0x3000, 0x3800, 0x1e38, 0x0e38, 0x0000, 0x0000, 0x0000, }, // ';' {0x0000, 0x00e0, 0x01f0, 0x03b8, 0x071c, 0x0e0e, 0x1c07, 0x1803, 0x0000, }, // '<' {0x0000, 0x0630, 0x0630, 0x0630, 0x0630, 0x0630, 0x0630, 0x0630, 0x0000, }, // '=' {0x0000, 0x1803, 0x1c07, 0x0e0e, 0x071c, 0x03b8, 0x01f0, 0x00e0, 0x0000, }, // '>' {0x000c, 0x000e, 0x0007, 0x3703, 0x3783, 0x01c3, 0x00e7, 0x007e, 0x003c, }, // '?' {0x07f8, 0x0ffc, 0x1c0e, 0x19e6, 0x1bf6, 0x1b36, 0x1b3e, 0x1bfc, 0x19f8, }, // '@' {0x3ffc, 0x3ffe, 0x00c7, 0x00c3, 0x00c3, 0x00c3, 0x00c7, 0x3ffe, 0x3ffc, }, // 'A' {0x3fff, 0x3fff, 0x30c3, 0x30c3, 0x30c3, 0x30c3, 0x39e7, 0x1ffe, 0x0f3c, }, // 'B' {0x0ffc, 0x1ffe, 0x3807, 0x3003, 0x3003, 0x3003, 0x3003, 0x3003, 0x3003, }, // 'C' {0x3fff, 0x3fff, 0x3003, 0x3003, 0x3003, 0x3807, 0x1c0e, 0x0ffc, 0x07f8, }, // 'D' {0x3fff, 0x3fff, 0x30c3, 0x30c3, 0x30c3, 0x30c3, 0x30c3, 0x3003, 0x3003, }, // 'E' {0x3fff, 0x3fff, 0x0063, 0x0063, 0x0063, 0x0063, 0x0063, 0x0003, 0x0003, }, // 'F' {0x1ffe, 0x3fff, 0x3807, 0x3003, 0x3003, 0x30c3, 0x30c3, 0x3fc7, 0x1fc6, }, // 'G' {0x3fff, 0x3fff, 0x00c0, 0x00c0, 0x00c0, 0x00c0, 0x00c0, 0x3fff, 0x3fff, }, // 'H' {0x3003, 0x3003, 0x3003, 0x3fff, 0x3fff, 0x3003, 0x3003, 0x3003, 0x0000, }, // 'I' {0x0000, 0x3003, 0x3803, 0x1c03, 0x0e03, 0x07ff, 0x03ff, 0x0000, 0x0000, }, // 'J' {0x3fff, 0x3fff, 0x01e0, 0x03f0, 0x0738, 0x0e1c, 0x1c0e, 0x3807, 0x3003, }, // 'K' {0x3fff, 0x3fff, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, }, // 'L' {0x3fff, 0x3fff, 0x000e, 0x001c, 0x0038, 0x001c, 0x000e, 0x3fff, 0x3fff, }, // 'M' {0x3fff, 0x3fff, 0x0038, 0x0070, 0x00e0, 0x01c0, 0x0380, 0x3fff, 0x3fff, }, // 'N' {0x0ffc, 0x1ffe, 0x3807, 0x3003, 0x3003, 0x3003, 0x3807, 0x1ffe, 0x0ffc, }, // 'O' {0x3fff, 0x3fff, 0x0183, 0x0183, 0x0183, 0x0183, 0x01c7, 0x00fe, 0x007c, }, // 'P' {0x0ffc, 0x1ffe, 0x3003, 0x3003, 0x3603, 0x3e03, 0x1c03, 0x3ffe, 0x37fc, }, // 'Q' {0x3fff, 0x3fff, 0x01c3, 0x03c3, 0x07c3, 0x0ec3, 0x1ce7, 0x387e, 0x303c, }, // 'R' {0x303c, 0x307e, 0x30e7, 0x30c3, 0x30c3, 0x30c3, 0x39c3, 0x1f83, 0x0f03, }, // 'S' {0x0003, 0x0003, 0x0003, 0x3fff, 0x3fff, 0x3fff, 0x0003, 0x0003, 0x0003, }, // 'T' {0x0fff, 0x1fff, 0x3800, 0x3000, 0x3000, 0x3000, 0x3800, 0x1fff, 0x0fff, }, // 'U' {0x03ff, 0x07ff, 0x0f00, 0x1e00, 0x3c00, 0x1e00, 0x0f00, 0x07ff, 0x03ff, }, // 'V' {0x0fff, 0x1fff, 0x3c00, 0x1e00, 0x0f00, 0x1e00, 0x3c00, 0x1fff, 0x0fff, }, // 'W' {0x3e1f, 0x3f3f, 0x03f0, 0x01e0, 0x00c0, 0x01e0, 0x03f0, 0x3f3f, 0x3e1f, }, // 'X' {0x003f, 0x007f, 0x00e0, 0x3fc0, 0x3f80, 0x3fc0, 0x00e0, 0x007f, 0x003f, }, // 'Y' {0x3c03, 0x3e03, 0x3703, 0x3383, 0x31c3, 0x30e3, 0x3073, 0x303f, 0x301f, }, // 'Z' {0x0000, 0x0000, 0x3fff, 0x3fff, 0x3003, 0x3003, 0x3003, 0x3003, 0x0000, }, // '[' {0x0003, 0x000f, 0x003c, 0x00f0, 0x03c0, 0x0f00, 0x3c00, 0x3000, 0x0000, }, // '\' {0x0000, 0x0000, 0x3003, 0x3003, 0x3003, 0x3003, 0x3fff, 0x3fff, 0x0000, }, // ']' {0x0000, 0x0070, 0x0038, 0x001c, 0x000e, 0x001c, 0x0038, 0x0070, 0x0000, }, // '^' {0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, }, // '_' {0x0000, 0x0000, 0x0006, 0x000e, 0x001c, 0x0038, 0x0030, 0x0000, 0x0000, }, // '`' {0x0000, 0x0e00, 0x1f60, 0x1b60, 0x1b60, 0x1b60, 0x1fe0, 0x1fc0, 0x0000, }, // 'a' {0x0000, 0x1ffc, 0x1ffc, 0x18c0, 0x18c0, 0x18c0, 0x1fc0, 0x0f80, 0x0000, }, // 'b' {0x0000, 0x0fc0, 0x1fe0, 0x1860, 0x1860, 0x1860, 0x1860, 0x1860, 0x0000, }, // 'c' {0x0000, 0x0f80, 0x1fc0, 0x18c0, 0x18c0, 0x18c0, 0x18c0, 0x1ffc, 0x1ffc, }, // 'd' {0x0000, 0x0fc0, 0x1fe0, 0x1b60, 0x1b60, 0x1b60, 0x1be0, 0x01c0, 0x0000, }, // 'e' {0x0000, 0x00c0, 0x00c0, 0x1ff8, 0x1ffc, 0x00cc, 0x00cc, 0x000c, 0x0000, }, // 'f' {0x0000, 0x01e0, 0x33f0, 0x3330, 0x3330, 0x3330, 0x3ff0, 0x1fe0, 0x0000, }, // 'g' {0x0000, 0x1ffc, 0x1ffc, 0x00c0, 0x00c0, 0x00c0, 0x1fc0, 0x1f80, 0x0000, }, // 'h' {0x0000, 0x0000, 0x0000, 0x00c0, 0x1fd8, 0x1fd8, 0x0000, 0x0000, 0x0000, }, // 'i' {0x0000, 0x0000, 0x3000, 0x3860, 0x1fec, 0x0fec, 0x0000, 0x0000, 0x0000, }, // 'j' {0x0000, 0x1ffc, 0x1ffc, 0x0780, 0x0fc0, 0x1ce0, 0x1860, 0x1020, 0x0000, }, // 'k' {0x0000, 0x0004, 0x0ffc, 0x1ffc, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, }, // 'l' {0x0000, 0x1fe0, 0x1fe0, 0x0060, 0x1fc0, 0x0060, 0x1fe0, 0x1fc0, 0x0000, }, // 'm' {0x0000, 0x1fe0, 0x1fe0, 0x0060, 0x0060, 0x0060, 0x1fe0, 0x1fc0, 0x0000, }, // 'n' {0x0000, 0x0fc0, 0x1fe0, 0x1860, 0x1860, 0x1860, 0x1fe0, 0x0fc0, 0x0000, }, // 'o' {0x0000, 0x3ff0, 0x3ff0, 0x0630, 0x0630, 0x0630, 0x07f0, 0x03e0, 0x0000, }, // 'p' {0x0000, 0x03e0, 0x07f0, 0x0630, 0x0630, 0x0630, 0x3ff0, 0x3ff0, 0x0000, }, // 'q' {0x0000, 0x1fe0, 0x1fe0, 0x00c0, 0x0060, 0x0060, 0x00e0, 0x00c0, 0x0000, }, // 'r' {0x0000, 0x19c0, 0x1be0, 0x1b60, 0x1b60, 0x1b60, 0x1f60, 0x0e60, 0x0000, }, // 's' {0x0000, 0x0000, 0x0ffc, 0x1ffc, 0x18c0, 0x18c0, 0x18c0, 0x1800, 0x0000, }, // 't' {0x0000, 0x0fe0, 0x1fe0, 0x1800, 0x1800, 0x1800, 0x1fe0, 0x1fe0, 0x0000, }, // 'u' {0x0000, 0x03e0, 0x07e0, 0x0e00, 0x1c00, 0x0e00, 0x07e0, 0x03e0, 0x0000, }, // 'v' {0x0000, 0x0fe0, 0x1fe0, 0x1800, 0x0f80, 0x1800, 0x1fe0, 0x0fe0, 0x0000, }, // 'w' {0x0000, 0x18e0, 0x1de0, 0x0f80, 0x0700, 0x0f80, 0x1de0, 0x18e0, 0x0000, }, // 'x' {0x0000, 0x03e0, 0x37e0, 0x3600, 0x3600, 0x3600, 0x3fe0, 0x1fe0, 0x0000, }, // 'y' {0x0000, 0x1860, 0x1c60, 0x1e60, 0x1b60, 0x19e0, 0x18e0, 0x1860, 0x0000, }, // 'z' {0x0000, 0x00c0, 0x01e0, 0x0ffc, 0x1f3e, 0x3807, 0x3003, 0x0000, 0x0000, }, // '{' {0x0000, 0x0000, 0x0000, 0x3ffe, 0x3ffe, 0x0000, 0x0000, 0x0000, 0x0000, }, // '|' {0x0000, 0x3003, 0x3807, 0x1f3e, 0x0ffc, 0x01e0, 0x00c0, 0x0000, 0x0000, }, // '}' {0x0060, 0x0070, 0x0038, 0x0038, 0x0030, 0x0070, 0x0070, 0x0038, 0x0018, }, // '~' }; void busvoodoo_oled_setup(void) { // setup SSD1306 OLED display busvoodoo_oled_clear(); // clean display buffer busvoodoo_oled_present = oled_ssd1306_setup(); // setup OLED display if (busvoodoo_oled_present) { #if DEBUG oled_ssd1306_test(); // test OLED display #endif busvoodoo_oled_update(); // send display buffer }; } void busvoodoo_oled_clear(void) { // write all buffer to 0 for (uint16_t i=0; i' ' && *text<' '+LENGTH(font_king14)) { // we have a glyph for this character c = *text; } for (uint8_t col=0; col>7; // draw lower section column++; // go to next screen column } text++; // go to next character column++; // insert space between glyphs } } void busvoodoo_oled_text_right(char* text) { // verify input if (NULL==text) { return; } int8_t column = 127; // start drawing on left most column for (int8_t i=strlen(text)-1; i>=0 && column>=0; i--) { // draw text from right to left char c = ' '; // default character to draw if (text[i]>' ' && text[i]<' '+LENGTH(font_king14)) { // we have a glyph for this character c = text[i]; } for (int8_t col=LENGTH(font_king14[0])-1; col>=0 && column>=0; col--) { // go through glyph columns busvoodoo_oled_display[128*0+column] = (font_king14[c-' '][col])<<1; // draw upper section busvoodoo_oled_display[128*1+column] = (font_king14[c-' '][col])>>7; // draw lower section column--; // go to next screen column } column--; // insert space between glyphs } } void busvoodoo_oled_text_pinout(const char* pins[10], bool io_connector) { // clear bottom (blue) display part for (uint16_t i=128*2; i draw cross uint16_t column = 2+2+24*(4-pin/2)+2; // the start column to start drawing (from left) if (0==pin%2) { for (uint8_t col=0; col<20; col++) { uint32_t cross = (1<>5; busvoodoo_oled_display[128*4+column+col] |= cross>>13; } else { busvoodoo_oled_display[128*2+column+col] |= cross<<1; busvoodoo_oled_display[128*3+column+col] |= cross>>7; busvoodoo_oled_display[128*4+column+col] |= cross>>15; } } } else { for (uint8_t col=0; col<20; col++) { uint32_t cross = (1<>7; busvoodoo_oled_display[128*7+column+col] |= cross>>15; } else { busvoodoo_oled_display[128*5+column+col] |= cross<<3; busvoodoo_oled_display[128*6+column+col] |= cross>>5; busvoodoo_oled_display[128*7+column+col] |= cross>>13; } } } } else if (0==strlen(pins[pin])) { // leave blank } else if (strlen(pins[pin])<4) { // calculate start position (from the left) based on number of characters to put in 24 px box uint16_t column = 2+2+24*(4-pin/2)+(24-7*strlen(pins[pin])-strlen(pins[pin])-1)/2+1; for (uint8_t i=0; i' ' && pins[pin][i]<' '+LENGTH(font_king10)) { // we have a glyph for this character c = pins[pin][i]; } for (uint8_t col=0; col>0)<<0; busvoodoo_oled_display[128*4+column] |= (font_king10[c-' '][col]>>8)<<0; } else { busvoodoo_oled_display[128*2+column] |= (font_king10[c-' '][col]>>0)<<6; busvoodoo_oled_display[128*3+column] |= (font_king10[c-' '][col]>>2)<<0; } } else { if (io_connector) { busvoodoo_oled_display[128*5+column] |= (font_king10[c-' '][col]>>0)<<6; busvoodoo_oled_display[128*6+column] |= (font_king10[c-' '][col]>>2)<<0; } else { busvoodoo_oled_display[128*6+column] |= (font_king10[c-' '][col]>>0)<<0; busvoodoo_oled_display[128*7+column] |= (font_king10[c-' '][col]>>8)<<0; } } column++; // go to next screen column } column++; // insert space between glyphs } } else if (4==strlen(pins[pin])) { uint16_t column = 2+2+24*(4-pin/2); // start position on x-axis (for 4 characters on a 24 px box) for (uint8_t i=0; i' ' && pins[pin][i]<' '+LENGTH(font_king8)) { // we have a glyph for this character c = pins[pin][i]; } for (uint8_t col=0; col>0)<<1; busvoodoo_oled_display[128*4+column] |= (font_king8[c-' '][col]>>7)<<0; } else { busvoodoo_oled_display[128*2+column] |= (font_king8[c-' '][col]>>0)<<7; busvoodoo_oled_display[128*3+column] |= (font_king8[c-' '][col]>>1)<<0; } } else { if (io_connector) { busvoodoo_oled_display[128*5+column] |= (font_king8[c-' '][col]>>0)<<7; busvoodoo_oled_display[128*6+column] |= (font_king8[c-' '][col]>>1)<<0; } else { busvoodoo_oled_display[128*6+column] |= (font_king8[c-' '][col]>>0)<<1; busvoodoo_oled_display[128*7+column] |= (font_king8[c-' '][col]>>7)<<0; } } column++; // go to next screen column } column++; // insert space between glyphs } } else { uint16_t column = 2+2+24*(4-pin/2); // start position on x-axis (for 4 characters on a 24 px box) for (uint8_t i=0; i<4; i++) { // go through 4 characters per line char c_top = ' '; // default character to draw on top line if (pins[pin][i]>' ' && pins[pin][i]<' '+LENGTH(font_king8)) { // we have a glyph for this character c_top = pins[pin][i]; // get glyph to draw } char c_bottom = ' '; // default character to draw for bottom line if ((uint8_t)(4+i)' ' && pins[pin][4+i]<' '+LENGTH(font_king8)) { // we have a glyph for this character c_bottom = pins[pin][4+i]; // get glyph to draw } for (uint8_t col=0; col>0)<<4; busvoodoo_oled_display[128*3+column] |= (font_king8[c_top-' '][col]>>4)<<0; busvoodoo_oled_display[128*3+column] |= (font_king8[c_bottom-' '][col]>>0)<<6; busvoodoo_oled_display[128*4+column] |= (font_king8[c_bottom-' '][col]>>2)<<0; } else { busvoodoo_oled_display[128*2+column] |= (font_king8[c_top-' '][col]>>0)<<2; busvoodoo_oled_display[128*3+column] |= (font_king8[c_top-' '][col]>>6)<<0; busvoodoo_oled_display[128*3+column] |= (font_king8[c_bottom-' '][col]>>0)<<4; busvoodoo_oled_display[128*4+column] |= (font_king8[c_bottom-' '][col]>>4)<<0; } } else { if (io_connector) { busvoodoo_oled_display[128*5+column] |= (font_king8[c_top-' '][col]>>0)<<2; busvoodoo_oled_display[128*6+column] |= (font_king8[c_top-' '][col]>>6)<<0; busvoodoo_oled_display[128*6+column] |= (font_king8[c_bottom-' '][col]>>0)<<4; busvoodoo_oled_display[128*7+column] |= (font_king8[c_bottom-' '][col]>>4)<<0; } else { busvoodoo_oled_display[128*5+column] |= (font_king8[c_top-' '][col]>>0)<<4; busvoodoo_oled_display[128*6+column] |= (font_king8[c_top-' '][col]>>4)<<0; busvoodoo_oled_display[128*6+column] |= (font_king8[c_bottom-' '][col]>>0)<<6; busvoodoo_oled_display[128*7+column] |= (font_king8[c_bottom-' '][col]>>2)<<0; } } column++; // go to next screen column } column++; // insert space between glyphs } } } } void busvoodoo_oled_update(void) { if (busvoodoo_oled_present) { // only do something if the display is present oled_ssd1306_off(); // switch display off to not see the update oled_ssd1306_display(busvoodoo_oled_display, LENGTH(busvoodoo_oled_display)); // send current display buffer oled_ssd1306_on(); // switch display back on } }