Added some semblance of support for the TTGO TS v1.2 board with ST7735-based colour LCD

This commit is contained in:
Maff 2018-07-19 00:48:37 +01:00
parent d90504c205
commit 7b84dae7ce
4 changed files with 498 additions and 61 deletions

3
.gitmodules vendored
View File

@ -7,3 +7,6 @@
[submodule "support/ws-epaper"] [submodule "support/ws-epaper"]
path = support/ws-epaper path = support/ws-epaper
url = https://github.com/mcauser/micropython-waveshare-epaper url = https://github.com/mcauser/micropython-waveshare-epaper
[submodule "support/lcd-st7735"]
path = support/lcd-st7735
url = https://github.com/boochow/MicroPython-ST7735

468
fonts.py Normal file
View File

@ -0,0 +1,468 @@
class font:
width=0
height=0
fontdata = {}
class sys(font):
width=5
height=8
data = {"Width": 5, "Height": 8, "Start": 0, "End": 254, "Data": bytearray([
0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
0x18, 0x3C, 0x7E, 0x3C, 0x18,
0x1C, 0x57, 0x7D, 0x57, 0x1C,
0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
0x00, 0x18, 0x3C, 0x18, 0x00,
0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
0x00, 0x18, 0x24, 0x18, 0x00,
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
0x30, 0x48, 0x3A, 0x06, 0x0E,
0x26, 0x29, 0x79, 0x29, 0x26,
0x40, 0x7F, 0x05, 0x05, 0x07,
0x40, 0x7F, 0x05, 0x25, 0x3F,
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
0x14, 0x22, 0x7F, 0x22, 0x14,
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
0x06, 0x09, 0x7F, 0x01, 0x7F,
0x00, 0x66, 0x89, 0x95, 0x6A,
0x60, 0x60, 0x60, 0x60, 0x60,
0x94, 0xA2, 0xFF, 0xA2, 0x94,
0x08, 0x04, 0x7E, 0x04, 0x08,
0x10, 0x20, 0x7E, 0x20, 0x10,
0x08, 0x08, 0x2A, 0x1C, 0x08,
0x08, 0x1C, 0x2A, 0x08, 0x08,
0x1E, 0x10, 0x10, 0x10, 0x10,
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
0x30, 0x38, 0x3E, 0x38, 0x30,
0x06, 0x0E, 0x3E, 0x0E, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14,
0x24, 0x2A, 0x7F, 0x2A, 0x12,
0x23, 0x13, 0x08, 0x64, 0x62,
0x36, 0x49, 0x56, 0x20, 0x50,
0x00, 0x08, 0x07, 0x03, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00,
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x80, 0x70, 0x30, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x60, 0x60, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02,
0x3E, 0x51, 0x49, 0x45, 0x3E,
0x00, 0x42, 0x7F, 0x40, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46,
0x21, 0x41, 0x49, 0x4D, 0x33,
0x18, 0x14, 0x12, 0x7F, 0x10,
0x27, 0x45, 0x45, 0x45, 0x39,
0x3C, 0x4A, 0x49, 0x49, 0x31,
0x41, 0x21, 0x11, 0x09, 0x07,
0x36, 0x49, 0x49, 0x49, 0x36,
0x46, 0x49, 0x49, 0x29, 0x1E,
0x00, 0x00, 0x14, 0x00, 0x00,
0x00, 0x40, 0x34, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41,
0x14, 0x14, 0x14, 0x14, 0x14,
0x00, 0x41, 0x22, 0x14, 0x08,
0x02, 0x01, 0x59, 0x09, 0x06,
0x3E, 0x41, 0x5D, 0x59, 0x4E,
0x7C, 0x12, 0x11, 0x12, 0x7C,
0x7F, 0x49, 0x49, 0x49, 0x36,
0x3E, 0x41, 0x41, 0x41, 0x22,
0x7F, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x49, 0x49, 0x49, 0x41,
0x7F, 0x09, 0x09, 0x09, 0x01,
0x3E, 0x41, 0x41, 0x51, 0x73,
0x7F, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x41, 0x7F, 0x41, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01,
0x7F, 0x08, 0x14, 0x22, 0x41,
0x7F, 0x40, 0x40, 0x40, 0x40,
0x7F, 0x02, 0x1C, 0x02, 0x7F,
0x7F, 0x04, 0x08, 0x10, 0x7F,
0x3E, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x09, 0x09, 0x09, 0x06,
0x3E, 0x41, 0x51, 0x21, 0x5E,
0x7F, 0x09, 0x19, 0x29, 0x46,
0x26, 0x49, 0x49, 0x49, 0x32,
0x03, 0x01, 0x7F, 0x01, 0x03,
0x3F, 0x40, 0x40, 0x40, 0x3F,
0x1F, 0x20, 0x40, 0x20, 0x1F,
0x3F, 0x40, 0x38, 0x40, 0x3F,
0x63, 0x14, 0x08, 0x14, 0x63,
0x03, 0x04, 0x78, 0x04, 0x03,
0x61, 0x59, 0x49, 0x4D, 0x43,
0x00, 0x7F, 0x41, 0x41, 0x41,
0x02, 0x04, 0x08, 0x10, 0x20,
0x00, 0x41, 0x41, 0x41, 0x7F,
0x04, 0x02, 0x01, 0x02, 0x04,
0x40, 0x40, 0x40, 0x40, 0x40,
0x00, 0x03, 0x07, 0x08, 0x00,
0x20, 0x54, 0x54, 0x78, 0x40,
0x7F, 0x28, 0x44, 0x44, 0x38,
0x38, 0x44, 0x44, 0x44, 0x28,
0x38, 0x44, 0x44, 0x28, 0x7F,
0x38, 0x54, 0x54, 0x54, 0x18,
0x00, 0x08, 0x7E, 0x09, 0x02,
0x18, 0xA4, 0xA4, 0x9C, 0x78,
0x7F, 0x08, 0x04, 0x04, 0x78,
0x00, 0x44, 0x7D, 0x40, 0x00,
0x20, 0x40, 0x40, 0x3D, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78,
0x7C, 0x08, 0x04, 0x04, 0x78,
0x38, 0x44, 0x44, 0x44, 0x38,
0xFC, 0x18, 0x24, 0x24, 0x18,
0x18, 0x24, 0x24, 0x18, 0xFC,
0x7C, 0x08, 0x04, 0x04, 0x08,
0x48, 0x54, 0x54, 0x54, 0x24,
0x04, 0x04, 0x3F, 0x44, 0x24,
0x3C, 0x40, 0x40, 0x20, 0x7C,
0x1C, 0x20, 0x40, 0x20, 0x1C,
0x3C, 0x40, 0x30, 0x40, 0x3C,
0x44, 0x28, 0x10, 0x28, 0x44,
0x4C, 0x90, 0x90, 0x90, 0x7C,
0x44, 0x64, 0x54, 0x4C, 0x44,
0x00, 0x08, 0x36, 0x41, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00,
0x02, 0x01, 0x02, 0x04, 0x02,
0x3C, 0x26, 0x23, 0x26, 0x3C,
0x1E, 0xA1, 0xA1, 0x61, 0x12,
0x3A, 0x40, 0x40, 0x20, 0x7A,
0x38, 0x54, 0x54, 0x55, 0x59,
0x21, 0x55, 0x55, 0x79, 0x41,
0x21, 0x54, 0x54, 0x78, 0x41,
0x21, 0x55, 0x54, 0x78, 0x40,
0x20, 0x54, 0x55, 0x79, 0x40,
0x0C, 0x1E, 0x52, 0x72, 0x12,
0x39, 0x55, 0x55, 0x55, 0x59,
0x39, 0x54, 0x54, 0x54, 0x59,
0x39, 0x55, 0x54, 0x54, 0x58,
0x00, 0x00, 0x45, 0x7C, 0x41,
0x00, 0x02, 0x45, 0x7D, 0x42,
0x00, 0x01, 0x45, 0x7C, 0x40,
0xF0, 0x29, 0x24, 0x29, 0xF0,
0xF0, 0x28, 0x25, 0x28, 0xF0,
0x7C, 0x54, 0x55, 0x45, 0x00,
0x20, 0x54, 0x54, 0x7C, 0x54,
0x7C, 0x0A, 0x09, 0x7F, 0x49,
0x32, 0x49, 0x49, 0x49, 0x32,
0x32, 0x48, 0x48, 0x48, 0x32,
0x32, 0x4A, 0x48, 0x48, 0x30,
0x3A, 0x41, 0x41, 0x21, 0x7A,
0x3A, 0x42, 0x40, 0x20, 0x78,
0x00, 0x9D, 0xA0, 0xA0, 0x7D,
0x39, 0x44, 0x44, 0x44, 0x39,
0x3D, 0x40, 0x40, 0x40, 0x3D,
0x3C, 0x24, 0xFF, 0x24, 0x24,
0x48, 0x7E, 0x49, 0x43, 0x66,
0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
0xFF, 0x09, 0x29, 0xF6, 0x20,
0xC0, 0x88, 0x7E, 0x09, 0x03,
0x20, 0x54, 0x54, 0x79, 0x41,
0x00, 0x00, 0x44, 0x7D, 0x41,
0x30, 0x48, 0x48, 0x4A, 0x32,
0x38, 0x40, 0x40, 0x22, 0x7A,
0x00, 0x7A, 0x0A, 0x0A, 0x72,
0x7D, 0x0D, 0x19, 0x31, 0x7D,
0x26, 0x29, 0x29, 0x2F, 0x28,
0x26, 0x29, 0x29, 0x29, 0x26,
0x30, 0x48, 0x4D, 0x40, 0x20,
0x38, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x38,
0x2F, 0x10, 0xC8, 0xAC, 0xBA,
0x2F, 0x10, 0x28, 0x34, 0xFA,
0x00, 0x00, 0x7B, 0x00, 0x00,
0x08, 0x14, 0x2A, 0x14, 0x22,
0x22, 0x14, 0x2A, 0x14, 0x08,
0xAA, 0x00, 0x55, 0x00, 0xAA,
0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x00, 0x00, 0x00, 0xFF, 0x00,
0x10, 0x10, 0x10, 0xFF, 0x00,
0x14, 0x14, 0x14, 0xFF, 0x00,
0x10, 0x10, 0xFF, 0x00, 0xFF,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x14, 0x14, 0x14, 0xFC, 0x00,
0x14, 0x14, 0xF7, 0x00, 0xFF,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x14, 0x14, 0xF4, 0x04, 0xFC,
0x14, 0x14, 0x17, 0x10, 0x1F,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0x1F, 0x00,
0x10, 0x10, 0x10, 0xF0, 0x00,
0x00, 0x00, 0x00, 0x1F, 0x10,
0x10, 0x10, 0x10, 0x1F, 0x10,
0x10, 0x10, 0x10, 0xF0, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0xFF, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x14,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x1F, 0x10, 0x17,
0x00, 0x00, 0xFC, 0x04, 0xF4,
0x14, 0x14, 0x17, 0x10, 0x17,
0x14, 0x14, 0xF4, 0x04, 0xF4,
0x00, 0x00, 0xFF, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0xF7, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x17, 0x14,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0xF4, 0x14,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x00, 0x00, 0x1F, 0x10, 0x1F,
0x00, 0x00, 0x00, 0x1F, 0x14,
0x00, 0x00, 0x00, 0xFC, 0x14,
0x00, 0x00, 0xF0, 0x10, 0xF0,
0x10, 0x10, 0xFF, 0x10, 0xFF,
0x14, 0x14, 0x14, 0xFF, 0x14,
0x10, 0x10, 0x10, 0x1F, 0x00,
0x00, 0x00, 0x00, 0xF0, 0x10,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
0xFF, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x38, 0x44, 0x44, 0x38, 0x44,
0x7C, 0x2A, 0x2A, 0x3E, 0x14,
0x7E, 0x02, 0x02, 0x06, 0x06,
0x02, 0x7E, 0x02, 0x7E, 0x02,
0x63, 0x55, 0x49, 0x41, 0x63,
0x38, 0x44, 0x44, 0x3C, 0x04,
0x40, 0x7E, 0x20, 0x1E, 0x20,
0x06, 0x02, 0x7E, 0x02, 0x02,
0x99, 0xA5, 0xE7, 0xA5, 0x99,
0x1C, 0x2A, 0x49, 0x2A, 0x1C,
0x4C, 0x72, 0x01, 0x72, 0x4C,
0x30, 0x4A, 0x4D, 0x4D, 0x30,
0x30, 0x48, 0x78, 0x48, 0x30,
0xBC, 0x62, 0x5A, 0x46, 0x3D,
0x3E, 0x49, 0x49, 0x49, 0x00,
0x7E, 0x01, 0x01, 0x01, 0x7E,
0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
0x44, 0x44, 0x5F, 0x44, 0x44,
0x40, 0x51, 0x4A, 0x44, 0x40,
0x40, 0x44, 0x4A, 0x51, 0x40,
0x00, 0x00, 0xFF, 0x01, 0x03,
0xE0, 0x80, 0xFF, 0x00, 0x00,
0x08, 0x08, 0x6B, 0x6B, 0x08,
0x36, 0x12, 0x36, 0x24, 0x36,
0x06, 0x0F, 0x09, 0x0F, 0x06,
0x00, 0x00, 0x18, 0x18, 0x00,
0x00, 0x00, 0x10, 0x10, 0x00,
0x30, 0x40, 0xFF, 0x01, 0x01,
0x00, 0x1F, 0x01, 0x01, 0x1E,
0x00, 0x19, 0x1D, 0x17, 0x12,
0x00, 0x3C, 0x3C, 0x3C, 0x3C
])}
class serif(font):
width=6
height=8
data = {"Width": 6, "Height": 8, "Start": 32, "End": 127, "Data": bytearray([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x03, 0x00, 0x03, 0x00, 0x00, 0x00, #0x00,
0x12, 0x3F, 0x12, 0x3F, 0x12, 0x00, #0x00,
0x26, 0x7F, 0x32, 0x00, 0x00, 0x00, #0x00,
0x13, 0x0B, 0x34, 0x32, 0x00, 0x00, #0x00,
0x1A, 0x25, 0x1A, 0x28, 0x00, 0x00, #0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x7E, 0x81, 0x00, 0x00, 0x00, 0x00, #0x00,
0x81, 0x7E, 0x00, 0x00, 0x00, 0x00, #0x00,
0x06, 0x06, 0x00, 0x00, 0x00, 0x00, #0x00,
0x08, 0x1C, 0x08, 0x00, 0x00, 0x00, #0x00,
0x60, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x08, 0x08, 0x00, 0x00, 0x00, 0x00, #0x00,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x38, 0x07, 0x00, 0x00, 0x00, 0x00, #0x00,
0x1E, 0x21, 0x21, 0x1E, 0x00, 0x00, #0x00,
0x02, 0x3F, 0x00, 0x00, 0x00, 0x00, #0x00,
0x32, 0x29, 0x29, 0x36, 0x00, 0x00, #0x00,
0x12, 0x21, 0x25, 0x1A, 0x00, 0x00, #0x00,
0x18, 0x16, 0x3F, 0x10, 0x00, 0x00, #0x00,
0x27, 0x25, 0x19, 0x00, 0x00, 0x00, #0x00,
0x1E, 0x25, 0x25, 0x18, 0x00, 0x00, #0x00,
0x03, 0x39, 0x07, 0x00, 0x00, 0x00, #0x00,
0x1A, 0x25, 0x25, 0x1A, 0x00, 0x00, #0x00,
0x06, 0x29, 0x29, 0x1E, 0x00, 0x00, #0x00,
0x24, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x64, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x08, 0x14, 0x22, 0x00, 0x00, 0x00, #0x00,
0x14, 0x14, 0x14, 0x00, 0x00, 0x00, #0x00,
0x22, 0x14, 0x08, 0x00, 0x00, 0x00, #0x00,
0x02, 0x29, 0x05, 0x02, 0x00, 0x00, #0x00,
0x1C, 0x22, 0x49, 0x55, 0x59, 0x12, #0x0C,
0x30, 0x2C, 0x0B, 0x0B, 0x2C, 0x30, #0x00,
0x21, 0x3F, 0x25, 0x25, 0x1A, 0x00, #0x00,
0x1E, 0x21, 0x21, 0x21, 0x13, 0x00, #0x00,
0x21, 0x3F, 0x21, 0x21, 0x1E, 0x00, #0x00,
0x21, 0x3F, 0x25, 0x33, 0x00, 0x00, #0x00,
0x21, 0x3F, 0x25, 0x03, 0x00, 0x00, #0x00,
0x1E, 0x21, 0x21, 0x29, 0x3B, 0x00, #0x00,
0x3F, 0x04, 0x04, 0x3F, 0x00, 0x00, #0x00,
0x3F, 0x21, 0x00, 0x00, 0x00, 0x00, #0x00,
0x21, 0x1F, 0x01, 0x00, 0x00, 0x00, #0x00,
0x21, 0x3F, 0x0C, 0x33, 0x21, 0x00, #0x00,
0x3F, 0x21, 0x30, 0x00, 0x00, 0x00, #0x00,
0x21, 0x3F, 0x0C, 0x30, 0x0C, 0x3F, #0x21,
0x3F, 0x03, 0x0C, 0x3F, 0x01, 0x00, #0x00,
0x1E, 0x21, 0x21, 0x21, 0x1E, 0x00, #0x00,
0x3F, 0x29, 0x06, 0x00, 0x00, 0x00, #0x00,
0x1E, 0x21, 0x21, 0x61, 0x1E, 0x00, #0x00,
0x21, 0x3F, 0x09, 0x36, 0x00, 0x00, #0x00,
0x32, 0x25, 0x25, 0x1B, 0x00, 0x00, #0x00,
0x01, 0x3F, 0x01, 0x00, 0x00, 0x00, #0x00,
0x1F, 0x21, 0x20, 0x21, 0x1F, 0x00, #0x00,
0x03, 0x0D, 0x30, 0x30, 0x0D, 0x03, #0x00,
0x0F, 0x31, 0x0C, 0x0C, 0x31, 0x0F, #0x00,
0x21, 0x33, 0x0C, 0x0C, 0x33, 0x21, #0x00,
0x03, 0x24, 0x38, 0x24, 0x03, 0x01, #0x00,
0x29, 0x25, 0x33, 0x00, 0x00, 0x00, #0x00,
0x7F, 0x41, 0x00, 0x00, 0x00, 0x00, #0x00,
0x07, 0x38, 0x00, 0x00, 0x00, 0x00, #0x00,
0x41, 0x7F, 0x00, 0x00, 0x00, 0x00, #0x00,
0x02, 0x01, 0x02, 0x00, 0x00, 0x00, #0x00,
0x40, 0x40, 0x40, 0x40, 0x00, 0x00, #0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, #0x00,
0x14, 0x24, 0x38, 0x00, 0x00, 0x00, #0x00,
0x3F, 0x28, 0x24, 0x18, 0x00, 0x00, #0x00,
0x18, 0x24, 0x24, 0x00, 0x00, 0x00, #0x00,
0x18, 0x24, 0x25, 0x3F, 0x00, 0x00, #0x00,
0x18, 0x24, 0x28, 0x00, 0x00, 0x00, #0x00,
0x3E, 0x25, 0x00, 0x00, 0x00, 0x00, #0x00,
0x18, 0xA4, 0xA4, 0x7C, 0x00, 0x00, #0x00,
0x3F, 0x04, 0x38, 0x00, 0x00, 0x00, #0x00,
0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0xFD, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x3F, 0x18, 0x24, 0x00, 0x00, 0x00, #0x00,
0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x3C, 0x04, 0x38, 0x04, 0x38, 0x00, #0x00,
0x3C, 0x04, 0x38, 0x00, 0x00, 0x00, #0x00,
0x18, 0x24, 0x24, 0x18, 0x00, 0x00, #0x00,
0xFC, 0xA4, 0x24, 0x18, 0x00, 0x00, #0x00,
0x18, 0x24, 0xA4, 0xFC, 0x00, 0x00, #0x00,
0x3C, 0x04, 0x00, 0x00, 0x00, 0x00, #0x00,
0x28, 0x24, 0x14, 0x00, 0x00, 0x00, #0x00,
0x1E, 0x24, 0x00, 0x00, 0x00, 0x00, #0x00,
0x1C, 0x20, 0x3C, 0x00, 0x00, 0x00, #0x00,
0x0C, 0x30, 0x0C, 0x00, 0x00, 0x00, #0x00,
0x0C, 0x30, 0x0C, 0x30, 0x0C, 0x00, #0x00,
0x24, 0x18, 0x24, 0x00, 0x00, 0x00, #0x00,
0x9C, 0x60, 0x1C, 0x00, 0x00, 0x00, #0x00,
0x34, 0x24, 0x2C, 0x00, 0x00, 0x00, #0x00,
0x08, 0x77, 0x00, 0x00, 0x00, 0x00, #0x00,
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x77, 0x08, 0x00, 0x00, 0x00, 0x00, #0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, #0x00,
0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00
])}
class terminal(font):
width=6
height=8
data = {"Width": 6, "Height": 8, "Start": 32, "End": 127, "Data": bytearray([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x5F, 0x06, 0x00,
0x00, 0x07, 0x03, 0x00, 0x07, 0x03,
0x00, 0x24, 0x7E, 0x24, 0x7E, 0x24,
0x00, 0x24, 0x2B, 0x6A, 0x12, 0x00,
0x00, 0x63, 0x13, 0x08, 0x64, 0x63,
0x00, 0x36, 0x49, 0x56, 0x20, 0x50,
0x00, 0x00, 0x07, 0x03, 0x00, 0x00,
0x00, 0x00, 0x3E, 0x41, 0x00, 0x00,
0x00, 0x00, 0x41, 0x3E, 0x00, 0x00,
0x00, 0x08, 0x3E, 0x1C, 0x3E, 0x08,
0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x00, 0xE0, 0x60, 0x00, 0x00,
0x00, 0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
0x00, 0x20, 0x10, 0x08, 0x04, 0x02,
0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,
0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,
0x00, 0x62, 0x51, 0x49, 0x49, 0x46,
0x00, 0x22, 0x49, 0x49, 0x49, 0x36,
0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,
0x00, 0x2F, 0x49, 0x49, 0x49, 0x31,
0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,
0x00, 0x01, 0x71, 0x09, 0x05, 0x03,
0x00, 0x36, 0x49, 0x49, 0x49, 0x36,
0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,
0x00, 0x00, 0x6C, 0x6C, 0x00, 0x00,
0x00, 0x00, 0xEC, 0x6C, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
0x00, 0x24, 0x24, 0x24, 0x24, 0x24,
0x00, 0x00, 0x41, 0x22, 0x14, 0x08,
0x00, 0x02, 0x01, 0x59, 0x09, 0x06,
0x00, 0x3E, 0x41, 0x5D, 0x55, 0x1E,
0x00, 0x7E, 0x11, 0x11, 0x11, 0x7E,
0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,
0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,
0x00, 0x7F, 0x41, 0x41, 0x41, 0x3E,
0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,
0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,
0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,
0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,
0x00, 0x30, 0x40, 0x40, 0x40, 0x3F,
0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,
0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,
0x00, 0x7F, 0x02, 0x04, 0x02, 0x7F,
0x00, 0x7F, 0x02, 0x04, 0x08, 0x7F,
0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,
0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,
0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,
0x00, 0x7F, 0x09, 0x09, 0x19, 0x66,
0x00, 0x26, 0x49, 0x49, 0x49, 0x32,
0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,
0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,
0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,
0x00, 0x3F, 0x40, 0x3C, 0x40, 0x3F,
0x00, 0x63, 0x14, 0x08, 0x14, 0x63,
0x00, 0x07, 0x08, 0x70, 0x08, 0x07,
0x00, 0x71, 0x49, 0x45, 0x43, 0x00,
0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,
0x00, 0x02, 0x04, 0x08, 0x10, 0x20,
0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,
0x00, 0x04, 0x02, 0x01, 0x02, 0x04,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x00, 0x00, 0x03, 0x07, 0x00, 0x00,
0x00, 0x20, 0x54, 0x54, 0x54, 0x78,
0x00, 0x7F, 0x44, 0x44, 0x44, 0x38,
0x00, 0x38, 0x44, 0x44, 0x44, 0x28,
0x00, 0x38, 0x44, 0x44, 0x44, 0x7F,
0x00, 0x38, 0x54, 0x54, 0x54, 0x08,
0x00, 0x08, 0x7E, 0x09, 0x09, 0x00,
0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,
0x00, 0x7F, 0x04, 0x04, 0x78, 0x00,
0x00, 0x00, 0x00, 0x7D, 0x40, 0x00,
0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,
0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,
0x00, 0x00, 0x00, 0x7F, 0x40, 0x00,
0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,
0x00, 0x7C, 0x04, 0x04, 0x78, 0x00,
0x00, 0x38, 0x44, 0x44, 0x44, 0x38,
0x00, 0xFC, 0x44, 0x44, 0x44, 0x38,
0x00, 0x38, 0x44, 0x44, 0x44, 0xFC,
0x00, 0x44, 0x78, 0x44, 0x04, 0x08,
0x00, 0x08, 0x54, 0x54, 0x54, 0x20,
0x00, 0x04, 0x3E, 0x44, 0x24, 0x00,
0x00, 0x3C, 0x40, 0x20, 0x7C, 0x00,
0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,
0x00, 0x3C, 0x60, 0x30, 0x60, 0x3C,
0x00, 0x6C, 0x10, 0x10, 0x6C, 0x00,
0x00, 0x9C, 0xA0, 0x60, 0x3C, 0x00,
0x00, 0x64, 0x54, 0x54, 0x4C, 0x00,
0x00, 0x08, 0x3E, 0x41, 0x41, 0x00,
0x00, 0x00, 0x00, 0x77, 0x00, 0x00,
0x00, 0x00, 0x41, 0x41, 0x3E, 0x08,
0x00, 0x02, 0x01, 0x02, 0x01, 0x00,
0x00, 0x3C, 0x26, 0x23, 0x26, 0x3C
])}

