aboutsummaryrefslogtreecommitdiff
path: root/drivers/qwiic
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/qwiic')
-rw-r--r--drivers/qwiic/micro_oled.c691
-rw-r--r--drivers/qwiic/micro_oled.h134
-rw-r--r--drivers/qwiic/qwiic.c31
-rw-r--r--drivers/qwiic/qwiic.h28
-rw-r--r--drivers/qwiic/qwiic.mk18
-rw-r--r--drivers/qwiic/util/font5x7.h288
-rw-r--r--drivers/qwiic/util/font8x16.h127
7 files changed, 1317 insertions, 0 deletions
diff --git a/drivers/qwiic/micro_oled.c b/drivers/qwiic/micro_oled.c
new file mode 100644
index 000000000..35c5d6ee1
--- /dev/null
+++ b/drivers/qwiic/micro_oled.c
@@ -0,0 +1,691 @@
1/* Jim Lindblom @ SparkFun Electronics
2 * October 26, 2014
3 * https://github.com/sparkfun/Micro_OLED_Breakout/tree/master/Firmware/Arduino/libraries/SFE_MicroOLED
4 *
5 * Modified by:
6 * Emil Varughese @ Edwin Robotics Pvt. Ltd.
7 * July 27, 2015
8 * https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
9 *
10 * This code was heavily based around the MicroView library, written by GeekAmmo
11 * (https://github.com/geekammo/MicroView-Arduino-Library).
12 *
13 * Adapted for QMK by:
14 * Jack Humbert <jack.humb@gmail.com>
15 * October 11, 2018
16 *
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 */
30#include "micro_oled.h"
31#include <stdlib.h>
32#include "util/font5x7.h"
33#include "util/font8x16.h"
34#include "string.h"
35
36#define TOTALFONTS 2
37const unsigned char * fonts_pointer[]= { font5x7, font8x16 };
38
39uint8_t foreColor,drawMode,fontWidth, fontHeight, fontType, fontStartChar, fontTotalChar, cursorX, cursorY;
40uint16_t fontMapWidth;
41
42#define _BV(x) (1 << (x))
43#define swap(a, b) { uint8_t t = a; a = b; b = t; }
44
45uint8_t micro_oled_transfer_buffer[20];
46static uint8_t micro_oled_screen_current[LCDWIDTH*LCDWIDTH/8] = { 0 };
47
48/* LCD Memory organised in 64 horizontal pixel and 6 rows of byte
49 B B .............B -----
50 y y .............y \
51 t t .............t \
52 e e .............e \
53 0 1 .............63 \
54 \
55 D0 D0.............D0 \
56 D1 D1.............D1 / ROW 0
57 D2 D2.............D2 /
58 D3 D3.............D3 /
59 D4 D4.............D4 /
60 D5 D5.............D5 /
61 D6 D6.............D6 /
62 D7 D7.............D7 ----
63 */
64
65#if LCDWIDTH == 64
66 #if LCDWIDTH == 48
67static uint8_t micro_oled_screen_buffer[] = {
68// QMK Logo - generated at http://www.majer.ch/lcd/adf_bitmap.php
69//64x48 image
700x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
710x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
720x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00,
730x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00,
740x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
750x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
760x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
770x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
780xF8, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF,
790xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF,
800xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFE,
810xFE, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
820x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
830x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
840x8C, 0x8C, 0x8C, 0x8C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
850x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
860x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
870xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0x8C, 0x8C, 0x8C,
880x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
890x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
900x00, 0x00, 0x00, 0x00, 0x31, 0x31, 0x31, 0x31, 0xFF, 0xFF,
910xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF1, 0xE3, 0xE7, 0xCF,
920xCF, 0xCF, 0xCF, 0x00, 0x00, 0xCF, 0xCF, 0xCF, 0xC7, 0xE7,
930xE3, 0xF1, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
940x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
950x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
960x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06,
970x06, 0x06, 0x1F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
980xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF,
990xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1000xFF, 0x7F, 0x7F, 0x1F, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00,
1010x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1020x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1030x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1040x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
1050x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
1060x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1070x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1080x00, 0x00, 0x00, 0x00
109};
110 #endif
111#elif LCDWIDTH == 128
112 #if LCDHEIGHT == 32
113 static uint8_t micro_oled_screen_buffer[LCDWIDTH*LCDWIDTH/8] = {
114//128x32 qmk image
1150x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1160x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1170x00, 0x80, 0xC0, 0xE0, 0xE0, 0xFC, 0xFC, 0xE0, 0xFC, 0xFC,
1180xE0, 0xF0, 0xFC, 0xE0, 0xE0, 0xFC, 0xE0, 0xE0, 0xFC, 0xFC,
1190xE0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1200x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1210x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x30, 0xE0, 0x00, 0x00,
1220x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00,
1230x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80,
1240x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00,
1250x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
1260x80, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1270x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1280x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1290x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xB2, 0xB2, 0xFF,
1300xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0x03,
1310x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF,
1320xFF, 0xB7, 0xB2, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1330x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1340x00, 0x1F, 0x02, 0x02, 0x03, 0x01, 0x00, 0x06, 0x1F, 0x10,
1350x10, 0x10, 0x1F, 0x06, 0x00, 0x03, 0x1E, 0x18, 0x0F, 0x01,
1360x0F, 0x18, 0x1E, 0x01, 0x00, 0x0F, 0x1F, 0x12, 0x02, 0x12,
1370x13, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0x12,
1380x02, 0x12, 0x13, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x1F,
1390x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1400x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1410x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1420x00, 0x00, 0x00, 0x00, 0x48, 0x4D, 0x4D, 0xFF, 0xFF, 0xFF,
1430xFF, 0xFF, 0xFE, 0xF8, 0xF9, 0xF3, 0xF3, 0xC0, 0x80, 0xF3,
1440xF3, 0xF3, 0xF9, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED,
1450x4D, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1460x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1470x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0xC0, 0x00, 0x70, 0xC0,
1480x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0C,
1490x04, 0x04, 0x04, 0x04, 0x1C, 0xF0, 0x00, 0x00, 0xFC, 0x0C,
1500x38, 0xE0, 0x00, 0x00, 0xC0, 0x38, 0x0C, 0xFC, 0x00, 0x00,
1510xFC, 0xFC, 0x60, 0x90, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00,
1520x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1530x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1540x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1550x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x3F,
1560x3F, 0x07, 0x3F, 0x3F, 0x07, 0x0F, 0x3F, 0x07, 0x07, 0x3F,
1570x07, 0x07, 0x3F, 0x3F, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00,
1580x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1590x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
1600x06, 0x04, 0x04, 0x07, 0x01, 0x00, 0x00, 0x13, 0x1E, 0x03,
1610x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x04, 0x04,
1620x04, 0x04, 0x07, 0x0D, 0x08, 0x00, 0x07, 0x00, 0x00, 0x01,
1630x07, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x07,
1640x00, 0x01, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1650x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1660x00, 0x00
167 };
168 #elif LCDHEIGHT == 64
169 static uint8_t micro_oled_screen_buffer[LCDWIDTH*LCDWIDTH/8] = {
1700x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1710x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1720x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1730x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1740x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1750x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1760x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1770x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0,
1780x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00,
1790xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00,
1800x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1810x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1820x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1830x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1840x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1850x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1860x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1870x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1880x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1890x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1900x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1910x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1920xC0, 0xC0, 0xC0, 0xC0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFF,
1930x7F, 0x7E, 0xFE, 0xFF, 0xFF, 0xFE, 0xFE, 0x7F, 0x7F, 0xFE,
1940xFE, 0xFF, 0xFF, 0xFE, 0x7E, 0x7F, 0xFF, 0xFE, 0xFE, 0xFC,
1950xFC, 0xF8, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00,
1960x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1970x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1980x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1990x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2000x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2010x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2020x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2030x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2040x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2050x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2060x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2070x00, 0x88, 0x88, 0x88, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2080xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
2090xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
2100xFF, 0xFF, 0xFF, 0xDD, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00,
2110x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2120x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2130x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2140x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2150x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2160x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2170x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2180x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2190x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2200x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2210x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2220x00, 0x00, 0x99, 0x99, 0x99, 0x99, 0xFF, 0xFF, 0xFF, 0xFF,
2230xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xF3, 0xF3, 0xE7, 0xE7, 0x00,
2240x00, 0xE7, 0xE7, 0xF3, 0xF3, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF,
2250xFF, 0xFF, 0xFF, 0xFF, 0x99, 0x99, 0x99, 0x99, 0x00, 0x00,
2260x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2270x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2280x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2290x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2300x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2310x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2330x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2340x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2350x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2370x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x1F, 0x3F,
2380x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F,
2390xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF,
2400x3F, 0x3F, 0x3F, 0x1F, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x00,
2410x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2420x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2430x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2440x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2450x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2460x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2470x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2480x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2490x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2500x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2510x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2520x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2530x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x03, 0x01, 0x00,
2540x80, 0x03, 0x03, 0x00, 0x00, 0x01, 0x03, 0x00, 0x80, 0x01,
2550x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2560x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2570x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2580x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2590x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2600x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2610x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2620x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2630x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2640x00, 0x00, 0x00, 0xFF, 0x11, 0x11, 0x11, 0x0E, 0x00, 0x70,
2650x88, 0x04, 0x04, 0x04, 0xF8, 0x00, 0x00, 0x3C, 0xE0, 0xC0,
2660x38, 0x1C, 0xE0, 0x80, 0x70, 0x0C, 0x00, 0xF8, 0xAC, 0x24,
2670x24, 0x3C, 0x30, 0x00, 0x00, 0xFC, 0x0C, 0x04, 0x00, 0xF8,
2680xAC, 0x24, 0x24, 0x2C, 0x30, 0x00, 0x70, 0xDC, 0x04, 0x04,
2690x88, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
2700x8C, 0x04, 0x04, 0xF8, 0x00, 0x04, 0x3C, 0xE0, 0x80, 0xF0,
2710x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x83, 0x01, 0x01,
2720x01, 0x81, 0xFE, 0x3C, 0x00, 0x00, 0xFF, 0x03, 0x0E, 0x70,
2730xC0, 0xE0, 0x38, 0x06, 0x03, 0xFF, 0x00, 0x00, 0xFF, 0x18,
2740x38, 0x66, 0xC3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2750x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2760x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2770x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2780x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2790x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
2800x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
2810x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
2820x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
2830x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
2840x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2850x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03,
2860x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
2870x01, 0x01, 0x01, 0x01, 0x03, 0x02, 0x00, 0x01, 0x00, 0x00,
2880x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
2890x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
2900x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2910x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2920x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2930x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2940x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2950x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2960x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2970x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2980x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2990x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3000x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3010x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3020x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3030x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3040x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3050x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
306 };
307//TODO: generate bitmap of QMK logo here
308 #endif
309#else
310//catchall for custom screen szies
311 static uint8_t micro_oled_screen_buffer[LCDWIDTH*LCDWIDTH/8] = {0};
312#endif
313
314
315
316void micro_oled_init(void) {
317
318 i2c_init();
319 i2c_start(I2C_ADDRESS_SA0_1);
320
321 // Display Init sequence for 64x48 OLED module
322 send_command(DISPLAYOFF); // 0xAE
323
324 send_command(SETDISPLAYCLOCKDIV); // 0xD5
325 send_command(0x80); // the suggested ratio 0x80
326
327 send_command(SETMULTIPLEX); // 0xA8
328 send_command(LCDHEIGHT - 1);
329
330 send_command(SETDISPLAYOFFSET); // 0xD3
331 send_command(0x00); // no offset
332
333 send_command(SETSTARTLINE | 0x00); // line #0
334
335 send_command(CHARGEPUMP); // enable charge pump
336 send_command(0x14);
337
338 send_command(NORMALDISPLAY); // 0xA6
339 send_command(DISPLAYALLONRESUME); // 0xA4
340
341//display at regular orientation
342 send_command(SEGREMAP | 0x1);
343 send_command(COMSCANDEC);
344
345//rotate display 180
346#ifdef micro_oled_rotate_180
347 send_command(SEGREMAP);
348 send_command(COMSCANINC);
349#endif
350
351 send_command(MEMORYMODE);
352 send_command(0x10);
353
354 send_command(SETCOMPINS); // 0xDA
355if (LCDHEIGHT > 32) {
356 send_command(0x12);
357} else {
358 send_command(0x02);
359}
360 send_command(SETCONTRAST); // 0x81
361 send_command(0x8F);
362
363 send_command(SETPRECHARGE); // 0xd9
364 send_command(0xF1);
365
366 send_command(SETVCOMDESELECT); // 0xDB
367 send_command(0x40);
368
369 send_command(DISPLAYON); //--turn on oled panel
370 clear_screen(); // Erase hardware memory inside the OLED controller to avoid random data in memory.
371 send_buffer();
372}
373
374void send_command(uint8_t command) {
375 micro_oled_transfer_buffer[0] = I2C_COMMAND;
376 micro_oled_transfer_buffer[1] = command;
377 i2c_transmit(I2C_ADDRESS_SA0_1 << 1, micro_oled_transfer_buffer, 2, 100);
378}
379
380void send_data(uint8_t data) {
381 micro_oled_transfer_buffer[0] = I2C_DATA;
382 micro_oled_transfer_buffer[1] = data;
383 i2c_transmit(I2C_ADDRESS_SA0_1 << 1, micro_oled_transfer_buffer, 2, 100);
384}
385
386/** \brief Set SSD1306 page address.
387 Send page address command and address to the SSD1306 OLED controller.
388*/
389void set_page_address(uint8_t address) {
390 address = (0xB0 | address);
391 send_command(address);
392}
393
394/** \brief Set SSD1306 column address.
395 Send column address command and address to the SSD1306 OLED controller.
396*/
397void set_column_address(uint8_t address) {
398 send_command( ( 0x10 | (address >> 4) ) + ((128 - LCDWIDTH) >> 8) );
399 send_command( 0x0F & address );
400}
401
402/** \brief Clear SSD1306's memory.
403 To clear GDRAM inside the LCD controller.
404*/
405void clear_screen(void) {
406 for (int i=0;i<8; i++) {
407 set_page_address(i);
408 set_column_address(0);
409 for (int j=0; j<0x80; j++) {
410 send_data(0);
411 }
412 }
413}
414
415/** \brief Clear SSD1306's memory.
416 To clear GDRAM inside the LCD controller.
417*/
418void clear_buffer(void) {
419//384
420 memset(micro_oled_screen_buffer, 0, LCDWIDTH*LCDWIDTH/8);
421}
422
423/** \brief Invert display.
424 The PIXEL_ON color of the display will turn to PIXEL_OFF and the PIXEL_OFF will turn to PIXEL_ON.
425*/
426void invert_screen(bool invert) {
427 if (invert) {
428 send_command(INVERTDISPLAY);
429 } else {
430 send_command(NORMALDISPLAY);
431 }
432}
433
434/** \brief Set contrast.
435 OLED contract value from 0 to 255. Note: Contrast level is not very obvious.
436*/
437void set_contrast(uint8_t contrast) {
438 send_command(SETCONTRAST); // 0x81
439 send_command(contrast);
440}
441
442/** \brief Transfer display buffer.
443 Sends the updated buffer to the controller - the current status is checked before to save i2c exectution time
444*/
445void send_buffer(void) {
446 uint8_t i, j;
447
448 uint8_t page_addr = 0xFF;
449 for (i = 0; i < LCDHEIGHT/8; i++) {
450 uint8_t col_addr = 0xFF;
451 for (j = 0; j < LCDWIDTH; j++) {
452 if (micro_oled_screen_buffer[i*LCDWIDTH+j] != micro_oled_screen_current[i*LCDWIDTH+j]) {
453 if (page_addr != i) {
454 set_page_address(i);
455 }
456 if (col_addr != j) {
457 set_column_address(j);
458 }
459 send_data(micro_oled_screen_buffer[i*LCDWIDTH+j]);
460 micro_oled_screen_current[i*LCDWIDTH+j] = micro_oled_screen_buffer[i*LCDWIDTH+j];
461 col_addr = j + 1;
462 }
463 }
464 }
465}
466
467/** \brief Draw pixel with color and mode.
468 Draw color pixel in the screen buffer's x,y position with NORM or XOR draw mode.
469*/
470void draw_pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode) {
471 if ((x<0) || (x>=LCDWIDTH) || (y<0) || (y>=LCDHEIGHT))
472 return;
473
474 if (mode == XOR) {
475 if (color == PIXEL_ON)
476 micro_oled_screen_buffer[x + (y/8)*LCDWIDTH] ^= _BV((y%8));
477 } else {
478 if (color == PIXEL_ON)
479 micro_oled_screen_buffer[x + (y/8)*LCDWIDTH] |= _BV((y%8));
480 else
481 micro_oled_screen_buffer[x + (y/8)*LCDWIDTH] &= ~_BV((y%8));
482 }
483}
484
485/** \brief Draw line with color and mode.
486Draw line using color and mode from x0,y0 to x1,y1 of the screen buffer.
487*/
488void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, uint8_t mode) {
489 uint8_t steep = abs(y1 - y0) > abs(x1 - x0);
490 if (steep) {
491 swap(x0, y0);
492 swap(x1, y1);
493 }
494
495 if (x0 > x1) {
496 swap(x0, x1);
497 swap(y0, y1);
498 }
499
500 uint8_t dx, dy;
501 dx = x1 - x0;
502 dy = abs(y1 - y0);
503
504 int8_t err = dx / 2;
505 int8_t ystep;
506
507 if (y0 < y1) {
508 ystep = 1;
509 } else {
510 ystep = -1;}
511
512 for (; x0<x1; x0++) {
513 if (steep) {
514 draw_pixel(y0, x0, color, mode);
515 } else {
516 draw_pixel(x0, y0, color, mode);
517 }
518 err -= dy;
519 if (err < 0) {
520 y0 += ystep;
521 err += dx;
522 }
523 }
524}
525
526/** \brief Draw horizontal line with color and mode.
527Draw horizontal line using color and mode from x,y to x+width,y of the screen buffer.
528*/
529void draw_line_hori(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode) {
530 draw_line(x,y,x+width,y,color,mode);
531}
532
533/** \brief Draw vertical line.
534Draw vertical line using current fore color and current draw mode from x,y to x,y+height of the screen buffer.
535*/
536void draw_line_vert(uint8_t x, uint8_t y, uint8_t height, bool color, uint8_t mode) {
537 draw_line(x,y,x,y+height,color,mode);
538}
539
540/** \brief Draw rectangle with color and mode.
541Draw rectangle using color and mode from x,y to x+width,y+height of the screen buffer.
542*/
543void draw_rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) {
544 uint8_t tempHeight;
545
546 draw_line_hori(x,y, width, color, mode);
547 draw_line_hori(x,y+height-1, width, color, mode);
548
549 tempHeight=height-2;
550
551 // skip drawing vertical lines to avoid overlapping of pixel that will
552 // affect XOR plot if no pixel in between horizontal lines
553 if (tempHeight<1) return;
554
555 draw_line_vert(x,y+1, tempHeight, color, mode);
556 draw_line_vert(x+width-1, y+1, tempHeight, color, mode);
557}
558
559/** \brief Draw rectangle with color and mode.
560Draw rectangle using color and mode from x,y to x+width,y+height of the screen buffer.
561*/
562void draw_rect_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) {
563 uint8_t tempHeight;
564
565 draw_line_hori(x+1,y, width-2, color, mode);
566 draw_line_hori(x+1,y+height-1, width-2, color, mode);
567
568 tempHeight=height-2;
569
570 // skip drawing vertical lines to avoid overlapping of pixel that will
571 // affect XOR plot if no pixel in between horizontal lines
572 if (tempHeight<1) return;
573
574 draw_line_vert(x,y+1, tempHeight, color, mode);
575 draw_line_vert(x+width-1, y+1, tempHeight, color, mode);
576}
577
578/** \brief Draw filled rectangle with color and mode.
579Draw filled rectangle using color and mode from x,y to x+width,y+height of the screen buffer.
580*/
581void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) {
582 // TODO - need to optimise the memory map draw so that this function will not call pixel one by one
583 for (int i=x; i<x+width;i++) {
584 draw_line_vert(i,y, height, color, mode);
585 }
586}
587
588/** \brief Draw filled rectangle with color and mode.
589Draw filled rectangle using color and mode from x,y to x+width,y+height of the screen buffer.
590*/
591void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) {
592 // TODO - need to optimise the memory map draw so that this function will not call pixel one by one
593 for (int i=x; i<x+width;i++) {
594 if (i == x || i == (x + width - 1))
595 draw_line_vert(i, y+1, height-2, color, mode);
596 else
597 draw_line_vert(i, y, height, color, mode);
598 }
599}
600
601/** \brief Draw character with color and mode.
602 Draw character c using color and draw mode at x,y.
603*/
604void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uint8_t font) {
605 // TODO - New routine to take font of any height, at the moment limited to font height in multiple of 8 pixels
606
607 uint8_t rowsToDraw,row, tempC;
608 uint8_t i,j,temp;
609 uint16_t charPerBitmapRow,charColPositionOnBitmap,charRowPositionOnBitmap,charBitmapStartPosition;
610
611 if ((font>=TOTALFONTS) || (font<0))
612 return;
613
614 uint8_t fontType = font;
615 uint8_t fontWidth = pgm_read_byte(fonts_pointer[fontType]+0);
616 uint8_t fontHeight = pgm_read_byte(fonts_pointer[fontType]+1);
617 uint8_t fontStartChar = pgm_read_byte(fonts_pointer[fontType]+2);
618 uint8_t fontTotalChar = pgm_read_byte(fonts_pointer[fontType]+3);
619 uint16_t fontMapWidth = (pgm_read_byte(fonts_pointer[fontType]+4)*100)+pgm_read_byte(fonts_pointer[fontType]+5); // two bytes values into integer 16
620
621 if ((c<fontStartChar) || (c>(fontStartChar+fontTotalChar-1))) // no bitmap for the required c
622 return;
623
624 tempC=c-fontStartChar;
625
626 // each row (in datasheet is call page) is 8 bits high, 16 bit high character will have 2 rows to be drawn
627 rowsToDraw=fontHeight/8; // 8 is LCD's page size, see SSD1306 datasheet
628 if (rowsToDraw<=1) rowsToDraw=1;
629
630 // the following draw function can draw anywhere on the screen, but SLOW pixel by pixel draw
631 if (rowsToDraw==1) {
632 for (i=0;i<fontWidth+1;i++) {
633 if (i==fontWidth) // this is done in a weird way because for 5x7 font, there is no margin, this code add a margin after col 5
634 temp=0;
635 else
636 temp=pgm_read_byte(fonts_pointer[fontType]+FONTHEADERSIZE+(tempC*fontWidth)+i);
637
638 for (j=0;j<8;j++) { // 8 is the LCD's page height (see datasheet for explanation)
639 if (temp & 0x1) {
640 draw_pixel(x+i, y+j, color,mode);
641 }
642 else {
643 draw_pixel(x+i, y+j, !color,mode);
644 }
645
646 temp >>=1;
647 }
648 }
649 return;
650 }
651
652 // font height over 8 bit
653 // take character "0" ASCII 48 as example
654 charPerBitmapRow = fontMapWidth/fontWidth; // 256/8 =32 char per row
655 charColPositionOnBitmap = tempC % charPerBitmapRow; // =16
656 charRowPositionOnBitmap = (int)(tempC/charPerBitmapRow); // =1
657 charBitmapStartPosition = (charRowPositionOnBitmap * fontMapWidth * (fontHeight/8)) + (charColPositionOnBitmap * fontWidth) ;
658
659 // each row on LCD is 8 bit height (see datasheet for explanation)
660 for(row=0;row<rowsToDraw;row++) {
661 for (i=0; i<fontWidth;i++) {
662 temp=pgm_read_byte(fonts_pointer[fontType]+FONTHEADERSIZE+(charBitmapStartPosition+i+(row*fontMapWidth)));
663 for (j=0;j<8;j++) { // 8 is the LCD's page height (see datasheet for explanation)
664 if (temp & 0x1) {
665 draw_pixel(x+i,y+j+(row*8), color, mode);
666 }
667 else {
668 draw_pixel(x+i,y+j+(row*8), !color, mode);
669 }
670 temp >>=1;
671 }
672 }
673 }
674
675}
676
677void draw_string(uint8_t x, uint8_t y, char * string, uint8_t color, uint8_t mode, uint8_t font) {
678
679 if ((font>=TOTALFONTS) || (font<0))
680 return;
681
682 uint8_t fontType = font;
683 uint8_t fontWidth = pgm_read_byte(fonts_pointer[fontType]+0);
684
685 uint8_t cur_x = x;
686 for (int i = 0; i < strlen(string); i++) {
687 draw_char(cur_x, y, string[i], color, mode, font);
688 cur_x += fontWidth + 1;
689 }
690
691}
diff --git a/drivers/qwiic/micro_oled.h b/drivers/qwiic/micro_oled.h
new file mode 100644
index 000000000..5d6a1029e
--- /dev/null
+++ b/drivers/qwiic/micro_oled.h
@@ -0,0 +1,134 @@
1/* Jim Lindblom @ SparkFun Electronics
2 * October 26, 2014
3 * https://github.com/sparkfun/Micro_OLED_Breakout/tree/master/Firmware/Arduino/libraries/SFE_MicroOLED
4 *
5 * Modified by:
6 * Emil Varughese @ Edwin Robotics Pvt. Ltd.
7 * July 27, 2015
8 * https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
9 *
10 * This code was heavily based around the MicroView library, written by GeekAmmo
11 * (https://github.com/geekammo/MicroView-Arduino-Library).
12 *
13 * Adapted for QMK by:
14 * Jack Humbert <jack.humb@gmail.com>
15 * October 11, 2018
16 *
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 */
30#pragma once
31
32#include "qwiic.h"
33
34void micro_oled_init(void);
35
36void send_command(uint8_t command);
37void send_data(uint8_t data);
38void set_page_address(uint8_t address);
39void set_column_address(uint8_t address);
40void clear_screen(void);
41void clear_buffer(void);
42void send_buffer(void);
43void draw_pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode);
44void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, uint8_t mode);
45void draw_line_hori(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode);
46void draw_line_vert(uint8_t x, uint8_t y, uint8_t height, bool color, uint8_t mode);
47void draw_rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
48void draw_rect_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
49void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
50void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
51void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uint8_t font);
52void draw_string(uint8_t x, uint8_t y, char * string, uint8_t color, uint8_t mode, uint8_t font);
53
54#define I2C_ADDRESS_SA0_0 0b0111100
55#ifndef I2C_ADDRESS_SA0_1
56#define I2C_ADDRESS_SA0_1 0b0111101
57#endif
58#define I2C_COMMAND 0x00
59#define I2C_DATA 0x40
60#define PIXEL_OFF 0
61#define PIXEL_ON 1
62
63#ifndef LCDWIDTH
64#define LCDWIDTH 64
65#endif
66#ifndef LCDWIDTH
67#define LCDHEIGHT 48
68#endif
69#define FONTHEADERSIZE 6
70
71#define NORM 0
72#define XOR 1
73
74#define PAGE 0
75#define ALL 1
76
77#define WIDGETSTYLE0 0
78#define WIDGETSTYLE1 1
79#define WIDGETSTYLE2 2
80
81#define SETCONTRAST 0x81
82#define DISPLAYALLONRESUME 0xA4
83#define DISPLAYALLON 0xA5
84#define NORMALDISPLAY 0xA6
85#define INVERTDISPLAY 0xA7
86#define DISPLAYOFF 0xAE
87#define DISPLAYON 0xAF
88#define SETDISPLAYOFFSET 0xD3
89#define SETCOMPINS 0xDA
90#define SETVCOMDESELECT 0xDB
91#define SETDISPLAYCLOCKDIV 0xD5
92#define SETPRECHARGE 0xD9
93#define SETMULTIPLEX 0xA8
94#define SETLOWCOLUMN 0x00
95#define SETHIGHCOLUMN 0x10
96#define SETSTARTLINE 0x40
97#define MEMORYMODE 0x20
98#define COMSCANINC 0xC0
99#define COMSCANDEC 0xC8
100#define SEGREMAP 0xA0
101#define CHARGEPUMP 0x8D
102#define EXTERNALVCC 0x01
103#define SWITCHCAPVCC 0x02
104
105// Scroll
106#define ACTIVATESCROLL 0x2F
107#define DEACTIVATESCROLL 0x2E
108#define SETVERTICALSCROLLAREA 0xA3
109#define RIGHTHORIZONTALSCROLL 0x26
110#define LEFT_HORIZONTALSCROLL 0x27
111#define VERTICALRIGHTHORIZONTALSCROLL 0x29
112#define VERTICALLEFTHORIZONTALSCROLL 0x2A
113
114typedef enum CMD {
115 CMD_CLEAR, //0
116 CMD_INVERT, //1
117 CMD_CONTRAST, //2
118 CMD_DISPLAY, //3
119 CMD_SETCURSOR, //4
120 CMD_PIXEL, //5
121 CMD_LINE, //6
122 CMD_LINEH, //7
123 CMD_LINEV, //8
124 CMD_RECT, //9
125 CMD_RECTFILL, //10
126 CMD_CIRCLE, //11
127 CMD_CIRCLEFILL, //12
128 CMD_DRAWCHAR, //13
129 CMD_DRAWBITMAP, //14
130 CMD_GETLCDWIDTH, //15
131 CMD_GETLCDHEIGHT, //16
132 CMD_SETCOLOR, //17
133 CMD_SETDRAWMODE //18
134} commCommand_t; \ No newline at end of file
diff --git a/drivers/qwiic/qwiic.c b/drivers/qwiic/qwiic.c
new file mode 100644
index 000000000..904791992
--- /dev/null
+++ b/drivers/qwiic/qwiic.c
@@ -0,0 +1,31 @@
1/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "qwiic.h"
17
18void qwiic_init(void) {
19 #ifdef QWIIC_JOYSTIIC_ENABLE
20 joystiic_init();
21 #endif
22 #ifdef QWIIC_MICRO_OLED_ENABLE
23 micro_oled_init();
24 #endif
25}
26
27void qwiic_task(void) {
28 #ifdef QWIIC_JOYSTIIC_ENABLE
29 joystiic_task();
30 #endif
31}
diff --git a/drivers/qwiic/qwiic.h b/drivers/qwiic/qwiic.h
new file mode 100644
index 000000000..160fb28df
--- /dev/null
+++ b/drivers/qwiic/qwiic.h
@@ -0,0 +1,28 @@
1/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include "i2c_master.h"
19
20#ifdef QWIIC_JOYSTIIC_ENABLE
21 #include "joystiic.h"
22#endif
23#ifdef QWIIC_MICRO_OLED_ENABLE
24 #include "micro_oled.h"
25#endif
26
27void qwiic_init(void);
28void qwiic_task(void);
diff --git a/drivers/qwiic/qwiic.mk b/drivers/qwiic/qwiic.mk
new file mode 100644
index 000000000..4ae2d78e3
--- /dev/null
+++ b/drivers/qwiic/qwiic.mk
@@ -0,0 +1,18 @@
1ifneq ($(strip $(QWIIC_ENABLE)),)
2 COMMON_VPATH += $(DRIVER_PATH)/qwiic
3 OPT_DEFS += -DQWIIC_ENABLE
4 SRC += qwiic.c
5 ifeq ($(filter "i2c_master.c", $(SRC)),)
6 SRC += i2c_master.c
7 endif
8endif
9
10ifneq ($(filter JOYSTIIC, $(QWIIC_ENABLE)),)
11 OPT_DEFS += -DQWIIC_JOYSTIIC_ENABLE
12 SRC += joystiic.c
13endif
14
15ifneq ($(filter MICRO_OLED, $(QWIIC_ENABLE)),)
16 OPT_DEFS += -DQWIIC_MICRO_OLED_ENABLE
17 SRC += micro_oled.c
18endif
diff --git a/drivers/qwiic/util/font5x7.h b/drivers/qwiic/util/font5x7.h
new file mode 100644
index 000000000..0bad206b7
--- /dev/null
+++ b/drivers/qwiic/util/font5x7.h
@@ -0,0 +1,288 @@
1/******************************************************************************
2font5x7.h
3Definition for small font
4
5This file was imported from the MicroView library, written by GeekAmmo
6(https://github.com/geekammo/MicroView-Arduino-Library), and released under
7the terms of the GNU General Public License as published by the Free Software
8Foundation, either version 3 of the License, or (at your option) any later
9version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19Modified by:
20Emil Varughese @ Edwin Robotics Pvt. Ltd.
21July 27, 2015
22https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
23
24******************************************************************************/
25#pragma once
26
27#include "progmem.h"
28
29// Standard ASCII 5x7 font
30static const unsigned char font5x7[] PROGMEM = {
31 // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)
32 5,8,0,255,12,75,
33 0x00, 0x00, 0x00, 0x00, 0x00,
34 0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
35 0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
36 0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
37 0x18, 0x3C, 0x7E, 0x3C, 0x18,
38 0x1C, 0x57, 0x7D, 0x57, 0x1C,
39 0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
40 0x00, 0x18, 0x3C, 0x18, 0x00,
41 0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
42 0x00, 0x18, 0x24, 0x18, 0x00,
43 0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
44 0x30, 0x48, 0x3A, 0x06, 0x0E,
45 0x26, 0x29, 0x79, 0x29, 0x26,
46 0x40, 0x7F, 0x05, 0x05, 0x07,
47 0x40, 0x7F, 0x05, 0x25, 0x3F,
48 0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
49 0x7F, 0x3E, 0x1C, 0x1C, 0x08,
50 0x08, 0x1C, 0x1C, 0x3E, 0x7F,
51 0x14, 0x22, 0x7F, 0x22, 0x14,
52 0x5F, 0x5F, 0x00, 0x5F, 0x5F,
53 0x06, 0x09, 0x7F, 0x01, 0x7F,
54 0x00, 0x66, 0x89, 0x95, 0x6A,
55 0x60, 0x60, 0x60, 0x60, 0x60,
56 0x94, 0xA2, 0xFF, 0xA2, 0x94,
57 0x08, 0x04, 0x7E, 0x04, 0x08,
58 0x10, 0x20, 0x7E, 0x20, 0x10,
59 0x08, 0x08, 0x2A, 0x1C, 0x08,
60 0x08, 0x1C, 0x2A, 0x08, 0x08,
61 0x1E, 0x10, 0x10, 0x10, 0x10,
62 0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
63 0x30, 0x38, 0x3E, 0x38, 0x30,
64 0x06, 0x0E, 0x3E, 0x0E, 0x06,
65 0x00, 0x00, 0x00, 0x00, 0x00,
66 0x00, 0x00, 0x5F, 0x00, 0x00,
67 0x00, 0x07, 0x00, 0x07, 0x00,
68 0x14, 0x7F, 0x14, 0x7F, 0x14,
69 0x24, 0x2A, 0x7F, 0x2A, 0x12,
70 0x23, 0x13, 0x08, 0x64, 0x62,
71 0x36, 0x49, 0x56, 0x20, 0x50,
72 0x00, 0x08, 0x07, 0x03, 0x00,
73 0x00, 0x1C, 0x22, 0x41, 0x00,
74 0x00, 0x41, 0x22, 0x1C, 0x00,
75 0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
76 0x08, 0x08, 0x3E, 0x08, 0x08,
77 0x00, 0x80, 0x70, 0x30, 0x00,
78 0x08, 0x08, 0x08, 0x08, 0x08,
79 0x00, 0x00, 0x60, 0x60, 0x00,
80 0x20, 0x10, 0x08, 0x04, 0x02,
81 0x3E, 0x51, 0x49, 0x45, 0x3E,
82 0x00, 0x42, 0x7F, 0x40, 0x00,
83 0x72, 0x49, 0x49, 0x49, 0x46,
84 0x21, 0x41, 0x49, 0x4D, 0x33,
85 0x18, 0x14, 0x12, 0x7F, 0x10,
86 0x27, 0x45, 0x45, 0x45, 0x39,
87 0x3C, 0x4A, 0x49, 0x49, 0x31,
88 0x41, 0x21, 0x11, 0x09, 0x07,
89 0x36, 0x49, 0x49, 0x49, 0x36,
90 0x46, 0x49, 0x49, 0x29, 0x1E,
91 0x00, 0x00, 0x14, 0x00, 0x00,
92 0x00, 0x40, 0x34, 0x00, 0x00,
93 0x00, 0x08, 0x14, 0x22, 0x41,
94 0x14, 0x14, 0x14, 0x14, 0x14,
95 0x00, 0x41, 0x22, 0x14, 0x08,
96 0x02, 0x01, 0x59, 0x09, 0x06,
97 0x3E, 0x41, 0x5D, 0x59, 0x4E,
98 0x7C, 0x12, 0x11, 0x12, 0x7C,
99 0x7F, 0x49, 0x49, 0x49, 0x36,
100 0x3E, 0x41, 0x41, 0x41, 0x22,
101 0x7F, 0x41, 0x41, 0x41, 0x3E,
102 0x7F, 0x49, 0x49, 0x49, 0x41,
103 0x7F, 0x09, 0x09, 0x09, 0x01,
104 0x3E, 0x41, 0x41, 0x51, 0x73,
105 0x7F, 0x08, 0x08, 0x08, 0x7F,
106 0x00, 0x41, 0x7F, 0x41, 0x00,
107 0x20, 0x40, 0x41, 0x3F, 0x01,
108 0x7F, 0x08, 0x14, 0x22, 0x41,
109 0x7F, 0x40, 0x40, 0x40, 0x40,
110 0x7F, 0x02, 0x1C, 0x02, 0x7F,
111 0x7F, 0x04, 0x08, 0x10, 0x7F,
112 0x3E, 0x41, 0x41, 0x41, 0x3E,
113 0x7F, 0x09, 0x09, 0x09, 0x06,
114 0x3E, 0x41, 0x51, 0x21, 0x5E,
115 0x7F, 0x09, 0x19, 0x29, 0x46,
116 0x26, 0x49, 0x49, 0x49, 0x32,
117 0x03, 0x01, 0x7F, 0x01, 0x03,
118 0x3F, 0x40, 0x40, 0x40, 0x3F,
119 0x1F, 0x20, 0x40, 0x20, 0x1F,
120 0x3F, 0x40, 0x38, 0x40, 0x3F,
121 0x63, 0x14, 0x08, 0x14, 0x63,
122 0x03, 0x04, 0x78, 0x04, 0x03,
123 0x61, 0x59, 0x49, 0x4D, 0x43,
124 0x00, 0x7F, 0x41, 0x41, 0x41,
125 0x02, 0x04, 0x08, 0x10, 0x20,
126 0x00, 0x41, 0x41, 0x41, 0x7F,
127 0x04, 0x02, 0x01, 0x02, 0x04,
128 0x40, 0x40, 0x40, 0x40, 0x40,
129 0x00, 0x03, 0x07, 0x08, 0x00,
130 0x20, 0x54, 0x54, 0x78, 0x40,
131 0x7F, 0x28, 0x44, 0x44, 0x38,
132 0x38, 0x44, 0x44, 0x44, 0x28,
133 0x38, 0x44, 0x44, 0x28, 0x7F,
134 0x38, 0x54, 0x54, 0x54, 0x18,
135 0x00, 0x08, 0x7E, 0x09, 0x02,
136 0x18, 0xA4, 0xA4, 0x9C, 0x78,
137 0x7F, 0x08, 0x04, 0x04, 0x78,
138 0x00, 0x44, 0x7D, 0x40, 0x00,
139 0x20, 0x40, 0x40, 0x3D, 0x00,
140 0x7F, 0x10, 0x28, 0x44, 0x00,
141 0x00, 0x41, 0x7F, 0x40, 0x00,
142 0x7C, 0x04, 0x78, 0x04, 0x78,
143 0x7C, 0x08, 0x04, 0x04, 0x78,
144 0x38, 0x44, 0x44, 0x44, 0x38,
145 0xFC, 0x18, 0x24, 0x24, 0x18,
146 0x18, 0x24, 0x24, 0x18, 0xFC,
147 0x7C, 0x08, 0x04, 0x04, 0x08,
148 0x48, 0x54, 0x54, 0x54, 0x24,
149 0x04, 0x04, 0x3F, 0x44, 0x24,
150 0x3C, 0x40, 0x40, 0x20, 0x7C,
151 0x1C, 0x20, 0x40, 0x20, 0x1C,
152 0x3C, 0x40, 0x30, 0x40, 0x3C,
153 0x44, 0x28, 0x10, 0x28, 0x44,
154 0x4C, 0x90, 0x90, 0x90, 0x7C,
155 0x44, 0x64, 0x54, 0x4C, 0x44,
156 0x00, 0x08, 0x36, 0x41, 0x00,
157 0x00, 0x00, 0x77, 0x00, 0x00,
158 0x00, 0x41, 0x36, 0x08, 0x00,
159 0x02, 0x01, 0x02, 0x04, 0x02,
160 0x3C, 0x26, 0x23, 0x26, 0x3C,
161 0x1E, 0xA1, 0xA1, 0x61, 0x12,
162 0x3A, 0x40, 0x40, 0x20, 0x7A,
163 0x38, 0x54, 0x54, 0x55, 0x59,
164 0x21, 0x55, 0x55, 0x79, 0x41,
165 0x21, 0x54, 0x54, 0x78, 0x41,
166 0x21, 0x55, 0x54, 0x78, 0x40,
167 0x20, 0x54, 0x55, 0x79, 0x40,
168 0x0C, 0x1E, 0x52, 0x72, 0x12,
169 0x39, 0x55, 0x55, 0x55, 0x59,
170 0x39, 0x54, 0x54, 0x54, 0x59,
171 0x39, 0x55, 0x54, 0x54, 0x58,
172 0x00, 0x00, 0x45, 0x7C, 0x41,
173 0x00, 0x02, 0x45, 0x7D, 0x42,
174 0x00, 0x01, 0x45, 0x7C, 0x40,
175 0xF0, 0x29, 0x24, 0x29, 0xF0,
176 0xF0, 0x28, 0x25, 0x28, 0xF0,
177 0x7C, 0x54, 0x55, 0x45, 0x00,
178 0x20, 0x54, 0x54, 0x7C, 0x54,
179 0x7C, 0x0A, 0x09, 0x7F, 0x49,
180 0x32, 0x49, 0x49, 0x49, 0x32,
181 0x32, 0x48, 0x48, 0x48, 0x32,
182 0x32, 0x4A, 0x48, 0x48, 0x30,
183 0x3A, 0x41, 0x41, 0x21, 0x7A,
184 0x3A, 0x42, 0x40, 0x20, 0x78,
185 0x00, 0x9D, 0xA0, 0xA0, 0x7D,
186 0x39, 0x44, 0x44, 0x44, 0x39,
187 0x3D, 0x40, 0x40, 0x40, 0x3D,
188 0x3C, 0x24, 0xFF, 0x24, 0x24,
189 0x48, 0x7E, 0x49, 0x43, 0x66,
190 0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
191 0xFF, 0x09, 0x29, 0xF6, 0x20,
192 0xC0, 0x88, 0x7E, 0x09, 0x03,
193 0x20, 0x54, 0x54, 0x79, 0x41,
194 0x00, 0x00, 0x44, 0x7D, 0x41,
195 0x30, 0x48, 0x48, 0x4A, 0x32,
196 0x38, 0x40, 0x40, 0x22, 0x7A,
197 0x00, 0x7A, 0x0A, 0x0A, 0x72,
198 0x7D, 0x0D, 0x19, 0x31, 0x7D,
199 0x26, 0x29, 0x29, 0x2F, 0x28,
200 0x26, 0x29, 0x29, 0x29, 0x26,
201 0x30, 0x48, 0x4D, 0x40, 0x20,
202 0x38, 0x08, 0x08, 0x08, 0x08,
203 0x08, 0x08, 0x08, 0x08, 0x38,
204 0x2F, 0x10, 0xC8, 0xAC, 0xBA,
205 0x2F, 0x10, 0x28, 0x34, 0xFA,
206 0x00, 0x00, 0x7B, 0x00, 0x00,
207 0x08, 0x14, 0x2A, 0x14, 0x22,
208 0x22, 0x14, 0x2A, 0x14, 0x08,
209 0xAA, 0x00, 0x55, 0x00, 0xAA,
210 0xAA, 0x55, 0xAA, 0x55, 0xAA,
211 0x00, 0x00, 0x00, 0xFF, 0x00,
212 0x10, 0x10, 0x10, 0xFF, 0x00,
213 0x14, 0x14, 0x14, 0xFF, 0x00,
214 0x10, 0x10, 0xFF, 0x00, 0xFF,
215 0x10, 0x10, 0xF0, 0x10, 0xF0,
216 0x14, 0x14, 0x14, 0xFC, 0x00,
217 0x14, 0x14, 0xF7, 0x00, 0xFF,
218 0x00, 0x00, 0xFF, 0x00, 0xFF,
219 0x14, 0x14, 0xF4, 0x04, 0xFC,
220 0x14, 0x14, 0x17, 0x10, 0x1F,
221 0x10, 0x10, 0x1F, 0x10, 0x1F,
222 0x14, 0x14, 0x14, 0x1F, 0x00,
223 0x10, 0x10, 0x10, 0xF0, 0x00,
224 0x00, 0x00, 0x00, 0x1F, 0x10,
225 0x10, 0x10, 0x10, 0x1F, 0x10,
226 0x10, 0x10, 0x10, 0xF0, 0x10,
227 0x00, 0x00, 0x00, 0xFF, 0x10,
228 0x10, 0x10, 0x10, 0x10, 0x10,
229 0x10, 0x10, 0x10, 0xFF, 0x10,
230 0x00, 0x00, 0x00, 0xFF, 0x14,
231 0x00, 0x00, 0xFF, 0x00, 0xFF,
232 0x00, 0x00, 0x1F, 0x10, 0x17,
233 0x00, 0x00, 0xFC, 0x04, 0xF4,
234 0x14, 0x14, 0x17, 0x10, 0x17,
235 0x14, 0x14, 0xF4, 0x04, 0xF4,
236 0x00, 0x00, 0xFF, 0x00, 0xF7,
237 0x14, 0x14, 0x14, 0x14, 0x14,
238 0x14, 0x14, 0xF7, 0x00, 0xF7,
239 0x14, 0x14, 0x14, 0x17, 0x14,
240 0x10, 0x10, 0x1F, 0x10, 0x1F,
241 0x14, 0x14, 0x14, 0xF4, 0x14,
242 0x10, 0x10, 0xF0, 0x10, 0xF0,
243 0x00, 0x00, 0x1F, 0x10, 0x1F,
244 0x00, 0x00, 0x00, 0x1F, 0x14,
245 0x00, 0x00, 0x00, 0xFC, 0x14,
246 0x00, 0x00, 0xF0, 0x10, 0xF0,
247 0x10, 0x10, 0xFF, 0x10, 0xFF,
248 0x14, 0x14, 0x14, 0xFF, 0x14,
249 0x10, 0x10, 0x10, 0x1F, 0x00,
250 0x00, 0x00, 0x00, 0xF0, 0x10,
251 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
252 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
253 0xFF, 0xFF, 0xFF, 0x00, 0x00,
254 0x00, 0x00, 0x00, 0xFF, 0xFF,
255 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
256 0x38, 0x44, 0x44, 0x38, 0x44,
257 0x7C, 0x2A, 0x2A, 0x3E, 0x14,
258 0x7E, 0x02, 0x02, 0x06, 0x06,
259 0x02, 0x7E, 0x02, 0x7E, 0x02,
260 0x63, 0x55, 0x49, 0x41, 0x63,
261 0x38, 0x44, 0x44, 0x3C, 0x04,
262 0x40, 0x7E, 0x20, 0x1E, 0x20,
263 0x06, 0x02, 0x7E, 0x02, 0x02,
264 0x99, 0xA5, 0xE7, 0xA5, 0x99,
265 0x1C, 0x2A, 0x49, 0x2A, 0x1C,
266 0x4C, 0x72, 0x01, 0x72, 0x4C,
267 0x30, 0x4A, 0x4D, 0x4D, 0x30,
268 0x30, 0x48, 0x78, 0x48, 0x30,
269 0xBC, 0x62, 0x5A, 0x46, 0x3D,
270 0x3E, 0x49, 0x49, 0x49, 0x00,
271 0x7E, 0x01, 0x01, 0x01, 0x7E,
272 0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
273 0x44, 0x44, 0x5F, 0x44, 0x44,
274 0x40, 0x51, 0x4A, 0x44, 0x40,
275 0x40, 0x44, 0x4A, 0x51, 0x40,
276 0x00, 0x00, 0xFF, 0x01, 0x03,
277 0xE0, 0x80, 0xFF, 0x00, 0x00,
278 0x08, 0x08, 0x6B, 0x6B, 0x08,
279 0x36, 0x12, 0x36, 0x24, 0x36,
280 0x06, 0x0F, 0x09, 0x0F, 0x06,
281 0x00, 0x00, 0x18, 0x18, 0x00,
282 0x00, 0x00, 0x10, 0x10, 0x00,
283 0x30, 0x40, 0xFF, 0x01, 0x01,
284 0x00, 0x1F, 0x01, 0x01, 0x1E,
285 0x00, 0x19, 0x1D, 0x17, 0x12,
286 0x00, 0x3C, 0x3C, 0x3C, 0x3C,
287 0x00, 0x00, 0x00, 0x00, 0x00
288};
diff --git a/drivers/qwiic/util/font8x16.h b/drivers/qwiic/util/font8x16.h
new file mode 100644
index 000000000..c070e4ec8
--- /dev/null
+++ b/drivers/qwiic/util/font8x16.h
@@ -0,0 +1,127 @@
1/******************************************************************************
2font8x16.h
3Definition for medium font
4
5This file was imported from the MicroView library, written by GeekAmmo
6(https://github.com/geekammo/MicroView-Arduino-Library), and released under
7the terms of the GNU General Public License as published by the Free Software
8Foundation, either version 3 of the License, or (at your option) any later
9version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19Modified by:
20Emil Varughese @ Edwin Robotics Pvt. Ltd.
21July 27, 2015
22https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
23******************************************************************************/
24#pragma once
25
26#include "progmem.h"
27
28static const unsigned char font8x16[] PROGMEM = {
29 // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)
30 8,16,32,96,2,56,
31 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00,
32 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xBE, 0x90, 0xD0, 0xBE, 0x90, 0x00,
33 0x00, 0x1C, 0x62, 0xFF, 0xC2, 0x80, 0x00, 0x00, 0x0C, 0x12, 0x92, 0x4C, 0xB0, 0x88, 0x06, 0x00,
34 0x80, 0x7C, 0x62, 0xB2, 0x1C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x00, 0x00,
35 0x00, 0xE0, 0x18, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x18, 0xE0, 0x00, 0x00,
36 0x00, 0x24, 0x18, 0x7E, 0x18, 0x24, 0x00, 0x00, 0x80, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x00,
37 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
38 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x18, 0x06, 0x00, 0x00,
39 0xF8, 0x04, 0xC2, 0x32, 0x0C, 0xF8, 0x00, 0x00, 0x00, 0x04, 0x04, 0xFE, 0x00, 0x00, 0x00, 0x00,
40 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00,
41 0xC0, 0xA0, 0x98, 0x84, 0xFE, 0x80, 0x80, 0x00, 0x00, 0x1E, 0x12, 0x12, 0x22, 0xC2, 0x00, 0x00,
42 0xF8, 0x44, 0x22, 0x22, 0x22, 0xC0, 0x00, 0x00, 0x00, 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00,
43 0x00, 0x8C, 0x52, 0x22, 0x52, 0x8C, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x26, 0xF8, 0x00, 0x00,
44 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
45 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
46 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00,
47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
49 0x00, 0x04, 0x04, 0x0F, 0x04, 0x03, 0x00, 0x00, 0x04, 0x02, 0x01, 0x03, 0x04, 0x04, 0x03, 0x00,
50 0x03, 0x04, 0x04, 0x04, 0x05, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51 0x00, 0x03, 0x06, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x06, 0x03, 0x00, 0x00,
52 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
55 0x01, 0x03, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00,
56 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
58 0x01, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00,
60 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x04, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
62 0x04, 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
63 0xF8, 0x04, 0x72, 0x8A, 0xFA, 0x84, 0x78, 0x00, 0x00, 0xC0, 0x38, 0x06, 0x38, 0xC0, 0x00, 0x00,
64 0x00, 0xFE, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00,
65 0xFE, 0x02, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00,
66 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x22, 0xE2, 0x00, 0x00,
67 0xFE, 0x20, 0x20, 0x20, 0x20, 0xFE, 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x00, 0x00,
68 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0xFE, 0x40, 0xB0, 0x08, 0x04, 0x02, 0x00, 0x00,
69 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0C, 0x70, 0x80, 0x70, 0x0C, 0xFE, 0x00,
70 0xFE, 0x0C, 0x30, 0xC0, 0x00, 0xFE, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00,
71 0xFE, 0x42, 0x42, 0x42, 0x22, 0x1C, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00,
72 0x00, 0xFE, 0x42, 0x42, 0xA2, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x42, 0x42, 0x80, 0x00, 0x00,
73 0x02, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x02, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00,
74 0x06, 0x38, 0xC0, 0x00, 0xC0, 0x38, 0x06, 0x00, 0x3E, 0xC0, 0xF0, 0x0E, 0xF0, 0xC0, 0x3E, 0x00,
75 0x00, 0x06, 0x98, 0x60, 0x98, 0x06, 0x00, 0x00, 0x00, 0x06, 0x18, 0xE0, 0x18, 0x06, 0x00, 0x00,
76 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x02, 0x02, 0x02, 0x02, 0x00,
77 0x00, 0x06, 0x18, 0x60, 0x80, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00,
78 0x40, 0x30, 0x0C, 0x0C, 0x30, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79 0x01, 0x02, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x06, 0x00,
80 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
81 0x07, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
82 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00,
83 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00,
84 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00,
85 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x00,
86 0x07, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00,
87 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0C, 0x12, 0x11, 0x10, 0x00,
88 0x00, 0x07, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
89 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
90 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
91 0x00, 0x06, 0x01, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
92 0x06, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x00,
93 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00,
94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
95 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00,
96 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
97 0x00, 0xE0, 0x10, 0x10, 0x10, 0xFE, 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00,
98 0x00, 0x20, 0xFC, 0x22, 0x22, 0x22, 0x02, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00,
99 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00,
100 0x00, 0x10, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00,
101 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x10, 0xF0, 0x20, 0x10, 0xF0, 0x00,
102 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00,
103 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00,
104 0x00, 0xF0, 0x20, 0x10, 0x10, 0x70, 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x20, 0x00, 0x00,
105 0x00, 0x20, 0x20, 0xFC, 0x20, 0x20, 0x20, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00,
106 0x00, 0x70, 0x80, 0x00, 0x80, 0x70, 0x00, 0x00, 0xF0, 0x00, 0xC0, 0x30, 0xC0, 0x00, 0xF0, 0x00,
107 0x00, 0x30, 0xC0, 0xC0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0xC0, 0x00, 0x80, 0x70, 0x00, 0x00,
108 0x00, 0x10, 0x10, 0x90, 0x50, 0x30, 0x00, 0x00, 0x00, 0x80, 0x80, 0x7E, 0x02, 0x02, 0x00, 0x00,
109 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x7E, 0x80, 0x80, 0x00, 0x00,
110 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
111 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00,
112 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
113 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
114 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x24, 0x24, 0x22, 0x1F, 0x00, 0x00,
115 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x00,
116 0x20, 0x20, 0x20, 0x20, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00,
117 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00,
118 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
119 0x00, 0x3F, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x3F, 0x00, 0x00,
120 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
121 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00,
122 0x00, 0x00, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x01, 0x06, 0x01, 0x00,
123 0x00, 0x06, 0x01, 0x01, 0x06, 0x00, 0x00, 0x00, 0x20, 0x20, 0x31, 0x0E, 0x03, 0x00, 0x00, 0x00,
124 0x00, 0x06, 0x05, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x00, 0x00,
125 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00,
126 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
127};