87
main.py
View File

@ -9,67 +9,32 @@ init_sample.PrintHWInfo(hw)
# Main app # Main app
from machine import Pin, TouchPad, SPI from machine import Pin, TouchPad, SPI
import framebuf
from epaper1in54b import EPD
#confusingly, a 1 (interpreted in the display as 0xff) is the "off" state for the pixel #from uPaper import epaper, fbuf
#whereas a 0 is the "on" state from ST7735 import TFT
c_blank=1
c_filled=0
#our display is a 200x200 display
d_w=200
d_h=200
#set up framebuffers and backing buffers
#because we have a display with three colours (red, white, black), this is presented logically
#as two separate monochrome "frames" of equal size
#so when rendering, the display_frame function will take as many frames as there are non-white colours
#this could be used for easy inversion by just swapping the order of arguments to display_frame(buf,buf)
#some documentation suggests that framebuffer should be initialised directly
#using FrameBuffer(bytearray(size..))
#however this causes problems when trying to use the fb as a buffer
#because it is not "subscriptable"
#thus the underlying buffer MUST be separated, as it cannot be directly read from inside the fb
fb_buffer_black=bytearray(d_w*d_h//8)
fb_buffer_red=bytearray(d_w*d_h//8)
fb_black=framebuf.FrameBuffer(fb_buffer_black,d_w,d_h,framebuf.MONO_HLSB)
fb_red=framebuf.FrameBuffer(fb_buffer_red,d_w,d_h,framebuf.MONO_HLSB)
fb_black.fill(c_blank)
fb_red.fill(c_blank)
#SPI is one of the more poorly documented parts of the micropython esp32 port
#i wish i could make this prettier
spi_mosi=Pin(23)
spi_miso=Pin(19)
spi_sck=Pin(18)
spi_cs=Pin(2)
spi_dc=Pin(4)
spi_rst=Pin(0)
spi_busy=Pin(15)
#set up SPI, then set up the ePaper display
#i'm using a WaveShare ePaper SPI 1.54in. display model (B) with a third colour (red)
#this example code will work identically for the model (C) with yellow as its third colour
#but is easily adaptable for other waveshare displays
spi=SPI(2,baudrate=200000,polarity=0,phase=0,mosi=spi_mosi,miso=spi_miso,sck=spi_sck)
epd=EPD(spi,cs=spi_cs,dc=spi_dc,rst=spi_rst,busy=spi_busy)
#only needs to be run once upon startup, unless the display is placed into low-power mode
#using epd.sleep(), then you need to run either epd.init() or epd.reset()
epd.init()
#helper function
def updatedisplay():
epd.display_frame(fb_buffer_black,fb_buffer_red)
updatedisplay()
from time import sleep_ms from time import sleep_ms
sleep_ms(1000)
ln=0
while ln<200:
fb_black.text("what's up i'm sleepy",5,ln,c_filled)
ln+=10
fb_red.text("what's up i'm sleepy",5,ln,c_filled)
ln+=10
updatedisplay() tft_spibus=2
tft_mosi=Pin(23)
tft_sck=Pin(5)
tft_dc=17
tft_rst=12
tft_cs=16
spi=SPI(tft_spibus,baudrate=20000000,polarity=0,phase=0,mosi=tft_mosi,sck=tft_sck)
tft=TFT(spi,tft_dc,tft_rst,tft_cs)
tft.on()
tft.initg()
tft.initb()
tft.rgb(True)
tft.initr()
sleep_ms(200)
tft.fill(tft.RED)
sleep_ms(40)
tft.fill(tft.BLUE)
sleep_ms(40)
tft.fill(tft.GREEN)
sleep_ms(40)
tft.fill(tft.PURPLE)
sleep_ms(40)
tft.fill(tft.WHITE)

1
support/lcd-st7735 Submodule

@ -0,0 +1 @@
Subproject commit 0798c249f521f6fcfae31c7cd513437640d60890