Sorry bit much. Major rewrite of the 88MZ100 firmware, now with compression support. Added beta M2 2.7" (sleep current needs work) and 1.6"(200px). Probably broke M3 building, it's font files have moved to a new 'common' directory

This commit is contained in:
jjwbruijn
2024-01-28 11:08:42 +01:00
parent c2ab7d6057
commit e563358370
147 changed files with 7375 additions and 1785 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "ARM_Tag_FW/common/uzlib"]
path = ARM_Tag_FW/common/uzlib
url = https://github.com/pfalcon/uzlib.git

View File

@@ -1,98 +0,0 @@
const char font[256][40]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x20
{0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x21
{0x00,0x00,0xC0,0x18,0xC0,0x18,0xC0,0x18,0xC0,0x18,0xC0,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x22
{0x00,0x00,0x00,0x00,0x00,0x22,0x00,0x22,0x00,0x11,0x00,0x11,0x00,0x11,0xE0,0xFF,0x80,0x08,0x80,0x08,0x80,0x08,0xE0,0x7F,0x40,0x04,0x40,0x04,0x20,0x02,0x20,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x23
{0x00,0x00,0x00,0x04,0x00,0x1F,0x80,0x3F,0xC0,0x24,0xC0,0x04,0xC0,0x04,0x80,0x07,0x00,0x07,0x00,0x1C,0x00,0x1C,0x00,0x34,0x00,0x34,0x40,0x34,0xC0,0x1F,0x80,0x0F,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x24
{0x00,0x00,0x00,0x00,0xE0,0x81,0x30,0x43,0x30,0x23,0x30,0x13,0x30,0x0B,0x30,0x0B,0xE0,0x05,0x00,0x7A,0x00,0xCD,0x00,0xCD,0x80,0xCC,0x40,0xCC,0x20,0xCC,0x10,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x25
{0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x1F,0x80,0x19,0x80,0x19,0x80,0x0D,0x00,0x07,0xC0,0x03,0x60,0xC6,0x30,0xCE,0x30,0xCC,0x30,0x78,0x70,0x78,0xE0,0x7F,0xC0,0xEF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x26
{0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x27
{0x00,0x00,0x00,0x30,0x00,0x3C,0x00,0x0E,0x00,0x06,0x00,0x03,0x00,0x03,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0E,0x00,0x3C,0x00,0x30,0x00,0x00}, // 0x28
{0x00,0x00,0xC0,0x00,0xC0,0x03,0x00,0x07,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x07,0xC0,0x03,0xC0,0x00,0x00,0x00}, // 0x29
{0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x60,0x33,0xE0,0x3C,0x00,0x00,0x80,0x0D,0xC0,0x19,0x80,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x2A
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0xE0,0x7F,0xE0,0x7F,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x2B
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x06,0x00,0x02,0x00,0x03,0x00,0x00}, // 0x2C
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x3F,0xC0,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x2D
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x2E
{0x00,0x00,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x80,0x01,0x80,0x01,0x80,0x01,0xC0,0x00,0xC0,0x00,0x60,0x00,0x00,0x00}, // 0x2F
{0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x1F,0xC0,0x30,0xC0,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xC0,0x30,0xC0,0x30,0x80,0x1F,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x30
{0x00,0x00,0x00,0x00,0x00,0x06,0xC0,0x07,0x60,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0xE0,0x7F,0xE0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x31
{0x00,0x00,0x00,0x00,0x80,0x0F,0xC0,0x1F,0x40,0x38,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x0C,0x00,0x06,0x00,0x03,0x80,0x01,0xC0,0x00,0xC0,0x3F,0xC0,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x32
{0x00,0x00,0x00,0x00,0x80,0x0F,0xC0,0x3F,0x40,0x30,0x00,0x30,0x00,0x18,0x80,0x0F,0x80,0x0F,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x30,0x40,0x38,0xC0,0x1F,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x33
{0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x1C,0x00,0x1E,0x00,0x1A,0x00,0x19,0x80,0x19,0xC0,0x18,0x40,0x18,0xE0,0x7F,0xE0,0x7F,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x34
{0x00,0x00,0x00,0x00,0x80,0x3F,0x80,0x3F,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x0F,0x80,0x1F,0x00,0x38,0x00,0x30,0x00,0x30,0x00,0x38,0x80,0x1F,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x35
{0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x1F,0xC0,0x11,0xC0,0x00,0x60,0x00,0x60,0x0E,0x60,0x1F,0xE0,0x38,0x60,0x30,0x60,0x30,0x60,0x30,0xC0,0x38,0xC0,0x1F,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x36
{0x00,0x00,0x00,0x00,0xC0,0x7F,0xC0,0x7F,0x00,0x60,0x00,0x30,0x00,0x10,0x00,0x18,0x00,0x0C,0x00,0x04,0x00,0x06,0x00,0x02,0x00,0x03,0x00,0x03,0x80,0x01,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x37
{0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x1F,0xC0,0x18,0xC0,0x18,0xC0,0x19,0x80,0x0F,0x00,0x07,0xC0,0x1E,0x60,0x38,0x60,0x30,0x60,0x30,0xE0,0x38,0xC0,0x1F,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x38
{0x00,0x00,0x00,0x00,0x80,0x07,0xC0,0x1F,0xE0,0x18,0x60,0x30,0x60,0x30,0x60,0x30,0xE0,0x38,0xC0,0x37,0x80,0x33,0x00,0x30,0x00,0x18,0x40,0x1C,0xC0,0x0F,0x80,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x39
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x3A
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x06,0x00,0x02,0x00,0x03,0x00,0x00}, // 0x3B
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x70,0x00,0x3C,0x00,0x0E,0x80,0x03,0xE0,0x00,0x80,0x03,0x00,0x0E,0x00,0x3C,0x00,0x70,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x3C
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x7F,0xE0,0x7F,0x00,0x00,0x00,0x00,0xE0,0x7F,0xE0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x3D
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0xE0,0x00,0xC0,0x03,0x00,0x07,0x00,0x1C,0x00,0x70,0x00,0x1C,0x00,0x07,0xC0,0x03,0xE0,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x3E
{0x00,0x00,0x00,0x00,0xE0,0x0F,0xE0,0x3F,0x20,0x38,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x0C,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x3F
{0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0xC0,0x60,0x60,0x7C,0x30,0x66,0x30,0x63,0x30,0x63,0x30,0x73,0x30,0x73,0x30,0x6F,0x60,0xE6,0x60,0x00,0xC0,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x40
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0F,0x00,0x0F,0x00,0x0D,0x80,0x19,0x80,0x19,0xC0,0x38,0xC0,0x30,0xC0,0x3F,0xE0,0x7F,0x60,0x60,0x60,0x60,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x41
{0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0xE0,0x1F,0x60,0x18,0x60,0x18,0x60,0x0C,0xE0,0x07,0xE0,0x0F,0x60,0x18,0x60,0x30,0x60,0x30,0x60,0x30,0xE0,0x1F,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x42
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x80,0x7F,0xC0,0x41,0xC0,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0xC0,0x00,0xC0,0x43,0x80,0x7F,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x43
{0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0xE0,0x1F,0x60,0x38,0x60,0x70,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x60,0x38,0xE0,0x1F,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x44
{0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x7F,0xC0,0x7F,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x3F,0xC0,0x3F,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x7F,0xC0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x45
{0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x7F,0xC0,0x7F,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x3F,0xC0,0x3F,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x46
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x80,0x7F,0xC0,0x41,0xC0,0x00,0x60,0x00,0x60,0x00,0x60,0x78,0x60,0x78,0x60,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x47
{0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0xE0,0x3F,0xE0,0x3F,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x48
{0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0xE0,0x1F,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0xE0,0x1F,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x49
{0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1F,0x80,0x1F,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1C,0xC0,0x0F,0xC0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x4A
{0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x70,0x60,0x38,0x60,0x1C,0x60,0x0E,0x60,0x06,0x60,0x03,0xE0,0x03,0x60,0x07,0x60,0x0E,0x60,0x1C,0x60,0x38,0x60,0x70,0x60,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x4B
{0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x7F,0xC0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x4C
{0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x70,0x70,0x70,0xF0,0x78,0xB0,0x68,0xB0,0x68,0xB0,0x6D,0x30,0x65,0x30,0x65,0x30,0x67,0x30,0x62,0x30,0x60,0x30,0x60,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x4D
{0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x60,0xE0,0x60,0xE0,0x61,0xE0,0x61,0x60,0x63,0x60,0x67,0x60,0x66,0x60,0x6E,0x60,0x6C,0x60,0x78,0x60,0x78,0x60,0x70,0x60,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x4E
{0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0F,0xC0,0x1F,0xE0,0x38,0x70,0x70,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x70,0x70,0xE0,0x38,0xC0,0x1F,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x4F
{0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x1F,0xC0,0x3F,0xC0,0x70,0xC0,0x60,0xC0,0x60,0xC0,0x70,0xC0,0x3F,0xC0,0x0F,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x50
{0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0F,0xC0,0x1F,0xE0,0x38,0x70,0x70,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x60,0x30,0xE0,0x38,0xC0,0x1F,0x80,0x0F,0x00,0x38,0x00,0xF0,0x00,0x40,0x00,0x00}, // 0x51
{0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x07,0xE0,0x1F,0x60,0x18,0x60,0x18,0x60,0x18,0x60,0x1C,0xE0,0x0F,0xE0,0x07,0x60,0x0E,0x60,0x1C,0x60,0x38,0x60,0x70,0x60,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x52
{0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0F,0xC0,0x1F,0x60,0x10,0x60,0x00,0xE0,0x00,0xC0,0x03,0x80,0x0F,0x00,0x3C,0x00,0x30,0x00,0x30,0x60,0x38,0xE0,0x1F,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x53
{0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xF0,0xFF,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x54
{0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0xE0,0x38,0xC0,0x1F,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x55
{0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0x60,0x60,0x60,0x60,0xE0,0x60,0xC0,0x30,0xC0,0x30,0xC0,0x31,0x80,0x19,0x80,0x1B,0x00,0x0B,0x00,0x0F,0x00,0x0F,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x56
{0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xC0,0x30,0xC0,0x30,0xC0,0x20,0x46,0x20,0x46,0x20,0x6E,0x60,0x6F,0x60,0x69,0x60,0x69,0x60,0x39,0xC0,0x39,0xC0,0x39,0xC0,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x57
{0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xE0,0xE0,0x60,0xC0,0x30,0x80,0x19,0x80,0x0F,0x00,0x0F,0x00,0x06,0x00,0x0F,0x80,0x1D,0x80,0x19,0xC0,0x30,0x60,0x70,0x30,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x58
{0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0x60,0x60,0xC0,0x30,0xC0,0x31,0x80,0x19,0x00,0x0F,0x00,0x0F,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x59
{0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x7F,0xE0,0x7F,0x00,0x60,0x00,0x30,0x00,0x18,0x00,0x0C,0x00,0x06,0x00,0x03,0x80,0x01,0xC0,0x00,0x60,0x00,0xE0,0x7F,0xE0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x5A
{0x00,0x00,0x00,0x3F,0x00,0x3F,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x3F,0x00,0x3F,0x00,0x00}, // 0x5B
{0x00,0x00,0x60,0x00,0xC0,0x00,0xC0,0x00,0x80,0x01,0x80,0x01,0x80,0x01,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x00}, // 0x5C
{0x00,0x00,0xC0,0x0F,0xC0,0x0F,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0xC0,0x0F,0xC0,0x0F,0x00,0x00}, // 0x5D
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x0E,0x00,0x0A,0x00,0x0B,0x00,0x1B,0x80,0x11,0x80,0x31,0xC0,0x30,0xC0,0x20,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x5E
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xF0,0xFF,0x00,0x00,0x00,0x00}, // 0x5F
{0x00,0x06,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x60
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1F,0xC0,0x3F,0x40,0x30,0x00,0x30,0x00,0x30,0x80,0x3F,0xC0,0x30,0x60,0x30,0x60,0x38,0xE0,0xFF,0xC0,0xE7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x61
{0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x0E,0x60,0x1F,0xE0,0x39,0xE0,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0xE0,0x18,0xE0,0x1F,0x60,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x62
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xC0,0x3F,0xC0,0x21,0xE0,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0xE0,0x00,0xC0,0x01,0xC0,0x3F,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x63
{0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x30,0x80,0x37,0xC0,0x3F,0xC0,0x38,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0xE0,0x38,0xC0,0x3F,0x80,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x64
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x1F,0xC0,0x38,0x60,0x30,0xE0,0x3F,0xE0,0x3F,0x60,0x00,0x60,0x00,0xC0,0x20,0xC0,0x3F,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x65
{0x00,0x00,0x00,0x7E,0x00,0x7F,0x00,0x03,0x00,0x03,0xE0,0x7F,0xE0,0x7F,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x66
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x37,0xC0,0x3F,0xC0,0x38,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0xE0,0x38,0xC0,0x3F,0x80,0x37,0x00,0x30,0x40,0x38,0xC0,0x1F,0x80,0x0F}, // 0x67
{0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x1E,0x60,0x3F,0xE0,0x31,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x68
{0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0xC0,0x0F,0xC0,0x0F,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x69
{0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x80,0x1F,0x80,0x1F,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1C,0xC0,0x0F,0xC0,0x07}, // 0x6A
{0x00,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x70,0xC0,0x38,0xC0,0x1C,0xC0,0x0E,0xC0,0x06,0xC0,0x07,0xC0,0x0E,0xC0,0x1C,0xC0,0x38,0xC0,0x70,0xC0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x6B
{0x00,0x00,0xC0,0x0F,0xC0,0x0F,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x6C
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB0,0x39,0xF0,0x7F,0x70,0x67,0x30,0x63,0x30,0x63,0x30,0x63,0x30,0x63,0x30,0x63,0x30,0x63,0x30,0x63,0x30,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x6D
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x1E,0x60,0x3F,0xE0,0x31,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x6E
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x3F,0xC0,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xC0,0x30,0xC0,0x3F,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x6F
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x0F,0xE0,0x1F,0xE0,0x38,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0xE0,0x18,0xE0,0x1F,0x60,0x0F,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00}, // 0x70
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x37,0xC0,0x3F,0xC0,0x38,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0xE0,0x38,0xC0,0x37,0x80,0x33,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x30}, // 0x71
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x3C,0xC0,0x3E,0xC0,0x23,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x72
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1F,0xC0,0x1F,0xC0,0x00,0xC0,0x00,0xC0,0x03,0x00,0x1F,0x00,0x38,0x00,0x30,0x40,0x30,0xC0,0x1F,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x73
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0xE0,0x7F,0xE0,0x7F,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x7F,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x74
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x3C,0xE0,0x37,0xC0,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x75
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0,0x20,0xC0,0x30,0xC0,0x30,0x80,0x11,0x80,0x19,0x80,0x19,0x00,0x0B,0x00,0x0F,0x00,0x0F,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x76
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xC0,0x30,0xC6,0x30,0xC6,0x20,0x4E,0x60,0x4F,0x60,0x49,0x60,0x69,0x60,0x79,0xC0,0x39,0xC0,0x30,0xC0,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x77
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x70,0xC0,0x30,0x80,0x19,0x80,0x0B,0x00,0x0F,0x00,0x06,0x00,0x0F,0x80,0x1D,0x80,0x19,0xC0,0x30,0x60,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x78
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0,0x20,0xC0,0x30,0xC0,0x31,0x80,0x19,0x80,0x19,0x00,0x0B,0x00,0x0F,0x00,0x0F,0x00,0x06,0x00,0x06,0x00,0x02,0x00,0x03,0xC0,0x03,0xC0,0x01}, // 0x79
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x3F,0xE0,0x3F,0x00,0x30,0x00,0x18,0x00,0x0C,0x00,0x06,0x00,0x03,0x80,0x01,0xC0,0x00,0xE0,0x3F,0xE0,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x7A
{0x00,0x00,0x00,0x3C,0x00,0x3E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0xC0,0x03,0xC0,0x03,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3E,0x00,0x3C,0x00,0x00}, // 0x7B
{0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00}, // 0x7C
{0x00,0x00,0xC0,0x03,0xC0,0x07,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3C,0x00,0x3C,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0xC0,0x07,0xC0,0x03,0x00,0x00}, // 0x7D
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x43,0xE0,0x7F,0x20,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x7E
{0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x3F,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0xC0,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // 0x7F
};

View File

@@ -1,21 +1,25 @@
MZ_FLASHER=python ../88MZ100_Flasher/88MZ100_Uart_flasher.py
ARMGCC=/usr/bin/
CC=$(ARMGCC)arm-none-eabi-gcc
GPLUSPLUS=$(ARMGCC)arm-none-eabi-g++
AS=$(ARMGCC)arm-none-eabi-as
OBJCOPY=$(ARMGCC)arm-none-eabi-objcopy
#-Wall
#-Wall
CC_WARNING_FLAGS=-Wall -Wformat=0 -Wattributes -Wstrict-aliasing=0
CC_FlAGS=-mcpu=cortex-m3 -g -O0 -mthumb -fdata-sections -ffunction-sections -std=c99
CC_END_FLAGS=-lc -lnosys -L. -T mz100.ld -fPIE --specs=nosys.specs -mcpu=cortex-m3 -mthumb -Wl,--gc-sections -O0 -flto -ffunction-sections -fdata-sections -DARM_GNU
CPP_FLAGS=-lstdc++ -mcpu=cortex-m3 -g -O3 -mthumb -fdata-sections -ffunction-sections -std=c++98 -std=gnu++0x
CC_FLAGS=-mcpu=cortex-m3 -g -O0 -mthumb -fdata-sections -ffunction-sections -std=c99
CC3_FLAGS=-mcpu=cortex-m3 -g -O3 -mthumb -fdata-sections -ffunction-sections -std=c99
CC_END_FLAGS=-lstdc++ -lc -lnosys -L. -T mz100/mz100.ld -fPIE --specs=nosys.specs -mcpu=cortex-m3 -mthumb -Wl,--gc-sections -O0 -flto -ffunction-sections -fdata-sections -DARM_GNU
C_SOURCES :=$(wildcard *.c)
C_EXECUTABLE :=$(C_SOURCES:.c=)
COMPORT = COM12
build: compile
only: clean compile create_ota_img
@@ -27,44 +31,79 @@ uart: clean compile flash_uart
compile:
@mkdir -p build
@$(AS) -mcpu=cortex-m3 --gdwarf-2 -mthumb-interwork -o build/startup.o startup.S
# @mkdir -p build
@$(AS) -mcpu=cortex-m3 --gdwarf-2 -mthumb-interwork -o build/startup.o startup.S
@$(CC) $(CC3_FLAGS) -c mz100/core_cm3.c -o build/core_cm3.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_ssp.c -o build/mz100_ssp.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_wdt.c -o build/mz100_wdt.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_gpio.c -o build/mz100_gpio.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_driver.c -o build/mz100_driver.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_adc.c -o build/mz100_adc.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_flash.c -o build/mz100_flash.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_clock.c -o build/mz100_clock.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_rtc.c -o build/mz100_rtc.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_pinmux.c -o build/mz100_pinmux.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_pmu.c -o build/mz100_pmu.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_qspi.c -o build/mz100_qspi.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_aes.c -o build/mz100_aes.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_gpt.c -o build/mz100_gpt.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_sleep.c -o build/mz100_sleep.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_uart.c -o build/mz100_uart.o
@$(CC) $(CC3_FLAGS) -c mz100/mz100_aon_ram.c -o build/mz100_aon_ram.o
@$(CC) $(CC3_FLAGS) -c mz100/printf.c -o build/printf.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c zigbee.c -o build/zigbee.o
# @$(CC) $(CC_FLAGS) $(CC_WARNING_FLAGS) -c ccm.c -o build/ccm.o
@$(CC) $(CC_FlAGS) -c core_cm3.c -o build/core_cm3.o
@$(CC) $(CC_FlAGS) -c mz100_ssp.c -o build/mz100_ssp.o
@$(CC) $(CC_FlAGS) -c mz100_wdt.c -o build/mz100_wdt.o
@$(CC) $(CC_FlAGS) -c mz100_gpio.c -o build/mz100_gpio.o
@$(CC) $(CC_FlAGS) -c mz100_driver.c -o build/mz100_driver.o
@$(CC) $(CC_FlAGS) -c mz100_adc.c -o build/mz100_adc.o
@$(CC) $(CC_FlAGS) -c mz100_flash.c -o build/mz100_flash.o
@$(CC) $(CC_FlAGS) -c mz100_clock.c -o build/mz100_clock.o
@$(CC) $(CC_FlAGS) -c mz100_rtc.c -o build/mz100_rtc.o
@$(CC) $(CC_FlAGS) -c mz100_pinmux.c -o build/mz100_pinmux.o
@$(CC) $(CC_FlAGS) -c mz100_pmu.c -o build/mz100_pmu.o
@$(CC) $(CC_FlAGS) -c mz100_qspi.c -o build/mz100_qspi.o
@$(CC) $(CC_FlAGS) -c mz100_aes.c -o build/mz100_aes.o
@$(CC) $(CC_FlAGS) -c mz100_gpt.c -o build/mz100_gpt.o
@$(CC) $(CC_FlAGS) -c mz100_sleep.c -o build/mz100_sleep.o
@$(CC) $(CC_FlAGS) -c mz100_uart.c -o build/mz100_uart.o
@$(CC) $(CC_FlAGS) -c mz100_aon_ram.c -o build/mz100_aon_ram.o
@$(CC) $(CC_FlAGS) -c printf.c -o build/printf.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c zigbee.c -o build/zigbee.o
# @$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c ccm.c -o build/ccm.o
# @$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c chars.c -o build/chars.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c drawing.c -o build/drawing.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c powermgt.c -o build/powermgt.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c syncedproto.c -o build/syncedproto.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c comms.c -o build/comms.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c settings.c -o build/settings.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c timer.c -o build/timer.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c util.c -o build/util.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c gpio.c -o build/gpio.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c epd.c -o build/epd.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c userinterface.c -o build/userinterface.o
@$(CC) $(CC_FlAGS) $(CC_WARNING_FLAGS) -c main.c -o build/main.o
@$(CC) $(CC_END_FLAGS) $(CC_WARNING_FLAGS) build/main.o build/userinterface.o build/printf.o build/mz100_aon_ram.o build/zigbee.o build/drawing.o build/powermgt.o build/syncedproto.o build/comms.o build/settings.o build/timer.o build/util.o build/gpio.o build/epd.o build/mz100_sleep.o build/core_cm3.o build/mz100_ssp.o build/mz100_wdt.o build/mz100_gpio.o build/mz100_driver.o build/mz100_adc.o build/mz100_flash.o build/mz100_clock.o build/mz100_rtc.o build/mz100_pinmux.o build/mz100_pmu.o build/mz100_qspi.o build/mz100_aes.o build/mz100_gpt.o build/mz100_uart.o build/startup.o -o main.axf
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c ../common/uzlib/src/adler32.c -o build/uz-adler32.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c ../common/uzlib/src/crc32.c -o build/uz-crc32.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c ../common/uzlib/src/defl_static.c -o build/uz-defl_static.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c ../common/uzlib/src/genlz77.c -o build/uz-genlz77.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c ../common/uzlib/src/tinfgzip.c -o build/uz-tinfgzip.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c ../common/uzlib/src/tinflate.c -o build/uz-tinflate.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c ../common/uzlib/src/tinfzlib.c -o build/uz-tinfzlib.o
@$(GPLUSPLUS) $(CPP_FLAGS) $(CC_WARNING_FLAGS) -c compression.cpp -o build/compression.o
@$(GPLUSPLUS) $(CPP_FLAGS) $(CC_WARNING_FLAGS) -c drawing.cpp -o build/drawing.o
@$(GPLUSPLUS) $(CPP_FLAGS) $(CC_WARNING_FLAGS) -c epd_interface.cpp -o build/epd_interface.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c powermgt.c -o build/powermgt.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c syncedproto.c -o build/syncedproto.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c comms.c -o build/comms.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c md5.c -o build/md5.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c settings.c -o build/settings.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c mz100/timer.c -o build/timer.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c mz100/util.c -o build/util.o
@$(CC) $(CC3_FLAGS) $(CC_WARNING_FLAGS) -c mz100/gpio.c -o build/gpio.o
@$(GPLUSPLUS) $(CPP_FLAGS) $(CC_WARNING_FLAGS) -c uc8159-var-m2.cpp -o build/uc8159-var-m2.o
@$(GPLUSPLUS) $(CPP_FLAGS) $(CC_WARNING_FLAGS) -c userinterface.cpp -o build/userinterface.o
@$(GPLUSPLUS) $(CPP_FLAGS) $(CC_WARNING_FLAGS) -c main.cpp -o build/main.o
@$(GPLUSPLUS) $(CPP_FLAGS) $(CC_WARNING_FLAGS) -c oepl_fs.cpp -o build/oepl_fs.o
@$(GPLUSPLUS) $(CC_END_FLAGS) $(CC_WARNING_FLAGS) \
build/main.o \
build/epd_interface.o \
build/oepl_fs.o\
build/userinterface.o \
build/printf.o \
build/mz100_aon_ram.o \
build/zigbee.o \
build/compression.o \
build/drawing.o \
build/powermgt.o \
build/syncedproto.o \
build/comms.o \
build/settings.o \
build/timer.o \
build/util.o \
build/md5.o \
build/gpio.o \
build/uc8159-var-m2.o \
build/mz100_sleep.o \
build/core_cm3.o \
build/uz-adler32.o build/uz-crc32.o build/uz-defl_static.o build/uz-genlz77.o build/uz-tinfgzip.o build/uz-tinflate.o build/uz-tinfzlib.o \
build/mz100_ssp.o build/mz100_wdt.o build/mz100_gpio.o build/mz100_driver.o build/mz100_adc.o build/mz100_flash.o build/mz100_clock.o build/mz100_rtc.o build/mz100_pinmux.o build/mz100_pmu.o build/mz100_qspi.o build/mz100_aes.o build/mz100_gpt.o build/mz100_uart.o \
build/startup.o -o main.axf
@$(OBJCOPY) -v -O binary main.axf main.bin
@cat build/fs.img >> main.bin
clean:
@rm -rf build/*

View File

@@ -104,4 +104,189 @@ static const uint8_t batlow[] = {
0x00, 0x00, 0x00,
};
static const uint8_t tbird2[] = {
0x40,0x01,178,0,
0xb6, 0xdb, 0x6d, 0xb5, 0xad, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x52, 0xa5, 0x54, 0xaa, 0xaa, 0xaa, 0x55, 0x4a,
0xdb, 0x6d, 0xb6, 0xd6, 0xd6, 0xee, 0xee, 0xdb, 0x6d, 0xad, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xa4, 0xa4, 0x92, 0x49, 0x24, 0x92, 0x22, 0x4a, 0x54, 0x8a, 0x92, 0x44, 0x91, 0x48, 0xa9,
0x6d, 0xaa, 0xaa, 0xaa, 0xb5, 0x55, 0x55, 0x6a, 0xaa, 0xb5, 0x5b, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x49, 0x49, 0x24, 0x92, 0x44, 0x52, 0x95, 0x55, 0x2a, 0x92, 0x49, 0x55, 0x29, 0x22, 0x52, 0x49, 0x2a, 0x4a, 0xa5, 0x14,
0xaa, 0xb6, 0xd5, 0x6d, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xad, 0x55, 0x55, 0x55, 0x55, 0x55, 0x29, 0x29, 0x24, 0xaa, 0xaa, 0xaa, 0xa9, 0x33, 0x2a, 0x52, 0x49, 0x52, 0x55, 0x55, 0x24, 0x94, 0x95, 0x49, 0x2a, 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0x52, 0xaa, 0x92, 0x49, 0x24, 0x95, 0x28, 0x54, 0xa2, 0x4a, 0x4a, 0x92, 0x2a, 0x54, 0x12, 0x54, 0xa8,
0x5a, 0xaa, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x52, 0xa9, 0x2a, 0x49, 0x55, 0x49, 0x4a, 0xaa, 0x91, 0x52, 0x92, 0x89, 0x29, 0x21, 0x49, 0x24, 0x92, 0x48, 0xa5, 0x0a, 0x55, 0x21, 0x24, 0x49, 0x41, 0x22, 0xc9, 0x0a, 0x05,
0xab, 0x56, 0xaa, 0xaa, 0xab, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x2a, 0x4a, 0xa9, 0x55, 0x54, 0xaa, 0xa4, 0x92, 0x54, 0x8a, 0x49, 0x55, 0x44, 0x94, 0xa4, 0xaa, 0x49, 0x25, 0x12, 0xa1, 0x08, 0x94, 0x92, 0xa4, 0x94, 0x94, 0x24, 0xa1, 0x50,
0xb5, 0x6a, 0xb5, 0x55, 0xb5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x52, 0xaa, 0xaa, 0xa5, 0x4a, 0x4a, 0x92, 0x52, 0x55, 0x4a, 0x55, 0x54, 0x48, 0xaa, 0x4a, 0x15, 0x11, 0x24, 0x92, 0xa4, 0x54, 0xa5, 0x25, 0x49, 0x12, 0x4a, 0x42, 0x92, 0x54, 0x8a,
0xaa, 0xab, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xa5, 0x52, 0x55, 0x29, 0x52, 0x55, 0x2a, 0xa4, 0xa5, 0x48, 0x93, 0x25, 0x11, 0x25, 0x50, 0xa4, 0x92, 0x48, 0x49, 0x0a, 0x50, 0x90, 0x24, 0xa9, 0x21, 0x29, 0x24, 0x82, 0x51,
0xad, 0x55, 0x56, 0xad, 0x55, 0x55, 0x55, 0x55, 0x52, 0x55, 0x25, 0x2a, 0x4a, 0x94, 0xa5, 0x29, 0x49, 0x49, 0x12, 0x28, 0xa5, 0x48, 0x92, 0xa4, 0x90, 0x8a, 0x92, 0x49, 0x25, 0x24, 0xa1, 0x0a, 0x4a, 0x92, 0x04, 0x94, 0x84, 0x92, 0x29, 0x0a,
0x6a, 0xda, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x95, 0x49, 0x54, 0xa9, 0x55, 0x52, 0x94, 0xa5, 0x24, 0xa4, 0xd5, 0x45, 0x12, 0x25, 0x48, 0x4a, 0x4a, 0x52, 0x49, 0x24, 0x92, 0x92, 0x54, 0xa5, 0x22, 0x49, 0x52, 0x42, 0x52, 0x21, 0x44, 0x50,
0xab, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x2a, 0x95, 0x28, 0x95, 0x52, 0x94, 0xaa, 0x15, 0x09, 0x2a, 0x49, 0x52, 0x25, 0x21, 0x25, 0x24, 0x94, 0x92, 0x48, 0x49, 0x05, 0x10, 0x89, 0x24, 0x24, 0x29, 0x08, 0x94, 0x29, 0x0a,
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xa9, 0x2a, 0xaa, 0xa5, 0x52, 0xa6, 0x52, 0x4a, 0x52, 0x49, 0x52, 0x64, 0x91, 0x24, 0x89, 0x52, 0x94, 0x90, 0x92, 0x42, 0x49, 0x25, 0x10, 0xa8, 0xa4, 0x52, 0x42, 0x91, 0x44, 0x52, 0x42, 0x84, 0xa1,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4a, 0xa4, 0x92, 0x54, 0xa9, 0x51, 0x49, 0x29, 0x49, 0x25, 0x49, 0x12, 0x4a, 0x92, 0x54, 0x88, 0x4a, 0x4a, 0x49, 0x29, 0x24, 0x90, 0x8a, 0x04, 0x12, 0x08, 0x94, 0x44, 0x22, 0x89, 0x14, 0x52, 0x14,
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x49, 0x24, 0xaa, 0x55, 0x4a, 0xa5, 0x15, 0x15, 0x2a, 0xa5, 0x25, 0x52, 0x24, 0xa9, 0x24, 0x49, 0x02, 0x55, 0x21, 0x25, 0x22, 0x04, 0x48, 0x45, 0x21, 0x52, 0x89, 0x44, 0x42, 0x22, 0x90, 0x44, 0x42, 0x08, 0xa2,
0x5a, 0xaa, 0xaa, 0xaa, 0x92, 0xaa, 0xaa, 0x92, 0xa9, 0x29, 0x2a, 0xa4, 0xaa, 0xa4, 0x92, 0x94, 0x89, 0x52, 0x44, 0x92, 0xa4, 0xa9, 0x02, 0x94, 0x90, 0x89, 0x52, 0x22, 0x90, 0x94, 0x20, 0x50, 0x29, 0x11, 0x14, 0x4a, 0x21, 0x29, 0x52, 0x11,
0xaa, 0xaa, 0xaa, 0x94, 0xaa, 0xaa, 0xaa, 0x55, 0x25, 0x55, 0x48, 0xaa, 0x91, 0x2a, 0x48, 0x52, 0x54, 0x89, 0x2a, 0x48, 0x12, 0x4a, 0x54, 0x42, 0x4a, 0x24, 0x24, 0x88, 0x4a, 0x42, 0x8a, 0x85, 0x42, 0x48, 0x81, 0x01, 0x14, 0x04, 0x24, 0x88,
0x55, 0x55, 0x55, 0x52, 0xaa, 0x52, 0x49, 0x54, 0xaa, 0x4a, 0x55, 0x22, 0x4a, 0x91, 0x2b, 0x25, 0x22, 0x54, 0x81, 0x25, 0x49, 0x21, 0x22, 0x29, 0x21, 0x11, 0x49, 0x25, 0x01, 0x10, 0x44, 0x20, 0x11, 0x12, 0x54, 0xaa, 0x42, 0xa1, 0x49, 0x25,
0xaa, 0xaa, 0xaa, 0xaa, 0xa5, 0x4a, 0xaa, 0xa2, 0x92, 0xa5, 0x24, 0x95, 0x28, 0x4a, 0x90, 0x90, 0x94, 0x82, 0x54, 0x92, 0x44, 0x94, 0x89, 0x44, 0x48, 0xa4, 0x22, 0x48, 0xa8, 0x4a, 0x21, 0x15, 0x48, 0x44, 0x82, 0x01, 0x28, 0x14, 0x20, 0x90,
0x55, 0x55, 0x55, 0x55, 0x55, 0x29, 0x4a, 0x55, 0x49, 0x28, 0x92, 0xa8, 0xa5, 0x51, 0x4a, 0x4a, 0x42, 0x54, 0x92, 0x49, 0x28, 0x42, 0x24, 0x22, 0x25, 0x12, 0x88, 0x22, 0x05, 0x01, 0x14, 0x80, 0x22, 0x21, 0x28, 0xa8, 0x02, 0x82, 0x8a, 0x05,
0xaa, 0xaa, 0xa9, 0x24, 0x92, 0xaa, 0x52, 0x94, 0xaa, 0x95, 0x54, 0x95, 0x12, 0x24, 0x25, 0x25, 0x29, 0x12, 0x49, 0x24, 0x45, 0x11, 0x11, 0x14, 0x80, 0x40, 0x22, 0x88, 0xa8, 0xa8, 0x82, 0x55, 0x09, 0x14, 0x04, 0x05, 0x50, 0x50, 0x21, 0x50,
0x55, 0x55, 0x4a, 0x95, 0x54, 0x95, 0x49, 0x4a, 0x49, 0x49, 0x25, 0x42, 0xa9, 0x4a, 0x90, 0x90, 0x88, 0xa4, 0x84, 0x89, 0x10, 0xa8, 0xa4, 0xa2, 0x55, 0x15, 0x48, 0x22, 0x02, 0x04, 0x50, 0x00, 0xa0, 0x81, 0x51, 0x50, 0x0a, 0x0a, 0x88, 0x0a,
0xaa, 0xaa, 0x55, 0x54, 0xaa, 0xa2, 0x54, 0xa2, 0xa4, 0x54, 0x92, 0x28, 0x44, 0x91, 0x4a, 0x4a, 0x55, 0x12, 0x28, 0x44, 0xa5, 0x05, 0x09, 0x08, 0x02, 0x40, 0x12, 0x88, 0xa8, 0xa2, 0x0a, 0xaa, 0x0a, 0x54, 0x08, 0x0a, 0xa1, 0x40, 0x45, 0x50,
0x55, 0x49, 0x52, 0x52, 0x92, 0x55, 0x25, 0x19, 0x15, 0x22, 0x49, 0x4a, 0x92, 0x4a, 0x25, 0x21, 0x00, 0x88, 0x92, 0x92, 0x10, 0x50, 0x44, 0x52, 0xa8, 0x95, 0x40, 0x22, 0x02, 0x11, 0x40, 0x00, 0xa0, 0x01, 0x45, 0x40, 0x14, 0x2a, 0x90, 0x0a,
0xaa, 0xaa, 0xaa, 0xaa, 0x49, 0x49, 0x52, 0xa4, 0xa2, 0x95, 0x24, 0xa4, 0x49, 0x24, 0x90, 0x94, 0xaa, 0x52, 0x44, 0x48, 0x8a, 0x85, 0x21, 0x04, 0x04, 0x20, 0x15, 0x48, 0xa8, 0x88, 0x2a, 0xaa, 0x0a, 0xa8, 0x20, 0x2a, 0x81, 0x10, 0x4a, 0xa1,
0x52, 0x55, 0x25, 0x25, 0x55, 0x24, 0x89, 0x2a, 0x54, 0x48, 0x92, 0x12, 0xa4, 0x92, 0x4a, 0x42, 0x21, 0x09, 0x11, 0x12, 0x40, 0x20, 0x94, 0x51, 0x52, 0x8a, 0xa0, 0x02, 0x02, 0x25, 0x00, 0x00, 0xa0, 0x05, 0x15, 0x00, 0x54, 0xa5, 0x21, 0x14,
0xaa, 0x92, 0x94, 0x92, 0x49, 0x55, 0x54, 0x81, 0x0a, 0xa5, 0x49, 0x48, 0x12, 0x49, 0x21, 0x14, 0x94, 0xa2, 0x48, 0x84, 0x2a, 0x94, 0x02, 0x08, 0x08, 0x20, 0x0a, 0xa9, 0x69, 0x00, 0xaa, 0xaa, 0x15, 0x50, 0x80, 0xaa, 0x02, 0x10, 0x8a, 0x42,
0x4a, 0xa9, 0x52, 0xa9, 0x54, 0x92, 0x22, 0x5a, 0xa1, 0x10, 0x24, 0xa5, 0x49, 0x24, 0x94, 0xa2, 0x42, 0x11, 0x12, 0x51, 0x40, 0x42, 0xa9, 0x45, 0x42, 0x8a, 0xd5, 0x77, 0xbe, 0xf4, 0x00, 0x01, 0x40, 0x04, 0x55, 0x01, 0x54, 0x8a, 0x21, 0x29,
0x54, 0xa5, 0x2a, 0x4a, 0x8a, 0x49, 0x55, 0x24, 0x54, 0xaa, 0x92, 0x11, 0x24, 0x90, 0x42, 0x11, 0x14, 0xa4, 0x44, 0x08, 0x2a, 0x10, 0x04, 0x20, 0x28, 0x23, 0x5b, 0xad, 0x55, 0xaf, 0xb5, 0x54, 0x15, 0x52, 0x80, 0xaa, 0x22, 0x41, 0x4a, 0x44,
0xa5, 0x2a, 0xa5, 0x29, 0x51, 0x24, 0x88, 0x92, 0x8a, 0x04, 0xa9, 0x4a, 0x49, 0x0a, 0x94, 0x8a, 0x42, 0x12, 0x22, 0xa2, 0x81, 0x4a, 0xa1, 0x15, 0x45, 0x16, 0xa4, 0x56, 0xea, 0xd5, 0x6a, 0x81, 0x40, 0x08, 0x54, 0x01, 0x11, 0x2a, 0x21, 0x12,
0x54, 0xa4, 0x92, 0xa4, 0x4a, 0x92, 0x52, 0x48, 0x51, 0x52, 0x04, 0x21, 0x24, 0x50, 0x42, 0x51, 0x28, 0x89, 0x10, 0x11, 0x2a, 0x20, 0x14, 0x80, 0x10, 0xab, 0x12, 0xaa, 0xb7, 0x76, 0xdd, 0x7d, 0x15, 0x52, 0x09, 0x54, 0x88, 0x84, 0x94, 0x48,
0x4a, 0x95, 0x54, 0x92, 0xa4, 0x49, 0x25, 0x25, 0x0a, 0x29, 0x52, 0x94, 0x89, 0x0a, 0x94, 0x84, 0x04, 0x50, 0xa5, 0x4a, 0x40, 0x8a, 0xa2, 0x55, 0x4a, 0x1d, 0xa9, 0x12, 0xaa, 0x9b, 0x6b, 0xab, 0xe8, 0x81, 0x42, 0x08, 0x44, 0x22, 0x02, 0x22,
0x52, 0x52, 0x25, 0x4a, 0x12, 0xa4, 0x90, 0x92, 0xa1, 0x44, 0x48, 0x42, 0x24, 0xa0, 0x42, 0x29, 0x52, 0x84, 0x10, 0x81, 0x15, 0x20, 0x48, 0x08, 0x91, 0x56, 0x94, 0xa9, 0x40, 0x55, 0xb6, 0xf6, 0xb7, 0x6c, 0x28, 0xa2, 0x92, 0x90, 0xa9, 0x08,
0x4a, 0xa9, 0x52, 0x29, 0x49, 0x12, 0x4a, 0x48, 0x54, 0x22, 0x92, 0x94, 0x91, 0x15, 0x28, 0x84, 0x24, 0x52, 0xa5, 0x2a, 0x40, 0x95, 0x25, 0x52, 0x48, 0x3b, 0x22, 0x94, 0xd5, 0x22, 0x5b, 0x5b, 0x5b, 0xb7, 0x82, 0x08, 0x20, 0x0a, 0x00, 0x41,
0x54, 0x95, 0x29, 0x44, 0xa4, 0xa9, 0x25, 0x25, 0x05, 0x54, 0x49, 0x22, 0x44, 0x42, 0x05, 0x29, 0x49, 0x08, 0x88, 0x88, 0x95, 0x04, 0x91, 0x29, 0x25, 0x56, 0x95, 0x22, 0x48, 0x88, 0xa8, 0xaa, 0xed, 0x5a, 0xfd, 0x42, 0x8a, 0xa0, 0xaa, 0x10,
0x4a, 0x48, 0x84, 0xaa, 0x2a, 0x04, 0x90, 0x90, 0xa8, 0x82, 0x24, 0x49, 0x12, 0x94, 0xa8, 0x84, 0x22, 0x45, 0x24, 0x52, 0x44, 0xa9, 0x24, 0x84, 0x91, 0x7a, 0xc8, 0x94, 0xc5, 0x45, 0x31, 0x15, 0x57, 0xed, 0x56, 0xf8, 0x00, 0x08, 0x00, 0x84,
0x51, 0x55, 0x55, 0x11, 0x41, 0x52, 0x4a, 0x4a, 0x22, 0x29, 0x42, 0x24, 0x48, 0x42, 0x44, 0x52, 0x94, 0xa8, 0x92, 0x89, 0x11, 0x12, 0x4a, 0x52, 0x4a, 0xaf, 0x7e, 0xa8, 0xa8, 0x28, 0x94, 0x40, 0xaa, 0x57, 0xbb, 0x57, 0xea, 0x42, 0x88, 0x10,
0x4a, 0x89, 0x28, 0xa4, 0x94, 0xa9, 0x21, 0x21, 0x49, 0x44, 0x29, 0x49, 0x22, 0x29, 0x12, 0x88, 0x42, 0x04, 0x48, 0x44, 0x4a, 0x49, 0x21, 0x09, 0x21, 0x75, 0xdf, 0xd6, 0xc2, 0xa5, 0x62, 0x95, 0x05, 0x5a, 0xd5, 0xdd, 0x7d, 0xa0, 0x22, 0x42,
0x54, 0x54, 0x92, 0x4a, 0x4a, 0x04, 0x94, 0x94, 0x94, 0x29, 0x44, 0x24, 0x95, 0x44, 0x48, 0x52, 0x94, 0xaa, 0x92, 0xa9, 0x21, 0x24, 0x94, 0xa4, 0x95, 0xae, 0xeb, 0xe1, 0x39, 0x01, 0x30, 0x20, 0x56, 0x25, 0x5e, 0xb7, 0xae, 0xfd, 0x00, 0x00,
0x4a, 0xa2, 0x4a, 0x91, 0x21, 0x52, 0x4a, 0x42, 0x42, 0x84, 0x29, 0x42, 0x20, 0x29, 0x25, 0x24, 0x49, 0x10, 0x49, 0x04, 0x94, 0x91, 0x22, 0x12, 0x21, 0x77, 0x7d, 0xf4, 0x45, 0xda, 0x25, 0x0a, 0x02, 0x84, 0x22, 0xda, 0xf7, 0xb6, 0x92, 0x48,
0x22, 0x55, 0x51, 0x24, 0x94, 0x94, 0x91, 0x29, 0x28, 0x52, 0x84, 0x28, 0x95, 0x44, 0x92, 0x92, 0xa4, 0xa5, 0x24, 0xa9, 0x22, 0x44, 0x89, 0x48, 0x95, 0xad, 0xab, 0x61, 0x00, 0x2a, 0xb0, 0x41, 0x56, 0x52, 0x94, 0x7f, 0xba, 0xff, 0xc0, 0x02,
0xa9, 0x08, 0x8a, 0x52, 0x4a, 0x42, 0x48, 0x8a, 0x45, 0x24, 0x52, 0x85, 0x42, 0x2a, 0x48, 0x49, 0x12, 0x12, 0x92, 0x12, 0x49, 0x12, 0x52, 0x25, 0x22, 0xdb, 0xfe, 0xb4, 0xaa, 0x01, 0x57, 0x28, 0x05, 0x09, 0x49, 0x59, 0x5f, 0xdb, 0x49, 0x20,
0x4a, 0xa5, 0x51, 0x09, 0x21, 0x29, 0x25, 0x21, 0x28, 0x92, 0x88, 0xa8, 0x29, 0x41, 0x25, 0x24, 0xa4, 0xa8, 0x48, 0xa4, 0x94, 0xa9, 0x09, 0x50, 0x95, 0x76, 0xab, 0xf2, 0x11, 0x54, 0x08, 0xa4, 0x94, 0xa4, 0x22, 0xff, 0xaa, 0xaa, 0xc0, 0x08,
0x24, 0x52, 0x2a, 0xa4, 0x94, 0x94, 0x92, 0x54, 0x85, 0x49, 0x25, 0x15, 0x4a, 0x2a, 0x92, 0x92, 0x49, 0x05, 0x25, 0x12, 0x42, 0x04, 0xa4, 0x0a, 0x47, 0xbd, 0xfe, 0xa9, 0x4a, 0x02, 0xa2, 0x56, 0xa6, 0x09, 0x55, 0xdb, 0xbf, 0xff, 0xc4, 0x82,
0x92, 0x89, 0x44, 0x52, 0x4a, 0x42, 0x49, 0x0a, 0x52, 0x24, 0x92, 0x42, 0x25, 0x48, 0x48, 0xa9, 0x24, 0xa9, 0x48, 0xa4, 0x94, 0xa9, 0x12, 0xa5, 0x29, 0x6b, 0xb7, 0xf2, 0x21, 0x54, 0x15, 0x08, 0xaa, 0xa2, 0x09, 0xff, 0xed, 0xb6, 0x90, 0x20,
0x49, 0x54, 0xa9, 0x15, 0x21, 0x29, 0x24, 0xa1, 0x29, 0x52, 0x49, 0x29, 0x50, 0xa5, 0x2a, 0x44, 0x92, 0x54, 0x25, 0x12, 0x49, 0x24, 0xa9, 0x28, 0x87, 0xbe, 0xfe, 0xb4, 0x94, 0x49, 0x40, 0xa2, 0x04, 0xac, 0xa7, 0x6d, 0x36, 0xdb, 0x42, 0x08,
0x54, 0x92, 0x25, 0x48, 0x95, 0x55, 0x52, 0x95, 0x44, 0x89, 0x2a, 0x94, 0x8a, 0x12, 0xa5, 0x2a, 0x49, 0x22, 0x92, 0x49, 0x24, 0x92, 0x44, 0x85, 0x2a, 0xd7, 0x5b, 0xe9, 0x42, 0xa4, 0x95, 0x14, 0xa0, 0x12, 0xab, 0xff, 0xab, 0xff, 0xc8, 0xa2,
0x25, 0x4a, 0x92, 0x55, 0x54, 0x92, 0x4a, 0x54, 0x95, 0x24, 0x90, 0x49, 0x21, 0x49, 0x10, 0x91, 0x54, 0x95, 0x49, 0x54, 0x92, 0x49, 0x29, 0x52, 0x4d, 0x7b, 0xff, 0x72, 0x29, 0x10, 0x24, 0x41, 0x12, 0x40, 0xae, 0xea, 0xfe, 0xa4, 0x22, 0x08,
0x92, 0x24, 0xa9, 0x22, 0x4a, 0x49, 0x29, 0x22, 0x52, 0x92, 0x4a, 0xa0, 0x48, 0x2a, 0xaa, 0x4a, 0x4a, 0x48, 0x54, 0x8a, 0x49, 0x24, 0x92, 0x29, 0x2b, 0xad, 0x6b, 0xd9, 0x44, 0x82, 0x12, 0xaa, 0x44, 0x8a, 0x17, 0xff, 0xf8, 0x09, 0x11, 0x52,
0x55, 0x52, 0x95, 0x55, 0x25, 0x55, 0x4a, 0x95, 0x28, 0x49, 0x20, 0x14, 0x22, 0x91, 0x01, 0x25, 0x22, 0xa5, 0x22, 0x51, 0x2a, 0x92, 0x49, 0x44, 0x96, 0xf7, 0xfe, 0xf4, 0x12, 0x20, 0x8a, 0x11, 0x21, 0x20, 0x9d, 0xbd, 0xb2, 0xa2, 0x4a, 0x08,
0x49, 0x2a, 0x52, 0x94, 0xa9, 0x24, 0xa4, 0x52, 0x85, 0x2a, 0x92, 0x81, 0x08, 0x4a, 0x54, 0x11, 0x54, 0x95, 0x55, 0x4a, 0xa4, 0x55, 0x54, 0x92, 0x5b, 0x5d, 0x5b, 0xb2, 0x88, 0x84, 0x52, 0xaa, 0x14, 0x95, 0x6f, 0xf7, 0xe9, 0x11, 0x24, 0xa5,
0x54, 0xa9, 0x4a, 0x4a, 0x94, 0x92, 0x52, 0x94, 0x50, 0x90, 0x44, 0x52, 0x42, 0x20, 0x91, 0x4a, 0x4a, 0x52, 0x95, 0x55, 0x52, 0xa4, 0x8a, 0x55, 0x55, 0xf7, 0xff, 0xf9, 0x20, 0x10, 0x09, 0x00, 0x40, 0x48, 0xbf, 0xff, 0xe4, 0xaa, 0x52, 0xa8,
0x4a, 0x95, 0x55, 0x52, 0x52, 0xaa, 0x89, 0x4a, 0xaa, 0x4a, 0x11, 0x00, 0x28, 0x8a, 0x24, 0x01, 0x2a, 0xad, 0x6a, 0xb5, 0x5d, 0x55, 0x61, 0x24, 0xae, 0xae, 0xd6, 0xd4, 0x8a, 0x82, 0xa4, 0xa9, 0x25, 0x25, 0x7b, 0xbf, 0x92, 0x41, 0x08, 0x92,
0x55, 0x4a, 0x49, 0x29, 0x4a, 0x49, 0x54, 0xa1, 0x01, 0x21, 0x44, 0x4a, 0x02, 0x20, 0x89, 0x5a, 0xaa, 0xd5, 0x56, 0xdb, 0x6b, 0x6d, 0xbd, 0x52, 0x37, 0xfb, 0xff, 0xb8, 0x50, 0x54, 0x12, 0x02, 0x48, 0x92, 0xef, 0xfd, 0xa9, 0x14, 0xa5, 0x4a,
0xa9, 0x29, 0x54, 0x95, 0x29, 0x24, 0x4a, 0x2a, 0xaa, 0x88, 0x10, 0x10, 0xa8, 0x8a, 0x25, 0x55, 0x55, 0x55, 0xb5, 0x55, 0xaa, 0xb6, 0xab, 0xaa, 0xad, 0x5e, 0xb5, 0xf2, 0x8a, 0x21, 0x49, 0x48, 0x82, 0x4b, 0xff, 0xf7, 0x45, 0x55, 0x52, 0x25,
0x4a, 0xa5, 0x25, 0x48, 0xa5, 0x55, 0x22, 0x90, 0x40, 0x45, 0x42, 0x80, 0x00, 0x21, 0x5a, 0xaa, 0xda, 0xad, 0x5b, 0x6d, 0x6d, 0xaa, 0xd5, 0x6d, 0xb7, 0xeb, 0xff, 0x78, 0x51, 0x14, 0x24, 0x80, 0x29, 0x2e, 0xfd, 0xbe, 0xb4, 0xa4, 0x8a, 0x92,
0x54, 0x94, 0xaa, 0x55, 0x52, 0x49, 0x54, 0xa5, 0x15, 0x10, 0x08, 0x25, 0x4a, 0x84, 0x2a, 0xab, 0x55, 0xb5, 0xad, 0xb5, 0xb6, 0xdb, 0x5d, 0xb6, 0xda, 0xbf, 0x5b, 0xd5, 0x2a, 0xc9, 0x2a, 0x21, 0x04, 0xab, 0xdf, 0xfe, 0x4a, 0x52, 0x54, 0x54,
0x4a, 0x55, 0x49, 0x4a, 0x29, 0x24, 0x8a, 0x12, 0x82, 0x41, 0x21, 0x00, 0x2a, 0xb2, 0x02, 0xaa, 0xaa, 0xd6, 0xb5, 0x56, 0xab, 0x6d, 0x6a, 0xdb, 0x6d, 0xab, 0xfe, 0xf9, 0x55, 0x24, 0xa0, 0x84, 0x12, 0xbf, 0xff, 0xf9, 0x52, 0x89, 0x21, 0x0a,
0x52, 0xaa, 0x55, 0x25, 0x45, 0x52, 0x51, 0x48, 0x50, 0x04, 0x00, 0x2b, 0xaa, 0xda, 0x90, 0xad, 0x56, 0xaa, 0xd6, 0xdb, 0x6d, 0x56, 0xaf, 0x6d, 0xb6, 0xf6, 0xb7, 0xda, 0xa4, 0xaa, 0x94, 0x10, 0x0a, 0xb7, 0x76, 0xed, 0x49, 0x44, 0x54, 0x51,
0xaa, 0x91, 0x49, 0x52, 0xa8, 0x89, 0x24, 0x92, 0x8a, 0x90, 0x4a, 0x94, 0xaa, 0xaa, 0xc2, 0x2a, 0xb5, 0x5b, 0x5a, 0xad, 0xb6, 0xdb, 0xb5, 0xb6, 0xdb, 0x5b, 0xdd, 0xf9, 0x2a, 0x91, 0x40, 0x00, 0x81, 0x7f, 0xff, 0xf5, 0x2a, 0x52, 0x88, 0x0d,
0x49, 0x55, 0x25, 0x29, 0x25, 0x24, 0x92, 0x44, 0x50, 0x01, 0x05, 0x6a, 0xaa, 0xab, 0x50, 0x15, 0xab, 0x6d, 0x6b, 0x75, 0x55, 0x6c, 0xda, 0xdb, 0x55, 0xad, 0x6a, 0xb5, 0x55, 0x4a, 0x21, 0x48, 0x25, 0xdb, 0xdf, 0xea, 0xaa, 0xa9, 0x25, 0x52,
0x55, 0x4a, 0xaa, 0xaa, 0x94, 0xaa, 0x49, 0x22, 0x89, 0x48, 0x55, 0x2a, 0xad, 0x54, 0xac, 0x45, 0x5d, 0xb5, 0xad, 0xab, 0x6f, 0xb7, 0x6d, 0x55, 0xba, 0xf6, 0xb7, 0x5a, 0xa4, 0xa4, 0x88, 0x12, 0x0b, 0x7f, 0x57, 0xa5, 0x55, 0x54, 0xa8, 0x09,
0x55, 0x2a, 0xa9, 0x4a, 0x55, 0x41, 0x12, 0x14, 0x54, 0x05, 0xb5, 0x55, 0x56, 0xd6, 0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a, 0xda, 0xd5, 0x52, 0x91, 0x54, 0x42, 0x92, 0x4a, 0x8a, 0x24, 0xaa, 0xa4, 0x00, 0x00, 0x28, 0x15, 0x41, 0x75, 0x95, 0x6d, 0xaa, 0xd5, 0x6e, 0xae, 0xb7, 0x59, 0x5b, 0x5a, 0xde, 0xb6, 0xf7, 0x7f, 0xff, 0xbf, 0xff, 0x7f, 0xd2, 0x22, 0x44,
0xb6, 0xab, 0x6d, 0x09, 0x4a, 0x4a, 0xaa, 0x42, 0xa9, 0x55, 0x52, 0x49, 0x10, 0x00, 0x11, 0x14, 0x0b, 0x40, 0x95, 0x6a, 0xaa, 0xab, 0x5a, 0xb5, 0xb5, 0xaa, 0xee, 0xd5, 0xed, 0xf7, 0xff, 0xff, 0xf6, 0xf6, 0xff, 0xf7, 0xff, 0xe0, 0x88, 0x00,
0xab, 0x6d, 0x56, 0xa4, 0x24, 0xa1, 0x29, 0x29, 0x14, 0xa1, 0x2a, 0xa0, 0x00, 0x22, 0x00, 0x18, 0x25, 0x40, 0xda, 0xad, 0x6a, 0xac, 0xab, 0x56, 0xda, 0xdd, 0x55, 0x6e, 0xbb, 0x7d, 0xdf, 0xfd, 0xdf, 0xdf, 0xf5, 0xff, 0xff, 0xca, 0x00, 0x24,
0xba, 0xb6, 0xf8, 0x95, 0x52, 0x14, 0x84, 0x94, 0xa2, 0x14, 0x92, 0x00, 0x00, 0x80, 0x00, 0x50, 0x05, 0x40, 0x55, 0x55, 0xaa, 0xb5, 0x55, 0xb5, 0x6d, 0x6b, 0xb7, 0xb7, 0xdf, 0xdf, 0xfd, 0xdf, 0xff, 0xff, 0xdf, 0xff, 0xff, 0x20, 0x49, 0x00,
0xd7, 0xdb, 0x55, 0x52, 0x09, 0x42, 0x22, 0x42, 0x15, 0x52, 0xa9, 0x00, 0x00, 0x01, 0x57, 0x51, 0x55, 0x62, 0x2d, 0xaa, 0xb5, 0x55, 0xb6, 0xab, 0xab, 0xad, 0x6d, 0x6d, 0x75, 0xf6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b, 0x56, 0xb6, 0xda, 0xad, 0xb6, 0xaa, 0xd5, 0x6b, 0x75, 0x5b, 0x6f, 0xdd, 0x55, 0x6b, 0xff, 0xfe, 0xaa, 0xbf, 0xd7, 0xaf,
0xad, 0xaa, 0xab, 0x57, 0x6d, 0x56, 0xba, 0xb5, 0x55, 0x48, 0x4a, 0xa9, 0x44, 0x88, 0xaa, 0xaa, 0xaa, 0xaa, 0xdb, 0x6a, 0xb5, 0x5a, 0xaa, 0xaa, 0xaa, 0xb5, 0x6a, 0xad, 0x56, 0xad, 0xb5, 0x77, 0xfb, 0xfd, 0x55, 0x57, 0xff, 0xd5, 0x7a, 0xfa,
};
#endif

View File

@@ -4,7 +4,7 @@
#include <stdint.h>
#include "proto.h"
#include "main.h"
#include "gpio.h"
#include "mz100/gpio.h"
#define eepromByte spiByte
#define eepromPrvSelect() do { /*digitalWrite(FLASH_CS,LOW);*/ } while(0)

View File

@@ -18,12 +18,12 @@ int8_t commsGetLastPacketRSSI(void) {
return mLastRSSI;
}
static inline void __attribute__((always_inline)) macCopy(uint8_t *restrict dst, const uint8_t *restrict src) {
static inline void __attribute__((always_inline)) macCopy(uint8_t* dst, const uint8_t* src) {
((uint32_t *)dst)[0] = ((const uint32_t *)src)[0];
((uint32_t *)dst)[1] = ((const uint32_t *)src)[1];
}
static inline bool __attribute__((always_inline)) macIsEq(const uint8_t *restrict dst, const uint8_t *restrict src) {
static inline bool __attribute__((always_inline)) macIsEq(const uint8_t* dst, const uint8_t* src) {
return ((uint32_t *)dst)[0] == ((const uint32_t *)src)[0] && ((uint32_t *)dst)[1] == ((const uint32_t *)src)[1];
}

View File

@@ -0,0 +1,37 @@
#include "drawing.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "epd_interface.h"
#include "mz100/printf.h"
#include "mz100/eeprom.h"
#include "oepl_fs.h"
#include "compression.h"
#include "../../oepl-definitions.h"
#include "../../oepl-proto.h"
#include "settings.h"
extern "C" {
extern void dump(const uint8_t *a, const uint16_t l);
#include "mz100/util.h"
#include "mz100/mz100_flash.h"
#include "../common/uzlib/src/uzlib.h"
}
#define MAX_WINDOW_SIZE 8192
#define ZLIB_CACHE_SIZE 512
uint32_t __attribute__((always_inline)) inline HAL_flashRead(uint32_t address, uint8_t *buffer, uint32_t num){
return FLASH_Read(FLASH_FAST_READ_QUAD_OUT, address, buffer, num);
}
#include "../common/compression.cpp"

View File

@@ -0,0 +1,9 @@
#pragma once
#define ENABLE_OEPLFS
#ifdef ENABLE_OEPLFS
#include "oepl_fs.h"
#endif
#include "../common/compression.h"

View File

@@ -1,68 +0,0 @@
#include "drawing.h"
#include <stdbool.h>
#include "board.h"
#include "eeprom.h"
#include "epd.h"
#include "printf.h"
#include "proto.h"
#include "screen.h"
#include "timer.h"
#include "util.h"
struct BitmapClutEntry {
uint8_t b, g, r, x;
};
uint8_t mPassNo = 0;
static uint8_t mClutMap[256];
static uint8_t mClutMapRed[256];
void drawImageAtAddress(uint32_t addr, uint8_t lut) {
struct EepromImageHeader *eih = (struct EepromImageHeader *)mClutMap;
eepromRead(addr, mClutMap, sizeof(struct EepromImageHeader));
switch (eih->dataType) {
case DATATYPE_IMG_RAW_1BPP:
printf("Doing raw 1bpp\n");
init_epd();
display_send_start(1);
for (uint32_t c = 0; c < (SCREEN_HEIGHT * (SCREEN_WIDTH / 8)); c++) {
if (c % 256 == 0) {
eepromRead(addr + sizeof(struct EepromImageHeader) + c, mClutMap, 256);
}
uint8_t curr_byte = mClutMap[c % 256]; // this one holds 8 pixel, we will translate them to 4 sendings
interleaveColor(curr_byte, 0x00);
}
display_send_stop();
epd_refresh_and_sleep(lut);
break;
case DATATYPE_IMG_RAW_2BPP:
printf("Doing raw 2bpp\n");
init_epd();
display_send_start(1);
for (uint32_t c = 0; c < (SCREEN_HEIGHT * (SCREEN_WIDTH / 8)); c++) {
if (c % 256 == 0) {
eepromRead(addr + sizeof(struct EepromImageHeader) + c, mClutMap, 256);
eepromRead(addr + sizeof(struct EepromImageHeader) + (SCREEN_HEIGHT * (SCREEN_WIDTH / 8)) + c, mClutMapRed, 256);
}
uint8_t curr_byte = mClutMap[c % 256]; // this one holds 8 pixel, we will translate them to 4 sendings
uint8_t curr_byteRed = mClutMapRed[c % 256]; // this one holds 8 pixel, we will translate them to 4 sendings
interleaveColor(curr_byte, curr_byteRed);
}
display_send_stop();
epd_refresh_and_sleep(lut);
break;
default: // prevent drawing from an unknown file image type
printf("Image with type 0x%02X was requested, but we don't know what to do with that currently...\n", eih->dataType);
return;
}
// addOverlay();
// drawWithSleep();
}

View File

@@ -0,0 +1,824 @@
// #pragma pack(1)
#include "drawing.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "epd_interface.h"
#include "mz100/printf.h"
#include "mz100/eeprom.h"
#include "compression.h"
#include "oepl_fs.h"
#include "../../oepl-definitions.h"
#include "../../oepl-proto.h"
extern "C" {
extern void dump(const uint8_t *a, const uint16_t l);
#include "mz100/util.h"
#include "mz100/mz100_flash.h"
}
#include "userinterface.h"
#include "epd_interface.h"
#define EEPROM_XFER_BLOCKSIZE 512 // shouldn't be any less than 256 bytes probably
#define DRAWITEM_LIST_SIZE 24
struct __attribute__((packed)) imageHeader {
uint16_t width;
uint16_t height;
uint8_t bpp : 4;
uint8_t reserved : 4;
};
static drawItem *drawItems[DRAWITEM_LIST_SIZE] = {0};
void addBufferedImage(uint16_t x, uint16_t y, bool color, enum rotation ro, const uint8_t *image, bool mask) {
drawItem *di = new drawItem;
di->setRotation(ro);
if (di->direction ^ epd->drawDirectionRight) {
int16_t temp = x;
x = y;
y = temp;
}
uint16_t originalWidthBytes = (((uint16_t *)image)[0]) / 8;
uint16_t size = 0;
uint16_t width = ((uint16_t *)image)[0];
// find out if the original data was aligned in one byte; if not, add a byte
if (((uint16_t *)image)[0] % 8) originalWidthBytes++;
// if we're drawing in X direction, we shift the content here. Add extra space for shifting!
if (!di->direction) {
width += x % 8;
}
// check if the size is aligned in bytes; if not, add an extra for good measure;
if (width % 8) {
width /= 8;
width++;
} else {
width /= 8;
}
size = width * ((uint16_t *)image)[1];
size += 2; // not needed
uint8_t *im = (uint8_t *)calloc(size, 1);
for (uint16_t copyY = 0; copyY < ((uint16_t *)image)[1]; copyY++) {
memcpy(im + (copyY * width), image + 4 + (copyY * originalWidthBytes), originalWidthBytes);
// if we draw in X direction, we need to shift bytes in the array
if (!di->direction && (x % 8)) {
drawItem::shiftBytesRight(im + (copyY * width), x % 8, width);
}
}
di->addItem(im, width * 8, ((uint16_t *)image)[1]);
di->xpos = x;
di->ypos = y;
di->color = color;
if (mask)
di->type = drawItem::drawType::DRAW_MASK;
else
di->type = drawItem::drawType::DRAW_BUFFERED_1BPP;
di->addToList();
}
void addFlashImage(uint16_t x, uint16_t y, bool color, enum rotation ro, const uint8_t *image) {
drawItem *di = new drawItem;
di->setRotation(ro);
if (di->direction ^ epd->drawDirectionRight) {
int16_t temp = x;
x = y;
y = temp;
}
di->addItem((uint8_t *)(image + 4), ((uint16_t *)image)[0], ((uint16_t *)image)[1]);
di->xpos = x;
di->ypos = y;
di->color = color;
di->cleanUp = false;
di->type = drawItem::drawType::DRAW_BUFFERED_1BPP;
di->addToList();
}
void addFSImage(uint16_t x, uint16_t y, uint8_t color, enum rotation ro, char *name) {
drawItem *di = new drawItem;
di->setRotation(ro);
if (di->direction ^ epd->drawDirectionRight) {
int16_t temp = x;
x = y;
y = temp;
}
OEPLFile *file = fs->getFile(name);
if (!file) {
delete di;
return;
}
uint16_t width, height;
file->getBlock(0, (uint8_t *)&width, 2);
file->getBlock(2, (uint8_t *)&height, 2);
di->addItem((uint8_t *)file, width, height);
di->xpos = x;
di->ypos = y;
di->color = color;
di->cleanUp = true;
if (color == 2) {
di->type = drawItem::drawType::DRAW_OEPLFS_2BPP;
} else {
di->type = drawItem::drawType::DRAW_OEPLFS_1BPP;
}
di->addToList();
}
void addCompressedFSImage(uint16_t x, uint16_t y, enum rotation ro, char *name) {
drawItem *di = new drawItem;
di->type = drawItem::drawType::DRAW_COMPRESSED;
di->setRotation(ro);
if (di->direction ^ epd->drawDirectionRight) {
int16_t temp = x;
x = y;
y = temp;
}
decompress *decomp = new decompress;
if (!decomp->openFromFile(name)) {
delete di;
delete decomp;
return;
}
di->imageHeaderOffset = decomp->readByte(0);
struct imageHeader imgheader;
decomp->getBlock(1, (uint8_t *)&imgheader, sizeof(struct imageHeader));
di->addItem((uint8_t *)decomp, imgheader.width, imgheader.height);
di->xpos = x;
di->ypos = y;
di->color = imgheader.bpp;
di->cleanUp = true;
di->addToList();
}
void drawImageAtAddressWrap(uint32_t addr, uint8_t lut) {
// powerUp(INIT_EEPROM);
epdSetup();
selectLUT(lut);
uint8_t *xferbuffer = (uint8_t *)malloc(EEPROM_XFER_BLOCKSIZE);
struct EepromImageHeader *eih = (struct EepromImageHeader *)xferbuffer;
FLASH_Read(FLASH_NORMAL_READ, addr, xferbuffer, sizeof(struct EepromImageHeader));
switch (eih->dataType) {
case DATATYPE_IMG_RAW_1BPP: {
drawItem *di = new drawItem;
// di->setRotation(ro);
di->xpos = 0;
di->ypos = 0;
di->color = 0;
di->addItem((uint8_t *)addr, epd->effectiveXRes, epd->effectiveYRes);
di->type = drawItem::drawType::DRAW_EEPROM_1BPP;
di->direction = false;
di->cleanUp = false;
di->addToList();
} break;
case DATATYPE_IMG_RAW_2BPP: {
drawItem *di = new drawItem;
// di->setRotation(ro);
di->xpos = 0;
di->ypos = 0;
di->color = 0;
di->addItem((uint8_t *)addr, epd->effectiveXRes, epd->effectiveYRes);
di->type = drawItem::drawType::DRAW_EEPROM_2BPP;
di->direction = false;
di->cleanUp = false;
di->addToList();
} break;
case DATATYPE_IMG_ZLIB: {
drawItem *di = new drawItem;
decompress *decomp = new decompress;
di->type = drawItem::drawType::DRAW_COMPRESSED;
addr += sizeof(struct EepromImageHeader);
if (!decomp->openFromFlash(addr, eih->size)) {
delete di;
delete decomp;
return;
}
di->imageHeaderOffset = decomp->readByte(0);
struct imageHeader imgheader;
decomp->getBlock(1, (uint8_t *)&imgheader, sizeof(struct imageHeader));
di->addItem((uint8_t *)decomp, imgheader.width, imgheader.height);
di->xpos = 0;
di->ypos = 0;
if (imgheader.bpp == 1) di->color = 0;
if (imgheader.bpp == 2) di->color = 2;
di->cleanUp = true;
di->addToList();
} break;
}
free(xferbuffer);
addOverlay();
draw();
epdEnterSleep();
}
extern "C" {
void drawImageAtAddress(uint32_t addr, uint8_t lut) {
drawImageAtAddressWrap(addr, lut);
}
}
void drawRoundedRectangle(uint16_t xpos, uint16_t ypos, uint16_t width, uint16_t height, bool color) {
uint16_t widthBytes = width / 8;
if (width % 8) widthBytes++;
uint32_t framebufferSize = (widthBytes + 1) * height;
uint8_t *framebuffer = (uint8_t *)calloc(framebufferSize + 4, 1);
if (framebuffer == NULL) {
return;
}
((uint16_t *)framebuffer)[0] = width + 1;
((uint16_t *)framebuffer)[1] = height;
framebuffer += 4;
uint16_t w = width - 1;
uint16_t x = 1;
while (w--) {
framebuffer[(x / 8)] |= (uint8_t)(1 << (7 - ((uint8_t)x % 8)));
x++;
}
for (uint16_t curY = 1; curY < (height - 1); curY++) {
framebuffer[widthBytes * curY] = 0x80;
if (width % 8)
framebuffer[(widthBytes * curY) + widthBytes - 1] = (uint8_t)(1 << (7 - ((uint8_t)width % 8)));
else
framebuffer[(widthBytes * curY) + widthBytes - 1] = 0x01;
}
w = width - 1;
x = 1;
while (w--) {
framebuffer[(x / 8) + ((height - 1) * widthBytes)] |= (uint8_t)(1 << (7 - ((uint8_t)x % 8)));
x++;
}
framebuffer -= 4;
addBufferedImage(xpos, ypos, color, rotation::ROTATE_0, framebuffer, DRAW_NORMAL);
free(framebuffer);
}
void drawMask(uint16_t xpos, uint16_t ypos, uint16_t width, uint16_t height, bool color) {
uint16_t widthBytes = width / 8;
if (width % 8) widthBytes++;
uint32_t framebufferSize = widthBytes * height;
uint8_t *framebuffer = (uint8_t *)calloc(framebufferSize + 4, 1);
if (framebuffer == NULL) {
return;
}
((uint16_t *)framebuffer)[0] = width;
((uint16_t *)framebuffer)[1] = height;
framebuffer += 4;
for (uint16_t curY = 0; curY < height; curY++) {
uint16_t w = width;
uint16_t x = 0;
while (w--) {
framebuffer[(x / 8) + (curY * widthBytes)] |= (uint8_t)(1 << (7 - ((uint8_t)x % 8)));
x++;
}
}
framebuffer -= 4;
addBufferedImage(xpos, ypos, color, rotation::ROTATE_0, framebuffer, DRAW_INVERTED);
free(framebuffer);
}
// drawItem (sprite) functions
void drawItem::shiftBytesRight(uint8_t *data, uint8_t shift, uint8_t len) {
// Ensure the shift value is within bounds (0 to 7)
shift = shift % 8;
// Handle the case where shift is 0 or len is 0
if (shift == 0 || len == 0) {
return;
}
// Loop through the array from right to left
for (int i = len - 1; i > 0; i--) {
// Perform the shift by combining bits from the current byte
// and the next byte to its right
data[i] = (data[i] >> shift) | (data[i - 1] << (8 - shift));
}
// For the leftmost byte, simply shift it to the right
data[0] >>= shift;
}
uint8_t drawItem::bitReverse(uint8_t byte) {
byte = ((byte >> 1) & 0x55) | ((byte << 1) & 0xAA);
byte = ((byte >> 2) & 0x33) | ((byte << 2) & 0xCC);
byte = (byte >> 4) | (byte << 4);
return byte;
}
void drawItem::reverseBytes(uint8_t *src, uint8_t src_len) {
// Check for valid input
if (src == NULL || src_len == 0) {
return;
}
// Reverse the entire source array
for (uint8_t i = 0; i < src_len / 2; i++) {
uint8_t temp = src[i];
src[i] = src[src_len - i - 1];
src[src_len - i - 1] = temp;
}
// Reverse the bits within the bytes
for (uint8_t i = 0; i < src_len; i++) {
src[i] = bitReverse(src[i]);
}
}
void drawItem::copyWithByteShift(uint8_t *dst, uint8_t *src, uint8_t src_len, uint8_t offset) {
switch (type) {
case DRAW_MASK:
for (uint8_t i = 0; i < src_len; i++) {
dst[i + offset] &= ~(src[i]);
}
break;
default:
for (uint8_t i = 0; i < src_len; i++) {
dst[i + offset] |= src[i];
}
break;
}
}
void drawItem::renderDrawLine(uint8_t *line, uint16_t number, uint8_t c) {
drawItem *curDrawItem;
for (uint8_t i = 0; i < DRAWITEM_LIST_SIZE; i++) {
curDrawItem = drawItems[i];
if (curDrawItem != nullptr) {
curDrawItem->getDrawLine(line, number, c);
}
}
}
void drawItem::flushDrawItems() {
drawItem *curDrawItem;
for (uint8_t i = 0; i < DRAWITEM_LIST_SIZE; i++) {
curDrawItem = drawItems[i];
if (curDrawItem != nullptr) {
delete curDrawItem;
drawItems[i] = nullptr;
}
}
}
void drawItem::getXLine(uint8_t *line, uint16_t y, uint8_t c) {
switch (type) {
case DRAW_FONT:
case DRAW_BUFFERED_1BPP:
case DRAW_MASK:
if (c != color) return;
if ((y >= ypos) && (y < height + ypos)) { // was y > ypos, not >=
// y = height-y;
if (mirrorV) {
if (mirrorH) {
reverseBytes(&buffer[((height - (y - ypos)) * widthBytes)], widthBytes);
// reverseBytes(&buffer[((y - ypos) * widthBytes)], widthBytes);
} else {
reverseBytes(&buffer[((y - ypos) * widthBytes)], widthBytes);
}
}
if (mirrorH) {
copyWithByteShift(line, &buffer[((height - (y - ypos)) * widthBytes)], widthBytes, xpos / 8);
} else {
copyWithByteShift(line, &buffer[((y - ypos) * widthBytes)], widthBytes, xpos / 8);
}
}
break;
case DRAW_OEPLFS_1BPP:
case DRAW_OEPLFS_2BPP:
if ((color < 2) && (c != color)) return;
if ((y >= ypos) && (y < height + ypos)) { // was y > ypos, not >=
uint32_t offset = 4;
offset += c * height * widthBytes;
OEPLFile *file = (OEPLFile *)this->buffer;
uint8_t *dbuffer = (uint8_t *)malloc(widthBytes);
if (mirrorH) {
file->getBlock(offset + (height - (y - ypos)) * widthBytes, dbuffer, widthBytes);
} else {
file->getBlock(offset + (y - ypos) * widthBytes, dbuffer, widthBytes);
}
if (mirrorV) {
reverseBytes(dbuffer, widthBytes);
}
copyWithByteShift(line, dbuffer, widthBytes, xpos / 8);
free(dbuffer);
}
break;
case DRAW_COMPRESSED:
if ((color < 2) && (c != color)) return;
if ((y >= ypos) && (y < height + ypos)) {
uint32_t offset = this->imageHeaderOffset;
offset += c * height * widthBytes;
decompress *decomp = (decompress *)this->buffer;
uint8_t *dbuffer = (uint8_t *)malloc(widthBytes);
if (mirrorH) {
decomp->getBlock(offset + (height - (y - ypos)) * widthBytes, dbuffer, widthBytes);
} else {
decomp->getBlock(offset + (y - ypos) * widthBytes, dbuffer, widthBytes);
}
if (mirrorV) {
reverseBytes(dbuffer, widthBytes);
}
copyWithByteShift(line, dbuffer, widthBytes, xpos / 8);
free(dbuffer);
}
break;
case DRAW_EEPROM_1BPP:
if (c != color) return;
if (epd->drawDirectionRight)
y = epd->effectiveYRes - 1 - y;
FLASH_Read(FLASH_NORMAL_READ, (uint32_t)buffer + sizeof(struct EepromImageHeader) + (y * (epd->effectiveXRes / 8)), line, (epd->effectiveXRes / 8));
break;
case DRAW_EEPROM_2BPP:
if (epd->drawDirectionRight)
y = epd->effectiveYRes - 1 - y;
FLASH_Read(FLASH_NORMAL_READ, (uint32_t)(buffer + sizeof(struct EepromImageHeader) + ((y + (c * epd->effectiveYRes)) * (epd->effectiveXRes / 8))), line, (epd->effectiveXRes / 8));
break;
default:
printf("Not supported mode!\n");
break;
}
}
void drawItem::getYLine(uint8_t *line, uint16_t x, uint8_t c) {
switch (type) {
case DRAW_FONT:
case DRAW_BUFFERED_1BPP:
if (c != color) return;
if ((x >= xpos) && (x < width + xpos)) {
x -= xpos;
for (uint16_t curY = 0; curY < height; curY++) {
uint16_t curYMirrored = curY;
if (!mirrorH) curYMirrored = height - 1 - curY;
if (mirrorV) {
if (buffer[((width - x) / 8) + (curYMirrored * widthBytes)] & (1 << (7 - ((width - x) % 8)))) {
line[(curY + ypos) / 8] |= (1 << (7 - ((curY + ypos) % 8)));
}
} else {
if (buffer[(x / 8) + (curYMirrored * widthBytes)] & (1 << (7 - (x % 8)))) {
line[(curY + ypos) / 8] |= (1 << (7 - ((curY + ypos) % 8)));
}
}
}
}
break;
case DRAW_MASK:
if (c != color) return;
if ((x >= xpos) && (x < width + xpos)) {
x -= xpos;
for (uint16_t curY = 0; curY < height; curY++) {
uint16_t curYMirrored = curY;
if (!mirrorH) curYMirrored = height - 1 - curY;
if (mirrorV) {
if (buffer[((width - x) / 8) + (curYMirrored * widthBytes)] & (1 << (7 - ((width - x) % 8)))) {
line[(curY + ypos) / 8] &= ~(1 << (7 - ((curY + ypos) % 8)));
}
} else {
if (buffer[(x / 8) + (curYMirrored * widthBytes)] & (1 << (7 - (x % 8)))) {
line[(curY + ypos) / 8] &= ~(1 << (7 - ((curY + ypos) % 8)));
}
}
}
}
break;
case DRAW_OEPLFS_1BPP:
case DRAW_OEPLFS_2BPP:
// this is incredibly slow. For larger images, it'll probably read 128 bytes of eeprom for every -bit- in the image.
if ((color < 2) && (c != color)) return;
if ((x >= xpos) && (x < width + xpos)) {
uint32_t offset = 4;
offset += c * height * widthBytes;
OEPLFile *file = (OEPLFile *)this->buffer;
x -= xpos;
for (uint16_t curY = 0; curY < height; curY++) {
uint16_t curYMirrored = curY;
if (!mirrorH) curYMirrored = height - 1 - curY;
if (mirrorV) {
if (file->readByte(offset + ((width - x) / 8) + (curYMirrored * widthBytes)) & (1 << (7 - ((width - x) % 8)))) {
line[(curY + ypos) / 8] |= (1 << (7 - ((curY + ypos) % 8)));
}
} else {
if (file->readByte(offset + (x / 8) + (curYMirrored * widthBytes)) & (1 << (7 - (x % 8)))) {
line[(curY + ypos) / 8] |= (1 << (7 - ((curY + ypos) % 8)));
}
}
}
}
break;
default:
break;
}
}
void drawItem::getDrawLine(uint8_t *line, uint16_t number, uint8_t c) {
if (direction) {
getYLine(line, number, c);
} else {
getXLine(line, number, c);
}
}
void drawItem::addItem(uint8_t *data, uint16_t w, uint16_t h) {
width = w;
height = h;
widthBytes = w / 8;
if (w % 8) widthBytes++;
buffer = data;
}
bool drawItem::addToList() {
for (uint8_t i = 0; i < DRAWITEM_LIST_SIZE; i++) {
if (drawItems[i] == nullptr) {
drawItems[i] = this;
return true;
};
}
return false;
}
drawItem::~drawItem() {
if (cleanUp) {
switch (this->type) {
case drawItem::drawType::DRAW_OEPLFS_1BPP:
case drawItem::drawType::DRAW_OEPLFS_2BPP: {
OEPLFile *file = (OEPLFile *)this->buffer;
if (file) delete file;
} break;
case drawItem::drawType::DRAW_COMPRESSED: {
decompress *dec = (decompress *)this->buffer;
if (dec) delete dec;
} break;
default:
free(buffer);
break;
}
}
}
drawItem::drawItem() {
if (epd->drawDirectionRight) {
direction = true;
mirrorH = true;
}
}
void drawItem::setRotation(enum rotation ro) {
if (epd->drawDirectionRight) {
direction = true;
mirrorH = true;
}
switch (ro) {
case ROTATE_0:
break;
case ROTATE_270:
direction = !direction;
mirrorH = !mirrorH;
mirrorV = !mirrorV;
break;
case ROTATE_180:
mirrorH = !mirrorH;
mirrorV = !mirrorV;
break;
case ROTATE_90:
direction = !direction;
break;
};
}
// font rendering functions
fontrender::fontrender(char *name) {
this->setFont(name);
}
void fontrender::setFont(char *name) {
if (this->glyphFile) delete this->glyphFile;
if (this->bitmapFile) delete this->bitmapFile;
OEPLFile *font = fs->getFile(name);
if (!font)
printf("Couldn't open font file %s\n", name);
// else
// printf("Opened %s\n", name);
font->getBlock(0, (uint8_t *)&this->gfxFont, sizeof(GFXFontOEPL));
this->glyphFile = fs->getFile(this->gfxFont.glyphFile);
this->bitmapFile = fs->getFile(this->gfxFont.bitmapFile);
if (!this->glyphFile) printf("Couldn't open font file %s\n", name);
if (!this->bitmapFile) printf("Couldn't open font file %s\n", name);
if (font) delete (font);
}
fontrender::~fontrender() {
if (this->glyphFile) delete this->glyphFile;
if (this->bitmapFile) delete this->bitmapFile;
}
void fontrender::drawFastHLine(uint16_t x, uint16_t y, uint16_t w) {
while (w--) {
fb[(x / 8) + (y * bufferByteWidth)] |= (uint8_t)(1 << (7 - ((uint8_t)x % 8)));
x++;
}
}
void fontrender::fillRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
for (uint16_t curY = y; curY < y + h; curY++) {
drawFastHLine(x, curY, w);
}
}
uint8_t fontrender::getCharWidth(uint16_t c) {
if ((c >= gfxFont.first) && (c <= gfxFont.last)) {
c -= gfxFont.first;
// GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c]);
GFXglyph glyph = this->getGlyph(c);
return glyph.xAdvance;
}
return 0;
}
uint8_t fontrender::drawChar(int32_t x, int32_t y, uint16_t c, uint8_t size) {
// Filter out bad characters not present in font
if ((c >= gfxFont.first) && (c <= gfxFont.last)) {
c -= gfxFont.first;
GFXglyph glyph = this->getGlyph(c);
// uint8_t *bitmap = (uint8_t *)gfxFont->bitmap;
uint32_t bo = glyph.bitmapOffset;
uint8_t w = glyph.width,
h = glyph.height;
int8_t xo = glyph.xOffset,
yo = glyph.yOffset;
uint8_t xx, yy, bits = 0, bit = 0;
int16_t xo16 = 0, yo16 = 0;
if (size > 1) {
xo16 = xo;
yo16 = yo;
}
// GFXFF rendering speed up
uint16_t hpc = 0; // Horizontal foreground pixel count
for (yy = 0; yy < h; yy++) {
for (xx = 0; xx < w; xx++) {
if (bit == 0) {
// bits = bitmap[bo++];
bits = (*this->bitmapFile)(bo++);
bit = 0x80;
}
if (bits & bit)
hpc++;
else {
if (hpc) {
if (size == 1)
drawFastHLine(x + xo + xx - hpc, y + yo + yy, hpc);
else
fillRect(x + (xo16 + xx - hpc) * size, y + (yo16 + yy) * size, size * hpc, size);
hpc = 0;
}
}
bit >>= 1;
}
// Draw pixels for this line as we are about to increment yy
if (hpc) {
if (size == 1)
drawFastHLine(x + xo + xx - hpc, y + yo + yy, hpc);
else
fillRect(x + (xo16 + xx - hpc) * size, y + (yo16 + yy) * size, size * hpc, size);
hpc = 0;
}
}
return glyph.xAdvance;
}
return 0;
}
void fontrender::epdPrintf(uint16_t x, uint16_t y, bool color, enum rotation ro, const char *c, ...) {
drawItem *di = new drawItem;
if (di == nullptr) return;
di->setRotation(ro);
// prepare a drawItem, exchange x/y if necessary.
if (di->direction ^ epd->drawDirectionRight) {
int16_t temp = x;
x = y;
y = temp;
}
// output string using vsnprintf
char out_buffer[256];
va_list lst;
va_start(lst, c);
uint8_t len = vsnprintf(out_buffer, 255, c, lst);
va_end(lst);
// account for offset in font rendering
if (!di->direction) {
Xpixels = x % 8; // total drawing width increased by x%8
} else {
Xpixels = 0;
}
// find out the total length of the string
for (uint8_t c = 0; c < len; c++) {
Xpixels += (uint16_t)getCharWidth(out_buffer[c]);
}
// find out the high and low points for given font
int8_t high = 0;
int8_t low = 0;
for (uint8_t curchar = 0; curchar < len; curchar++) {
uint8_t c = out_buffer[curchar];
if ((c >= gfxFont.first) && (c <= gfxFont.last)) {
c -= gfxFont.first;
GFXglyph g = this->getGlyph(c);
int8_t glyphUL = g.yOffset;
if (glyphUL < high) high = glyphUL;
int8_t glyphHeight = g.height;
if ((glyphUL + glyphHeight) > low) low = glyphUL + glyphHeight;
}
}
// Actual font height (reduces memory footprint)
int8_t height = -1 * (high - low) + 1;
// determine actual width
bufferByteWidth = Xpixels / 8;
if (Xpixels % 8) bufferByteWidth++;
// allocate framebuffer
fb = (uint8_t *)calloc(bufferByteWidth * height, 1);
if (!fb) {
printf("Failed to allocate buffer for drawitem, we can't render this text!\n");
printf("Tried to allocate a buffer %d x %d\n", bufferByteWidth, height);
delete di;
return;
}
uint16_t curX;
if (!di->direction) {
curX = x % 8; // start drawing at x%8s
} else {
curX = 0;
}
for (uint8_t c = 0; c < len; c++) {
curX += (uint16_t)drawChar(curX, height - low, out_buffer[c], 1);
}
di->addItem(fb, curX, height);
di->ypos = y;
di->xpos = x;
di->color = color;
di->type = drawItem::drawType::DRAW_FONT;
di->addToList();
}
GFXglyph fontrender::getGlyph(uint16_t c) {
GFXglyph g;
this->glyphFile->getBlock(sizeof(GFXglyph) * c, (uint8_t *)&g, sizeof(GFXglyph));
return g;
}

View File

@@ -2,12 +2,132 @@
#define _DRAWING_H_
#include <stdint.h>
#include <stdbool.h>
#include "oepl_fs.h"
#define DRAWING_MIN_BITMAP_SIZE (128) //minimum size we'll consider
#define COLOR_RED 1
#define COLOR_BLACK 0
#define COLOR_DUAL 2
void set_offline(bool state);
void drawImageAtAddress(uint32_t addr, uint8_t lut);
void drawImageFromBuffer(uint8_t* buffer, const uint8_t lut);
#define IMAGE_OR 1
#define IMAGE_REPLACE 0
#define DRAW_INVERTED 1
#define DRAW_NORMAL 0
#define FILENAME_LENGTH 32
typedef struct __attribute__ ((packed)) {
uint16_t bitmapOffset; ///< Pointer into GFXfont->bitmap
uint8_t width; ///< Bitmap dimensions in pixels
uint8_t height; ///< Bitmap dimensions in pixels
uint8_t xAdvance; ///< Distance to advance cursor (x axis)
int8_t xOffset; ///< X dist from cursor pos to UL corner
int8_t yOffset; ///< Y dist from cursor pos to UL corner
} GFXglyph;
enum rotation {
ROTATE_0,
ROTATE_90,
ROTATE_180,
ROTATE_270
};
typedef struct __attribute__ ((packed)) {
uint16_t first;
uint16_t last;
uint8_t yAdvance;
char glyphFile[FILENAME_LENGTH];
char bitmapFile[FILENAME_LENGTH];
} GFXFontOEPL;
extern "C"{
void drawImageAtAddress(uint32_t addr, uint8_t lut);
}
void addBufferedImage(uint16_t x, uint16_t y, bool color, enum rotation ro, const uint8_t *image, bool mask);
// void addFlashImage(uint16_t x, uint16_t y, bool color, enum rotation ro, const uint8_t *image);
void addQR(uint16_t x, uint16_t y, uint8_t version, uint8_t scale, const char *c, ...);
void drawRoundedRectangle(uint16_t xpos, uint16_t ypos, uint16_t width, uint16_t height, bool color);
void drawMask(uint16_t xpos, uint16_t ypos, uint16_t width, uint16_t height, bool color);
void addFSImage(uint16_t x, uint16_t y, uint8_t color, enum rotation ro, char *name);
void addCompressedFSImage(uint16_t x, uint16_t y, enum rotation ro, char *name);
class drawItem {
public:
drawItem();
~drawItem();
void setRotation(enum rotation ro);
void addItem(uint8_t *data, uint16_t width, uint16_t height);
bool addToList();
static void shiftBytesRight(uint8_t *data, uint8_t shift, uint8_t len);
static void renderDrawLine(uint8_t *line, uint16_t number, uint8_t c);
static void flushDrawItems();
// these are also used for rotated screens
static void reverseBytes(uint8_t *src, uint8_t src_len);
static uint8_t bitReverse(uint8_t byte);
enum drawType {
DRAW_FONT,
DRAW_BUFFERED_1BPP,
DRAW_MASK,
DRAW_EEPROM_1BPP,
DRAW_EEPROM_2BPP,
DRAW_COMPRESSED,
DRAW_OEPLFS_1BPP,
DRAW_OEPLFS_2BPP
} type;
int16_t xpos;
int16_t ypos;
enum rotation rotate = ROTATE_0;
uint8_t color = 0;
bool direction = false;
bool mirrorH = false;
bool mirrorV = false;
uint16_t width;
uint16_t height;
uint8_t imageHeaderOffset = 0;
// if this is true, clean up the reference (free memory).
bool cleanUp = true;
protected:
void copyWithByteShift(uint8_t *dst, uint8_t *src, uint8_t src_len, uint8_t offset);
void getDrawLine(uint8_t *line, uint16_t number, uint8_t c);
void getXLine(uint8_t *line, uint16_t yPos, uint8_t color);
void getYLine(uint8_t *line, uint16_t xPos, uint8_t color);
uint8_t widthBytes = 0;
uint8_t *buffer = nullptr;
};
class fontrender {
public:
void epdPrintf(uint16_t x, uint16_t y, bool color, enum rotation ro, const char *c, ...);
fontrender(char* name);
~fontrender();
void setFont(char* name);
protected:
GFXFontOEPL gfxFont;
uint16_t bufferByteWidth = 0;
uint8_t *fb = nullptr;
uint16_t Xpixels;
uint8_t drawChar(int32_t x, int32_t y, uint16_t c, uint8_t size);
uint8_t getCharWidth(uint16_t c);
void drawFastHLine(uint16_t x, uint16_t y, uint16_t w);
void fillRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
GFXglyph getGlyph(uint16_t c);
OEPLFile *glyphFile = nullptr;
OEPLFile *bitmapFile = nullptr;
};
#endif

View File

@@ -1,818 +0,0 @@
#include "epd.h"
#include <stdbool.h>
#include <stdint.h>
// #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "12x20_horizontal_LSB_1.h"
#include "core_cm3.h"
#include "gpio.h"
#include "main.h"
#include "mz100_clock.h"
#include "mz100_gpio.h"
#include "mz100_pinmux.h"
#include "mz100_ssp.h"
#include "mz100_wdt.h"
#include "printf.h"
#include "stdarg.h"
#include "util.h"
#define EPD_PANEL_SETTING 0x00
#define EPD_POWER_SETTING 0x01
#define EPD_POWER_OFF 0x02
#define EPD_POWER_OFF_SEQUENCE 0x03
#define EPD_POWER_ON 0x04
#define EPD_BOOSTER_SOFT_START 0x06
#define EPD_DEEP_SLEEP 0x07
#define EPD_START_DATA 0x10
#define EPD_DATA_STOP 0x11
#define EPD_REFRESH 0x12
#define EPD_IMAGE_PROCESS 0x13
#define EPD_LUT_VCOM 0x20
#define EPD_LUT_B 0x21
#define EPD_LUT_W 0x22
#define EPD_LUT_G1 0x23
#define EPD_LUT_G2 0x24
#define EPD_LUT_R0 0x25
#define EPD_LUT_R1 0x26
#define EPD_LUT_R2 0x27
#define EPD_LUT_R3 0x28
#define EPD_LUT_XON 0x29
#define EPD_PLL_CONTROL 0x30
#define EPD_TEMP_CALIB 0x40
#define EPD_TEMP_SELECT 0x41
#define EPD_TEMP_WRITE 0x42
#define EPD_TEMP_READ 0x43
#define EPD_VCOM_DATA_INTERVAL 0x50
#define EPD_LPD 0x51
#define EPD_TCON_SET 0x60
#define EPD_TRES 0x61
#define EPD_SPI_FLASH_CONTROL 0x65
#define EPD_REVISION 0x70
#define EPD_GET_STATUS 0x71
#define EPD_AUTOMEASURE_VCOM 0x80
#define EPD_READ_VCOM 0x81
#define EPD_VCOM_DC_SET 0x82
#define EPD_SET_WINDOW 0x90
#define EPD_WAKE_EEPROM 0xAB
#define EPD_EEPROM_SLEEP 0xB9
#define EPD_UNKNOWN_1 0xE5
static uint8_t EPDtempBracket = 0;
#define CHAR_WIDTH_BYTES 2
#define CHAR_HEIGHT 20
#define CHAR_WIDTH 12
#define SCREEN_WIDTH 640
uint8_t buffer[CHAR_HEIGHT][640 / 8];
uint8_t charbuffer[CHAR_HEIGHT][CHAR_WIDTH_BYTES + 1];
#define CHAR_SPACING 1
#define EMPTY_SPACING 3
struct epd_colorlutpart {
uint8_t repeat;
uint8_t lvl0 : 4;
uint8_t lvl1 : 4;
uint8_t lvl2 : 4;
uint8_t lvl3 : 4;
uint8_t lvl4 : 4;
uint8_t lvl5 : 4;
uint8_t lvl6 : 4;
uint8_t lvl7 : 4;
uint8_t length[8];
} __packed;
struct epd_colorlut {
struct epd_colorlutpart part[20];
} __packed;
struct epd_vcomlutpart {
uint8_t repeat;
uint8_t lvl0 : 2;
uint8_t lvl1 : 2;
uint8_t lvl2 : 2;
uint8_t lvl3 : 2;
uint8_t lvl4 : 2;
uint8_t lvl5 : 2;
uint8_t lvl6 : 2;
uint8_t lvl7 : 2;
uint8_t length[8];
} __packed;
struct epd_vcomlut {
struct epd_vcomlutpart part[20];
} __packed;
struct epd_xonlutpart {
uint8_t repeat;
uint8_t lvl0 : 1;
uint8_t lvl1 : 1;
uint8_t lvl2 : 1;
uint8_t lvl3 : 1;
uint8_t lvl4 : 1;
uint8_t lvl5 : 1;
uint8_t lvl6 : 1;
uint8_t lvl7 : 1;
uint8_t length[8];
} __packed;
struct epd_xonlut {
struct epd_xonlutpart part[20];
} __packed;
void interleaveBW(uint8_t b) {
b ^= 0xFF;
uint8_t b_out = 0;
for (uint8_t shift = 0; shift < 4; shift++) {
b_out = 0;
if ((b >> 2 * shift) & 0x01) b_out |= 0x30; // 0x30
if ((b >> 2 * shift) & 0x02) b_out |= 0x03; // 0x03
display_tx_byte(b_out);
}
}
void interleaveColor(uint8_t b, uint8_t r) {
b ^= 0xFF;
uint8_t b_out = 0;
for (int8_t shift = 3; shift >= 0; shift--) {
b_out = 0;
if (((b >> 2 * shift) & 0x01) && ((r >> 2 * shift) & 0x01)) {
b_out |= 0x04; // 0x30
} else if ((b >> 2 * shift) & 0x01) {
b_out |= 0x03; // 0x30
} else if ((r >> 2 * shift) & 0x01) { // 4 or 5
b_out |= 0x04; // 0x30
} else {
}
if (((b >> 2 * shift) & 0x02) && ((r >> 2 * shift) & 0x02)) {
b_out |= 0x40; // 0x30
} else if ((b >> 2 * shift) & 0x02) {
b_out |= 0x30; // 0x30
} else if ((r >> 2 * shift) & 0x02) {
b_out |= 0x40; // 0x30
} else {
}
display_tx_byte(b_out);
}
}
void epdWrite(uint8_t reg, uint8_t len, ...) {
va_list valist;
va_start(valist, len);
epd_pin_enable(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
GPIO_WritePinOutput(EPD_DC, GPIO_IO_LOW);
SSP_SendData(SSP2_ID, reg);
for (int i = 0; i < 0xF; ++i)
__ISB();
GPIO_WritePinOutput(EPD_DC, GPIO_IO_HIGH);
for (uint8_t i = 0; i < len; i++) {
SSP_SendData(SSP2_ID, va_arg(valist, int));
}
for (int j = 0; j < 0xF; ++j)
__ISB();
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
epd_pin_enable(0);
va_end(valist);
}
void epd_reset() {
uint8_t v0 = 5;
printf("Resetting...");
while (1) {
GPIO_WritePinOutput(EPD_RESET, GPIO_IO_HIGH);
delay(100);
GPIO_WritePinOutput(EPD_RESET, GPIO_IO_LOW);
delay(3000);
GPIO_WritePinOutput(EPD_RESET, GPIO_IO_HIGH);
delay(3000);
if (GPIO_ReadPinLevel(EPD_BUSY))
break;
v0--;
if (!v0) {
printf("EPD reset failure\r\n");
break;
}
}
delay(5000);
printf(" Reset complete\n");
}
void EPD_cmd(char a1) {
epd_pin_enable(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
GPIO_WritePinOutput(EPD_DC, GPIO_IO_LOW);
SSP_SendData(SSP2_ID, a1);
for (int i = 0; i < 0xF; ++i)
__ISB();
epd_pin_enable(0);
GPIO_WritePinOutput(EPD_DC, GPIO_IO_HIGH);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
}
void EPD_data(char a1) {
epd_pin_enable(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
SSP_SendData(SSP2_ID, a1);
for (int i = 0; i < 0xF; ++i)
__ISB();
epd_pin_enable(0);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
}
void spi_soft_send_byte(char a1) {
uint8_t v2 = 0;
do {
if ((a1 & 0x80) != 0)
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_HIGH);
else
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_LOW);
delay_us(1);
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_HIGH);
delay_us(1);
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_LOW);
a1 *= 2;
v2++;
} while (v2 < 8);
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_LOW);
delay_us(1);
}
void BUSY_wait(unsigned int a1) {
unsigned int v2 = 0;
while (GPIO_ReadPinLevel(EPD_BUSY) == GPIO_IO_LOW) {
delay(10000);
v2++;
if (v2 > a1)
break;
if (((v2 % 1000) / 10) == 0)
WDT_RestartCounter();
}
}
void spi_soft_read_buffer(char a1, uint16_t readaddress, uint8_t *target, uint16_t length) {
char v9;
unsigned int v10;
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
GPIO_WritePinOutput(EPD_HLT_CTRL, GPIO_IO_LOW);
spi_soft_send_byte(3);
spi_soft_send_byte(a1);
spi_soft_send_byte(readaddress >> 8);
spi_soft_send_byte(readaddress);
delay_us(5);
for (uint16_t i = 0; i < length; i++) {
v9 = 0;
v10 = 0;
do {
v9 *= 2;
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_LOW);
delay_us(1);
if (GPIO_ReadPinLevel(EPD_MISO))
v9 |= 1u;
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_HIGH);
delay_us(1);
v10++;
} while (v10 < 8);
delay_us(1);
*target++ = v9;
}
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_LOW);
GPIO_WritePinOutput(EPD_HLT_CTRL, GPIO_IO_HIGH);
}
int spi_soft_read_byte() {
int v0;
unsigned int v1;
v0 = 0;
GPIO_WritePinOutput(EPD_BS, GPIO_IO_HIGH);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
delay_us(1);
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_HIGH);
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_HIGH);
delay_us(1);
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_LOW);
delay_us(1);
GPIO_SetPinDir(EPD_MOSI, GPIO_INPUT);
GPIO_PinMuxFun(EPD_MOSI, 0);
delay_us(3);
v1 = 0;
do {
v0 = (uint8_t)(2 * v0);
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_HIGH);
if (GPIO_ReadPinLevel(EPD_MOSI))
v0 |= 1u;
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_LOW);
delay_us(1);
v1++;
} while (v1 < 8);
GPIO_SetPinDir(EPD_MOSI, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_MOSI, 0);
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_LOW);
delay_us(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
delay_us(1);
GPIO_WritePinOutput(EPD_BS, GPIO_IO_LOW);
return v0;
}
uint8_t getTempBracket() {
uint8_t v0;
uint8_t v1;
uint8_t temptable[40];
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(1);
delay_us(1000);
spi_soft_read_buffer(0, 25002, temptable, 10);
delay_us(1000);
delay_us(1000);
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(0);
EPD_cmd(EPD_TEMP_CALIB);
BUSY_wait(0xAu);
v0 = spi_soft_read_byte();
v1 = (uint8_t)(2 * v0) + ((uint8_t)spi_soft_read_byte() >> 7);
uint8_t bracket = 0;
for (int i = 0; i < 9; i++) {
if ((((char)v1 - (uint8_t)temptable[i]) & 0x80) != 0) {
bracket = i;
break;
}
}
return bracket;
}
void loadFrameRatePLL(uint8_t bracket) {
uint8_t pllvalue;
uint8_t plltable[12];
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(1);
delay_us(1000);
spi_soft_read_buffer(0, 25039, plltable, 10);
delay_us(1000);
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(0);
pllvalue = plltable[bracket];
EPD_cmd(EPD_PLL_CONTROL);
EPD_data(pllvalue);
}
extern void dump(const uint8_t *a, const uint16_t l);
void loadTempVCOMDC(uint8_t bracket) {
uint8_t vcomvalue;
uint8_t vcomtable[12];
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(1);
delay_us(1000);
spi_soft_read_buffer(0, 25049, vcomtable, 10);
delay_us(1000);
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(0);
vcomvalue = vcomtable[bracket];
EPD_cmd(EPD_VCOM_DC_SET);
EPD_data(vcomvalue);
}
uint8_t *loadLUT(uint8_t index, uint8_t bracket) {
uint16_t adr = 0;
uint16_t len = 0;
uint8_t *lutBuffer;
switch (index) {
case EPD_LUT_VCOM:
// VCOM LUT
adr = 20800 + (220 * bracket);
len = 220;
break;
case EPD_LUT_B:
case EPD_LUT_W:
case EPD_LUT_G1:
case EPD_LUT_G2:
case EPD_LUT_R0:
case EPD_LUT_R1:
case EPD_LUT_R2:
case EPD_LUT_R3:
adr = (bracket * 2080);
adr += (index - 0x21) * 260;
len = 260;
break;
case EPD_LUT_XON:
// XON LUT
adr = 23000 + (200 * bracket);
len = 200;
break;
}
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(1);
delay_us(1000);
lutBuffer = malloc(len);
if (lutBuffer) spi_soft_read_buffer(0, adr, lutBuffer, len);
delay_us(1000);
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(0);
return lutBuffer;
}
void shiftRightByX(uint8_t *data, int X, int N) {
if (X < 0 || X >= 8) {
// Invalid shift value, X should be between 0 and 7 (inclusive)
return;
}
// Perform the shift operation on each byte in the range
for (int i = 0; i < N; i++) {
data[i] = (data[i] >> X) | ((data[i + 1] & ((1 << X) - 1)) << (8 - X));
}
}
void shiftLeftByX(uint8_t *data, int X, int N) {
if (X < 0 || X >= 8) {
// Invalid shift value, X should be between 0 and 7 (inclusive)
return;
}
// Perform the shift operation on each byte in the range
for (int i = N - 1; i >= 0; i--) {
data[i] = (data[i] << X) | ((data[i - 1] >> (8 - X)) & ((1 << X) - 1));
}
}
uint16_t loadCharacter(uint8_t currentChar, uint16_t curX, bool first) {
currentChar -= 0x20;
memset(charbuffer, 0, sizeof(charbuffer));
for (uint8_t d = 0; d < CHAR_HEIGHT; d++) {
for (uint8_t c = 0; c < CHAR_WIDTH_BYTES; c++) {
charbuffer[d][c] = font[currentChar][c + (2 * d)];
}
}
// find amount of left whitespace and compensate
uint8_t leftShift = 0;
for (uint8_t left = 0; left < CHAR_WIDTH; left++) {
bool leftAdjusted = false;
for (uint8_t height = 0; height < CHAR_HEIGHT; height++) {
if (charbuffer[height][0] & 0x01) {
leftAdjusted = true;
break;
}
}
if (leftAdjusted) {
break;
} else {
for (uint8_t height = 0; height < CHAR_HEIGHT; height++) {
shiftRightByX(&(charbuffer[height][0]), 1, CHAR_WIDTH_BYTES);
}
leftShift++;
}
}
// find width for character
uint8_t width = 0;
for (int8_t curBit = CHAR_WIDTH + 1; curBit > 0; curBit--) {
bool widthFound = false;
for (uint8_t height = 0; height < CHAR_HEIGHT; height++) {
if (charbuffer[height][curBit / 8] & (1 << (curBit % 8))) {
widthFound = true;
break;
}
}
if (widthFound) {
width = curBit + 1;
break;
}
}
if (!first) {
curX += CHAR_SPACING;
}
for (uint8_t height = 0; height < CHAR_HEIGHT; height++) {
shiftLeftByX(&(charbuffer[height][0]), curX % 8, CHAR_WIDTH_BYTES + 1);
}
for (uint8_t d = 0; d < CHAR_HEIGHT; d++) {
for (uint8_t c = 0; c < CHAR_WIDTH_BYTES + 1; c++) {
buffer[d][(curX / 8) + c] |= charbuffer[d][c];
}
}
if (width == 0) width = EMPTY_SPACING;
curX += width;
return curX;
}
void dumpBuffer(uint16_t xloc, uint16_t yloc, uint16_t width) {
xloc = SCREEN_WIDTH - xloc;
setDisplayWindow(xloc - width, yloc, xloc, yloc + CHAR_HEIGHT);
display_send_start(0);
for (uint8_t curY = 0; curY < CHAR_HEIGHT; curY++) {
for (uint16_t curX = 0; curX < width; curX += 8) {
interleaveBW(buffer[curY][curX / 8]);
}
}
display_send_stop();
}
void loadLUTSfromEEPROM(uint8_t bracket) {
for (uint8_t c = EPD_LUT_B; c <= EPD_LUT_R3; c++) {
struct epd_colorlut *colorlut = (struct epd_colorlut *)loadLUT(c, bracket);
for (uint8_t d = 0; d < 8; d++) {
colorlut->part[1].length[d] = 1;
colorlut->part[0].length[d] = 1;
}
for (uint8_t part = 0; part < 4; part++) {
if (colorlut->part[part].repeat) colorlut->part[part].repeat = 1;
}
for (uint8_t part = 4; part < 20; part++) {
if (colorlut->part[part].repeat) colorlut->part[part].repeat = 0;
}
lutBeginTX(c);
for (uint16_t d = 0; d < 260; d++) {
display_tx_byte(((uint8_t *)colorlut)[d]);
}
lutEndTX();
if (colorlut) free(colorlut);
}
struct epd_vcomlut *vcomlut = (struct epd_vcomlut *)loadLUT(EPD_LUT_VCOM, bracket);
for (uint8_t part = 0; part < 20; part++) {
if (vcomlut->part[part].repeat) vcomlut->part[part].repeat = 0;
}
lutBeginTX(EPD_LUT_VCOM);
for (uint16_t d = 0; d < 220; d++) {
display_tx_byte(((uint8_t *)vcomlut)[d]);
}
lutEndTX();
if (vcomlut) free(vcomlut);
struct epd_xonlut *xonlut = (struct epd_xonlut *)loadLUT(EPD_LUT_XON, bracket);
// memset(&(xonlut->part[0].repeat), 0x00, sizeof(struct epd_xonlutpart));
// memset(&(xonlut->part[1].repeat), 0x00, sizeof(struct epd_xonlutpart));
for (uint8_t part = 0; part < 20; part++) {
if (xonlut->part[part].repeat) xonlut->part[part].repeat = 0;
}
lutBeginTX(EPD_LUT_XON);
for (uint16_t d = 0; d < 200; d++) {
display_tx_byte(((uint8_t *)xonlut)[d]);
}
lutEndTX();
if (xonlut) free(xonlut);
}
void init_GPIO_EPD() {
SSP_CFG_Type v0;
SPI_Param_Type spiParaStruct;
GPIO_PinMuxFun(EPD_MOSI, 0);
GPIO_SetPinDir(EPD_MOSI, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_CLK, 0);
GPIO_SetPinDir(EPD_CLK, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_CS, 0);
GPIO_SetPinDir(EPD_CS, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
GPIO_PinMuxFun(EPD_BUSY, 0);
GPIO_SetPinDir(EPD_BUSY, GPIO_INPUT);
GPIO_PinModeConfig(EPD_BUSY, PINMODE_PULLUP);
GPIO_PinMuxFun(EPD_RESET, 0);
GPIO_SetPinDir(EPD_RESET, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_RESET, GPIO_IO_HIGH);
GPIO_PinMuxFun(EPD_DC, 0);
GPIO_SetPinDir(EPD_DC, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_DC, GPIO_IO_HIGH);
GPIO_PinMuxFun(EPD_BS, 0);
GPIO_SetPinDir(EPD_BS, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_BS, GPIO_IO_LOW);
GPIO_PinMuxFun(EPD_HLT_CTRL, 0);
GPIO_SetPinDir(EPD_HLT_CTRL, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_HLT_CTRL, GPIO_IO_HIGH);
GPIO_PinMuxFun(EPD_MISO, 0);
GPIO_SetPinDir(EPD_MISO, GPIO_INPUT);
GPIO_PinModeConfig(EPD_MISO, PINMODE_DEFAULT);
memset(&v0, 0, 9);
v0.timeOutVal = 0;
SSP_Init(SSP2_ID, &v0);
spiParaStruct.spiClkPhase = SPI_SCPHA_1;
spiParaStruct.spiClkPolarity = SPI_SCPOL_LOW;
SPI_Config(SSP2_ID, &spiParaStruct);
CLK_I2SClkSrc(CLK_I2S_XTAL32M);
CLK_SSPClkSrc(CLK_SSP_ID_2, CLK_SSP_I2S);
CLK_I2SClkDivider(1, 1);
}
void fillWindow(uint16_t x, uint16_t y, uint16_t xe, uint16_t ye, uint8_t color) {
setDisplayWindow(x, y, xe, ye);
display_send_start(0);
for (uint32_t c = 0; c < (xe - x) * (ye - y) / 8; c++) {
interleaveBW(0x00);
}
display_send_stop();
}
void epd_refresh_and_sleep(uint8_t lut) {
if (lut) {
epdWrite(EPD_PANEL_SETTING, 2, 0xC3, 0x88); // 0xC3-0x88 // lut from register
loadLUTSfromEEPROM(EPDtempBracket);
} else {
epdWrite(EPD_PANEL_SETTING, 2, 0xC3, 0x08); // 0xC3-0x88 // lut from EEPROM
epdWrite(EPD_UNKNOWN_1, 1, 0x03); // load lut, probably
}
// epdPrintf(50,100,false,"Blaat! Dit is een test %d", 6);
EPD_cmd(EPD_REFRESH);
unsigned int v2 = 0;
while (GPIO_ReadPinLevel(EPD_BUSY) == GPIO_IO_HIGH) {
WDT_RestartCounter();
delay(10000);
v2++;
if (v2 > 10)
break;
}
do_sleeped_epd_refresh();
init_GPIO_EPD();
epd_reset();
// epd_reset();
EPD_cmd(EPD_POWER_SETTING);
EPD_data(2);
EPD_data(0);
EPD_data(0);
EPD_data(0);
delay_us(50000);
EPD_cmd(EPD_POWER_OFF);
delay_us(100000);
BUSY_wait(0x32u);
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(1);
GPIO_WritePinOutput(EPD_HLT_CTRL, GPIO_IO_LOW);
spi_soft_send_byte(EPD_EEPROM_SLEEP);
GPIO_WritePinOutput(EPD_HLT_CTRL, GPIO_IO_HIGH);
EPD_cmd(EPD_SPI_FLASH_CONTROL);
EPD_data(0);
EPD_cmd(EPD_DEEP_SLEEP);
EPD_data(0xA5);
}
void epd_pin_enable(int a1) {
if (a1) {
GPIO_PinMuxFun(EPD_CLK, GPIO22_SSP2_SCK);
GPIO_PinMuxFun(EPD_MOSI, GPIO12_SSP2_TXD);
GPIO_PinMuxFun(EPD_MISO, GPIO13_SSP2_RXD);
SSP_Enable(SSP2_ID);
} else {
SSP_Disable(SSP2_ID);
GPIO_PinMuxFun(EPD_MOSI, 0);
GPIO_SetPinDir(EPD_MOSI, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_CLK, 0);
GPIO_SetPinDir(EPD_CLK, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_MISO, 0);
GPIO_SetPinDir(EPD_MISO, GPIO_INPUT);
GPIO_PinModeConfig(EPD_MISO, PINMODE_DEFAULT);
}
}
void lutBeginTX(uint8_t reg) {
EPD_cmd(reg);
epd_pin_enable(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
}
void lutEndTX() {
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
epd_pin_enable(0);
}
void setDisplayWindow(uint16_t x, uint16_t y, uint16_t xe, uint16_t ye) {
x &= 0xFFF8; // byte boundary
xe = (xe - 1) | 0x0007; // byte boundary - 1
EPD_cmd(0x91);
epdWrite(0x90, 9, x / 256, x % 256, xe / 256, xe % 256, y / 256, y % 256, ye / 256, ye % 256, 0x01);
}
void display_tx_byte(uint8_t data) {
SSP_SendData(SSP2_ID, data);
}
void display_send_start(uint8_t inverted) {
EPD_cmd(EPD_START_DATA);
epd_pin_enable(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
}
void display_send_stop() {
for (int i = 0; i < 0xF; ++i)
__ISB();
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
epd_pin_enable(0);
}
void init_epd(void) {
printf("EPD Powerup begin\n");
init_GPIO_EPD();
epd_reset();
EPD_cmd(EPD_POWER_ON);
BUSY_wait(0x32u);
// wake the eeprom
epdWrite(EPD_SPI_FLASH_CONTROL, 1, 0x01);
GPIO_WritePinOutput(EPD_HLT_CTRL, GPIO_IO_LOW);
epdWrite(EPD_WAKE_EEPROM, 0x00);
GPIO_WritePinOutput(EPD_HLT_CTRL, GPIO_IO_HIGH);
epdWrite(EPD_SPI_FLASH_CONTROL, 1, 0x00);
epdWrite(EPD_POWER_SETTING, 4, 0x37, 0x00, 0x05, 0x05); // 0x37 - 00- 05 05
// epdWrite(EPD_POWER_SETTING, 4, 0x07, 0x00, 0x05, 0x05); // 0x37 - 00- 05 05
epdWrite(EPD_PANEL_SETTING, 2, 0xC3, 0x08); // 0xC3-0x88 // lut from EEPROM
epdWrite(EPD_POWER_OFF_SEQUENCE, 1, 0x00);
epdWrite(EPD_BOOSTER_SOFT_START, 0x03, 199, 204, 45);
epdWrite(EPD_PLL_CONTROL, 0x01, 60);
epdWrite(EPD_TEMP_SELECT, 0x01, 0x00);
epdWrite(EPD_VCOM_DATA_INTERVAL, 0x01, 119);
epdWrite(EPD_TCON_SET, 0x01, 34);
epdWrite(EPD_TRES, 0x04, 2, 128, 1, 128);
EPDtempBracket = getTempBracket();
loadFrameRatePLL(EPDtempBracket);
loadTempVCOMDC(EPDtempBracket);
}
void epdPrintf(uint16_t x, uint16_t y, bool color, const char *c, ...) {
// Render the text
char out_buffer[96];
uint16_t curX = 0;
memset(buffer, 0, sizeof(buffer));
memset(charbuffer, 0, sizeof(charbuffer));
va_list lst;
va_start(lst, c);
vsnprintf(out_buffer, 256, c, lst);
va_end(lst);
curX = x % 8;
char *text = (char *)out_buffer;
memset(charbuffer, 0, sizeof(charbuffer));
curX = loadCharacter(*text, curX, true);
text++;
while (*text != '\0') {
memset(charbuffer, 0, sizeof(charbuffer));
curX = loadCharacter(*text, curX, false);
text++;
}
x /= 8;
x *= 8;
dumpBuffer(x, y, curX);
}
void drawImg(uint16_t x, uint16_t y, const uint8_t *img) {
uint16_t width = img[0];
uint16_t height = img[1];
img += 2;
setDisplayWindow(x, y, x + width, y + height);
display_send_start(0);
for (uint8_t curY = 0; curY < height; curY++) {
for (uint16_t curX = 0; curX < width; curX += 8) {
interleaveColor(*(img++), 0x00);
}
}
display_send_stop();
}

View File

@@ -1,58 +0,0 @@
#pragma once
//#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#define DISPLAY_WIDTH (640)
#define DISPLAY_HEIGHT (384)
#define DISPLAY_WIDTH_MM (164)
#define DISPLAY_HEIGHT_MM (97)
#define MAGNIFY1 3
#define MAGNIFY2 2
#define MAGNIFY3 1
#define BACK_COLOR 3
#define FORE_COLOR_1 0
#define FORE_COLOR_2 4
#define FORE_COLOR_3 0
#define EPD_LUT_DEFAULT 0
#define EPD_LUT_NO_REPEATS 1
#define EPD_LUT_FAST_NO_REDS 2
#define EPD_LUT_FAST 3
#define EPD_DIRECTION_X false
#define EPD_DIRECTION_Y true
#define EPD_SIZE_SINGLE false
#define EPD_SIZE_DOUBLE true
#define EPD_COLOR_RED true
#define EPD_COLOR_BLACK false
void init_GPIO_EPD();
void display_send_buffer();
void epd_refresh_and_sleep(uint8_t lut);
void display_tx_byte(uint8_t data);
void display_send_start(uint8_t inverted);
void display_send_stop();
void setDisplayWindow(uint16_t x, uint16_t y, uint16_t xe, uint16_t ye);
void init_epd();
void refresh_epd();
void lutBeginTX(uint8_t reg);
void lutEndTX();
void epd_pin_enable(int a1);
void fillWindow(uint16_t x, uint16_t y, uint16_t xe, uint16_t ye, uint8_t color);
void epdPrintf(uint16_t x, uint16_t y, bool color, const char* c, ...);
void interleaveColor(uint8_t b, uint8_t r);
void interleaveBW(uint8_t);
void drawImg(uint16_t x, uint16_t y, const uint8_t *img);

View File

@@ -0,0 +1,265 @@
#include "drawing.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "epd_interface.h"
#include "uc8159-var-m2.h"
#include "mz100/printf.h"
#include "mz100/eeprom.h"
#include "main.h"
extern "C" {
#include "mz100/mz100_clock.h"
#include "mz100/mz100_gpio.h"
#include "mz100/mz100_pinmux.h"
#include "mz100/mz100_ssp.h"
#include "mz100/mz100_wdt.h"
#include "mz100/util.h"
}
#include "../../oepl-definitions.h"
#include "../../oepl-proto.h"
epdInterface *epd;
epdInterface::~epdInterface(){
}
void epdSetup() {
epd = new uc8159;
epd->effectiveXRes = 640;
epd->effectiveYRes = 384;
epd->Xres = 640;
epd->Yres = 384;
epd->epdSetup();
}
void epdEnterSleep() {
epd->epdEnterSleep();
delete epd;
}
void draw() {
epd->draw();
}
void drawNoWait() {
epd->drawNoWait();
}
void epdWaitRdy() {
epd->epdWaitRdy();
}
void selectLUT(uint8_t sel) {
epd->selectLUT(sel);
}
static void busyWaitUntilHigh(uint32_t timeout) {
uint32_t v2 = 0;
while (GPIO_ReadPinLevel(EPD_BUSY) == GPIO_IO_LOW) {
delay(10000);
v2++;
if (v2 > timeout)
break;
if (((v2 % 1000) / 10) == 0)
WDT_RestartCounter();
}
}
static void busyWaitUntilLow(uint32_t timeout) {
uint32_t v2 = 0;
while (GPIO_ReadPinLevel(EPD_BUSY) == GPIO_IO_HIGH) {
delay(10000);
v2++;
if (v2 > timeout)
break;
if (((v2 % 1000) / 10) == 0)
WDT_RestartCounter();
}
}
void busyWaitUntil(bool high, uint32_t timeout) {
if (high)
busyWaitUntilHigh(timeout);
else
busyWaitUntilLow(timeout);
}
void softSPIWriteByte(char byteOut) {
uint8_t loopCount = 0;
do {
if ((byteOut & 0x80) != 0)
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_HIGH);
else
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_LOW);
delay_us(1);
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_HIGH);
delay_us(1);
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_LOW);
byteOut *= 2;
loopCount++;
delay(1);
} while (loopCount < 8);
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_LOW);
delay_us(1);
}
uint8_t softSPIReadByte() {
uint8_t readByte = 0;
uint8_t loopCount = 0;
GPIO_WritePinOutput(EPD_BS, GPIO_IO_HIGH);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
delay_us(1);
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_HIGH);
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_HIGH);
delay_us(1);
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_LOW);
delay_us(1);
GPIO_SetPinDir(EPD_MOSI, GPIO_INPUT);
GPIO_PinMuxFun(EPD_MOSI, PINMUX_FUNCTION_0);
delay_us(3);
do {
readByte *= 2;
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_HIGH);
if (GPIO_ReadPinLevel(EPD_MOSI))
readByte |= 1u;
GPIO_WritePinOutput(EPD_CLK, GPIO_IO_LOW);
delay_us(1);
delay(1);
loopCount++;
} while (loopCount < 8);
GPIO_SetPinDir(EPD_MOSI, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_MOSI, PINMUX_FUNCTION_0);
GPIO_WritePinOutput(EPD_MOSI, GPIO_IO_LOW);
delay_us(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
delay_us(1);
GPIO_WritePinOutput(EPD_BS, GPIO_IO_LOW);
delay(1);
return readByte;
}
void enableHardSPI(bool enable) {
if (enable) {
GPIO_PinMuxFun(EPD_CLK, GPIO22_SSP2_SCK);
GPIO_PinMuxFun(EPD_MOSI, GPIO12_SSP2_TXD);
GPIO_PinMuxFun(EPD_MISO, GPIO13_SSP2_RXD);
SSP_Enable(SSP2_ID);
} else {
SSP_Disable(SSP2_ID);
GPIO_PinMuxFun(EPD_MOSI, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_MOSI, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_CLK, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_CLK, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_MISO, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_MISO, GPIO_INPUT);
GPIO_PinModeConfig(EPD_MISO, PINMODE_DEFAULT);
}
}
void initEPDGPIO() {
SSP_CFG_Type v0;
SPI_Param_Type spiParaStruct;
GPIO_PinMuxFun(EPD_MOSI, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_MOSI, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_CLK, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_CLK, GPIO_OUTPUT);
GPIO_PinMuxFun(EPD_CS, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_CS, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
GPIO_PinMuxFun(EPD_BUSY, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_BUSY, GPIO_INPUT);
GPIO_PinModeConfig(EPD_BUSY, PINMODE_PULLUP);
GPIO_PinMuxFun(EPD_RESET, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_RESET, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_RESET, GPIO_IO_HIGH);
GPIO_PinMuxFun(EPD_DC, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_DC, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_DC, GPIO_IO_HIGH);
GPIO_PinMuxFun(EPD_BS, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_BS, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_BS, GPIO_IO_LOW);
GPIO_PinMuxFun(EPD_HLT_CTRL, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_HLT_CTRL, GPIO_OUTPUT);
GPIO_WritePinOutput(EPD_HLT_CTRL, GPIO_IO_HIGH);
GPIO_PinMuxFun(EPD_MISO, PINMUX_FUNCTION_0);
GPIO_SetPinDir(EPD_MISO, GPIO_INPUT);
GPIO_PinModeConfig(EPD_MISO, PINMODE_DEFAULT);
memset(&v0, 0, 9);
v0.timeOutVal = 0;
SSP_Init(SSP2_ID, &v0);
spiParaStruct.spiClkPhase = SPI_SCPHA_1;
spiParaStruct.spiClkPolarity = SPI_SCPOL_LOW;
SPI_Config(SSP2_ID, &spiParaStruct);
CLK_I2SClkSrc(CLK_I2S_XTAL32M);
CLK_SSPClkSrc(CLK_SSP_ID_2, CLK_SSP_I2S);
CLK_I2SClkDivider(1, 1);
}
void epdWrite(uint8_t reg, uint8_t len, ...) {
va_list valist;
va_start(valist, len);
enableHardSPI(true);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
GPIO_WritePinOutput(EPD_DC, GPIO_IO_LOW);
SSP_SendData(SSP2_ID, reg);
while (SSP_GetTxFifoLevel(SSP2_ID))
;
GPIO_WritePinOutput(EPD_DC, GPIO_IO_HIGH);
for (uint8_t i = 0; i < len; i++) {
SSP_SendData(SSP2_ID, va_arg(valist, int));
}
while (SSP_GetTxFifoLevel(SSP2_ID))
;
delay_us(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
enableHardSPI(false);
va_end(valist);
}
void epdBlockWrite(uint8_t reg, uint8_t *buffer, uint16_t len) {
enableHardSPI(true);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
GPIO_WritePinOutput(EPD_DC, GPIO_IO_LOW);
SSP_SendData(SSP2_ID, reg);
while (SSP_GetTxFifoLevel(SSP2_ID))
;
GPIO_WritePinOutput(EPD_DC, GPIO_IO_HIGH);
for (uint16_t i = 0; i < len; i++) {
SSP_SendData(SSP2_ID, buffer[i]);
while (SSP_GetTxFifoLevel(SSP2_ID) > 8)
;
}
while (SSP_GetTxFifoLevel(SSP2_ID))
;
delay_us(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
enableHardSPI(false);
}
void epdBlockWrite(uint8_t *buffer, uint16_t len) {
enableHardSPI(true);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_LOW);
GPIO_WritePinOutput(EPD_DC, GPIO_IO_HIGH);
for (uint16_t i = 0; i < len; i++) {
SSP_SendData(SSP2_ID, buffer[i]);
while (SSP_GetTxFifoLevel(SSP2_ID) > 8)
;
}
while (SSP_GetTxFifoLevel(SSP2_ID))
;
delay_us(1);
GPIO_WritePinOutput(EPD_CS, GPIO_IO_HIGH);
enableHardSPI(false);
}

View File

@@ -0,0 +1,55 @@
#pragma once
//#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
class epdInterface {
public:
virtual ~epdInterface() = 0;
virtual void epdSetup() = 0;
virtual void epdEnterSleep() = 0;
virtual void draw() = 0;
virtual void drawNoWait() = 0;
virtual void epdWaitRdy() = 0;
virtual void selectLUT(uint8_t lut) = 0;
uint8_t controllerType = 0;
uint16_t Xres;
uint16_t Yres;
uint16_t effectiveXRes;
uint16_t effectiveYRes;
uint16_t XOffset = 0;
uint16_t YOffset = 0;
bool drawDirectionRight = false;
bool epdMirrorV = false;
bool epdMirrorH = false;
};
//__attribute__((section(".aonshadow")))
extern epdInterface* epd;
void epdSetup();
void epdEnterSleep();
void draw();
void drawNoWait();
void drawWithSleep();
void epdWaitRdy();
#define EPD_LUT_DEFAULT 0
#define EPD_LUT_NO_REPEATS 1
#define EPD_LUT_FAST_NO_REDS 2
#define EPD_LUT_FAST 3
void selectLUT(uint8_t lut);
void initEPDGPIO();
void busyWaitUntil(bool high, uint32_t timeout);
void softSPIWriteByte(char byteOut);
uint8_t softSPIReadByte();
void enableHardSPI(bool enable);
void epdWrite(uint8_t reg, uint8_t len, ...);
void epdBlockWrite(uint8_t reg, uint8_t *buffer, uint16_t len);
void epdBlockWrite(uint8_t *buffer, uint16_t len);

View File

@@ -1,260 +0,0 @@
#pragma once
#include <stdint.h>
static const uint8_t font[256][20]={ // https://raw.githubusercontent.com/basti79/LCD-fonts/master/10x16_vertikal_MSB_1.h
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00
{0xE0,0x01,0x30,0x03,0x50,0x02,0x28,0x05,0x28,0x04,0x28,0x04,0x28,0x05,0x50,0x02,0x30,0x03,0xE0,0x01}, // 0x01
{0xE0,0x01,0xF0,0x03,0xB0,0x03,0xD8,0x06,0xD8,0x07,0xD8,0x07,0xD8,0x06,0xB0,0x03,0xF0,0x03,0xE0,0x01}, // 0x02
{0x00,0x3E,0x80,0x7F,0xE0,0x7F,0xF0,0x7F,0xF8,0x3F,0xF8,0x3F,0xF0,0x7F,0xE0,0x7F,0x80,0x7F,0x00,0x3E}, // 0x03
{0x00,0x01,0x80,0x03,0xC0,0x0F,0xE0,0x1F,0xF8,0x7F,0xF0,0x1F,0xE0,0x0F,0xC0,0x07,0x80,0x03,0x00,0x01}, // 0x04
{0x80,0x03,0xC0,0x07,0xC0,0x07,0xC0,0x3F,0xF8,0x7F,0xB8,0x7F,0xC0,0x3F,0xC0,0x07,0xC0,0x07,0x80,0x03}, // 0x05
{0x80,0x03,0xC0,0x07,0xC0,0x0F,0xC0,0x1F,0xF8,0x3F,0xB8,0x7F,0xC0,0x1F,0xC0,0x0F,0xC0,0x07,0x80,0x03}, // 0x06
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x07
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x08
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x09
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0A
{0xE0,0x01,0x10,0x02,0x08,0x04,0x08,0x04,0x08,0x04,0x08,0x24,0x10,0x2E,0xE0,0x71,0x00,0x70,0x00,0x18}, // 0x0B
{0x00,0x00,0x00,0x1E,0x20,0x21,0xA0,0x40,0xF8,0x40,0xA0,0x40,0xA0,0x41,0x00,0x21,0x00,0x1E,0x00,0x00}, // 0x0C
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0D
{0x06,0x00,0x0E,0x00,0x0E,0x00,0xFC,0x1F,0x00,0x18,0x30,0x10,0x70,0x30,0x70,0x20,0xE0,0x7F,0x00,0x00}, // 0x0E
{0x00,0x01,0xC0,0x0F,0xC0,0x04,0x40,0x08,0x60,0x18,0x40,0x08,0x40,0x04,0xC0,0x0C,0xC0,0x0B,0x00,0x01}, // 0x0F
{0xF8,0x0F,0xF0,0x07,0xF0,0x07,0xE0,0x03,0xE0,0x03,0xE0,0x03,0xC0,0x01,0xC0,0x01,0x80,0x00,0x80,0x00}, // 0x10
{0x80,0x00,0x80,0x00,0xC0,0x01,0xC0,0x01,0xE0,0x03,0xE0,0x03,0xE0,0x03,0xF0,0x07,0xF0,0x07,0xF8,0x0F}, // 0x11
{0x00,0x00,0x00,0x00,0x08,0x10,0x04,0x20,0xFE,0x7F,0x04,0x20,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x12
{0x00,0x00,0x00,0x00,0xD8,0x7F,0x00,0x00,0x00,0x00,0xD8,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x13
{0x00,0x00,0x00,0x38,0x00,0x7C,0x00,0x7E,0xFE,0x7F,0x00,0x40,0x00,0x40,0xFE,0x7F,0x00,0x00,0x00,0x00}, // 0x14
{0x00,0x00,0x00,0x00,0x86,0x3B,0xC2,0x4C,0x42,0x44,0x62,0x46,0x32,0x42,0xDC,0x41,0x00,0x00,0x00,0x00}, // 0x15
{0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00}, // 0x16
{0x00,0x00,0x00,0x00,0x11,0x10,0x09,0x20,0xFD,0x7F,0x09,0x20,0x11,0x10,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x17
{0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x20,0xFE,0x7F,0x00,0x20,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x18
{0x00,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0xFE,0x7F,0x04,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x19
{0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xA0,0x02,0xC0,0x01,0x80,0x00,0x00,0x00}, // 0x1A
{0x00,0x00,0x80,0x00,0xC0,0x01,0xA0,0x02,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00}, // 0x1B
{0x00,0x00,0xF8,0x07,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00}, // 0x1C
{0x00,0x00,0x80,0x00,0xC0,0x01,0xA0,0x02,0x80,0x00,0x80,0x00,0xA0,0x02,0xC0,0x01,0x80,0x00,0x00,0x00}, // 0x1D
{0x08,0x00,0x18,0x00,0x78,0x00,0xF8,0x01,0xF8,0x03,0xF8,0x0F,0xF8,0x03,0xF8,0x00,0x38,0x00,0x08,0x00}, // 0x1E
{0x00,0x08,0x00,0x0C,0x00,0x0F,0xC0,0x0F,0xE0,0x0F,0xF8,0x0F,0xE0,0x0F,0x80,0x0F,0x00,0x0E,0x00,0x08}, // 0x1F
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x20
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x21
{0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x22
{0x80,0x00,0x98,0x04,0xE0,0x05,0x80,0x1E,0x98,0x64,0xE0,0x05,0x80,0x1E,0x80,0x64,0x80,0x04,0x00,0x00}, // 0x23
{0x00,0x00,0x00,0x00,0x18,0x38,0x08,0x64,0x08,0x42,0xFC,0xFF,0x88,0x41,0xF0,0x40,0x00,0x00,0x00,0x00}, // 0x24
{0x08,0x38,0x10,0x44,0x20,0x44,0xC0,0x44,0x00,0x39,0x70,0x02,0x88,0x0C,0x88,0x10,0x88,0x20,0x70,0x40}, // 0x25
{0xE0,0x00,0x10,0x01,0x08,0x3A,0x08,0x46,0x88,0x45,0xC8,0x4C,0x38,0x38,0x18,0x00,0x68,0x00,0x80,0x01}, // 0x26
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x27
{0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x07,0x18,0x18,0x0C,0x30,0x04,0x20,0x02,0x40,0x02,0x40,0x00,0x00}, // 0x28
{0x00,0x00,0x02,0x40,0x02,0x40,0x04,0x20,0x0C,0x30,0x18,0x18,0xE0,0x07,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x29
{0x00,0x00,0x00,0x10,0x00,0x18,0x00,0x0F,0x00,0x72,0x00,0x0F,0x00,0x18,0x00,0x10,0x00,0x00,0x00,0x00}, // 0x2A
{0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0xF8,0x07,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00}, // 0x2B
{0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x2C
{0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00,0x00,0x00}, // 0x2D
{0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x2E
{0x00,0x00,0x02,0x00,0x0C,0x00,0x30,0x00,0xC0,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x00}, // 0x2F
{0x00,0x00,0xC0,0x0F,0x30,0x30,0x08,0x40,0x08,0x40,0x08,0x40,0x30,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00}, // 0x30
{0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x20,0xF8,0x7F,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x31
{0x00,0x00,0x18,0x60,0x28,0x40,0x48,0x40,0x88,0x40,0x08,0x43,0x08,0x3C,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x32
{0x00,0x00,0x00,0x00,0x08,0x40,0x08,0x42,0x08,0x42,0x08,0x42,0xF0,0x3D,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x33
{0xC0,0x00,0x40,0x03,0x40,0x04,0x40,0x18,0x40,0x20,0xF8,0x7F,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00}, // 0x34
{0x00,0x00,0x00,0x00,0x08,0x7C,0x08,0x44,0x08,0x44,0x10,0x42,0xE0,0x41,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x35
{0x00,0x00,0xE0,0x0F,0x10,0x32,0x08,0x44,0x08,0x44,0x08,0x44,0x10,0x42,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0x36
{0x00,0x00,0x00,0x40,0x18,0x40,0xE0,0x40,0x00,0x43,0x00,0x4C,0x00,0x50,0x00,0x60,0x00,0x00,0x00,0x00}, // 0x37
{0x00,0x00,0xF0,0x38,0x08,0x45,0x08,0x42,0x08,0x42,0x08,0x45,0x90,0x45,0x60,0x38,0x00,0x00,0x00,0x00}, // 0x38
{0x00,0x00,0x00,0x1E,0x08,0x21,0x88,0x40,0x88,0x40,0x88,0x40,0x30,0x21,0xC0,0x1F,0x00,0x00,0x00,0x00}, // 0x39
{0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x06,0x18,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x3A
{0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x06,0x1E,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x3B
{0x00,0x00,0x00,0x00,0xC0,0x00,0xC0,0x00,0x20,0x01,0x20,0x01,0x10,0x02,0x10,0x02,0x08,0x04,0x00,0x00}, // 0x3C
{0x00,0x00,0x20,0x01,0x20,0x01,0x20,0x01,0x20,0x01,0x20,0x01,0x20,0x01,0x20,0x01,0x20,0x01,0x00,0x00}, // 0x3D
{0x00,0x00,0x08,0x04,0x10,0x02,0x10,0x02,0x20,0x01,0x20,0x01,0xC0,0x00,0xC0,0x00,0x00,0x00,0x00,0x00}, // 0x3E
{0x00,0x00,0x00,0x70,0x00,0x40,0xD8,0x40,0x00,0x41,0x00,0x42,0x00,0x64,0x00,0x38,0x00,0x00,0x00,0x00}, // 0x3F
{0xC0,0x0F,0x30,0x18,0x18,0x20,0xC8,0x47,0x28,0x48,0x68,0x50,0xD8,0x51,0xE0,0x3F,0x20,0x00,0x20,0x00}, // 0x40
{0x08,0x00,0x70,0x00,0xC0,0x01,0x40,0x0E,0x40,0x18,0x40,0x0C,0x40,0x03,0xC0,0x00,0x30,0x00,0x08,0x00}, // 0x41
{0x00,0x00,0xF8,0x1F,0x08,0x11,0x08,0x11,0x08,0x11,0x08,0x11,0x88,0x12,0x70,0x0C,0x00,0x00,0x00,0x00}, // 0x42
{0xC0,0x03,0x30,0x0C,0x10,0x08,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x18,0x00,0x00,0x00,0x00}, // 0x43
{0x00,0x00,0xF8,0x1F,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0x10,0x08,0xE0,0x07,0x00,0x00,0x00,0x00}, // 0x44
{0x00,0x00,0xF8,0x1F,0x88,0x10,0x88,0x10,0x88,0x10,0x88,0x10,0x88,0x10,0x08,0x10,0x00,0x00,0x00,0x00}, // 0x45
{0x00,0x00,0xF8,0x1F,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x00,0x10,0x00,0x00,0x00,0x00}, // 0x46
{0x00,0x00,0xC0,0x03,0x30,0x0C,0x10,0x08,0x08,0x10,0x08,0x10,0x88,0x10,0x88,0x10,0xF8,0x18,0x00,0x00}, // 0x47
{0x00,0x00,0xF8,0x1F,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xF8,0x1F,0x00,0x00,0x00,0x00}, // 0x48
{0x00,0x00,0x08,0x10,0x08,0x10,0x08,0x10,0xF8,0x1F,0x08,0x10,0x08,0x10,0x08,0x10,0x00,0x00,0x00,0x00}, // 0x49
{0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x10,0x08,0x10,0x08,0x10,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x4A
{0x00,0x00,0xF8,0x1F,0x00,0x01,0x80,0x01,0x40,0x02,0x20,0x04,0x20,0x08,0x10,0x10,0x08,0x00,0x00,0x00}, // 0x4B
{0x00,0x00,0xF8,0x1F,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x4C
{0xF8,0x1F,0x00,0x1C,0x80,0x07,0xE0,0x00,0x60,0x00,0x80,0x03,0x00,0x1C,0xF8,0x1F,0x00,0x00,0x00,0x00}, // 0x4D
{0x00,0x00,0xF8,0x1F,0x00,0x08,0x00,0x06,0x80,0x01,0x60,0x00,0x10,0x00,0xF8,0x1F,0x00,0x00,0x00,0x00}, // 0x4E
{0x00,0x00,0xE0,0x07,0x10,0x08,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0x10,0x08,0xE0,0x07,0x00,0x00}, // 0x4F
{0x00,0x00,0xF8,0x1F,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x00,0x11,0x00,0x0E,0x00,0x00,0x00,0x00}, // 0x50
{0x00,0x00,0xE0,0x07,0x10,0x08,0x08,0x10,0x08,0x10,0x08,0x10,0x0C,0x10,0x12,0x08,0xE2,0x07,0x00,0x00}, // 0x51
{0x00,0x00,0xF8,0x1F,0x80,0x10,0x80,0x10,0xC0,0x10,0x20,0x11,0x10,0x0E,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x52
{0x00,0x00,0x18,0x0E,0x08,0x12,0x08,0x11,0x08,0x11,0x88,0x10,0x90,0x10,0x70,0x18,0x00,0x00,0x00,0x00}, // 0x53
{0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0xF8,0x1F,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x00}, // 0x54
{0x00,0x00,0xE0,0x1F,0x18,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00}, // 0x55
{0x00,0x10,0x00,0x0C,0x80,0x03,0x60,0x00,0x18,0x00,0x18,0x00,0xE0,0x00,0x00,0x03,0x00,0x0C,0x00,0x10}, // 0x56
{0x00,0x18,0xC0,0x07,0x38,0x00,0xF0,0x00,0x00,0x07,0x80,0x03,0x70,0x00,0x38,0x00,0xC0,0x07,0x00,0x18}, // 0x57
{0x08,0x10,0x10,0x08,0x20,0x04,0x40,0x02,0x80,0x01,0x80,0x01,0x40,0x02,0x20,0x04,0x10,0x08,0x08,0x10}, // 0x58
{0x00,0x10,0x00,0x08,0x00,0x06,0x00,0x01,0xF8,0x00,0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10}, // 0x59
{0x00,0x00,0x18,0x10,0x28,0x10,0x48,0x10,0x88,0x10,0x08,0x11,0x08,0x12,0x08,0x14,0x08,0x18,0x00,0x00}, // 0x5A
{0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x7F,0x02,0x40,0x02,0x40,0x02,0x40,0x02,0x40,0x00,0x00,0x00,0x00}, // 0x5B
{0x00,0x00,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0xC0,0x00,0x30,0x00,0x0C,0x00,0x02,0x00,0x00,0x00}, // 0x5C
{0x00,0x00,0x02,0x40,0x02,0x40,0x02,0x40,0x02,0x40,0xFE,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x5D
{0x00,0x00,0x20,0x00,0xC0,0x00,0x00,0x07,0x00,0x1C,0x00,0x70,0x00,0x0E,0xC0,0x01,0x20,0x00,0x00,0x00}, // 0x5E
{0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00}, // 0x5F
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x60
{0x00,0x00,0x30,0x00,0x48,0x04,0x88,0x04,0x88,0x04,0x90,0x04,0xF8,0x03,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x61
{0x00,0x00,0xF8,0x7F,0x10,0x02,0x08,0x04,0x08,0x04,0x08,0x04,0x10,0x06,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0x62
{0x00,0x00,0xE0,0x01,0x10,0x02,0x08,0x04,0x08,0x04,0x08,0x04,0x08,0x04,0x08,0x04,0x00,0x00,0x00,0x00}, // 0x63
{0x00,0x00,0xE0,0x01,0x18,0x02,0x08,0x04,0x08,0x04,0x08,0x04,0x10,0x02,0xF8,0x7F,0x00,0x00,0x00,0x00}, // 0x64
{0x00,0x00,0xE0,0x01,0x90,0x02,0x88,0x04,0x88,0x04,0x88,0x04,0x88,0x04,0x88,0x03,0x00,0x00,0x00,0x00}, // 0x65
{0x00,0x00,0x00,0x04,0x00,0x04,0xF8,0x3F,0x00,0x24,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x00}, // 0x66
{0x00,0x00,0xE0,0x01,0x19,0x02,0x09,0x04,0x09,0x04,0x09,0x04,0x12,0x02,0xFC,0x07,0x00,0x00,0x00,0x00}, // 0x67
{0x00,0x00,0xF8,0x7F,0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x04,0xF8,0x03,0x00,0x00,0x00,0x00}, // 0x68
{0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x64,0xF8,0x67,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x69
{0x00,0x00,0x01,0x00,0x01,0x04,0x01,0x04,0x01,0x64,0xFE,0x67,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x6A
{0x00,0x00,0xF8,0x7F,0x80,0x00,0xC0,0x00,0x20,0x01,0x20,0x02,0x10,0x02,0x08,0x04,0x00,0x00,0x00,0x00}, // 0x6B
{0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0xF8,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x6C
{0xF8,0x07,0x00,0x02,0x00,0x04,0x00,0x04,0xF8,0x03,0x00,0x02,0x00,0x04,0x00,0x04,0xF8,0x03,0x00,0x00}, // 0x6D
{0x00,0x00,0xF8,0x07,0x00,0x03,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x04,0xF8,0x03,0x00,0x00,0x00,0x00}, // 0x6E
{0x00,0x00,0xE0,0x01,0x10,0x02,0x08,0x04,0x08,0x04,0x08,0x04,0x10,0x02,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0x6F
{0x00,0x00,0xFF,0x07,0x10,0x02,0x08,0x04,0x08,0x04,0x08,0x04,0x10,0x06,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0x70
{0x00,0x00,0xE0,0x01,0x18,0x02,0x08,0x04,0x08,0x04,0x08,0x04,0x10,0x02,0xFF,0x07,0x00,0x00,0x00,0x00}, // 0x71
{0x00,0x00,0x00,0x00,0xF8,0x07,0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x00}, // 0x72
{0x00,0x00,0x18,0x03,0x88,0x04,0x88,0x04,0x48,0x04,0x48,0x04,0x30,0x04,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x73
{0x00,0x00,0x00,0x04,0x00,0x04,0xF0,0x1F,0x08,0x04,0x08,0x04,0x08,0x04,0x08,0x04,0x00,0x00,0x00,0x00}, // 0x74
{0x00,0x00,0xF0,0x07,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x75
{0x00,0x04,0x80,0x03,0x60,0x00,0x18,0x00,0x08,0x00,0x30,0x00,0xC0,0x00,0x00,0x03,0x00,0x04,0x00,0x00}, // 0x76
{0x00,0x06,0xE0,0x01,0x18,0x00,0x70,0x00,0x80,0x03,0x80,0x01,0x70,0x00,0x18,0x00,0xE0,0x01,0x00,0x06}, // 0x77
{0x00,0x00,0x08,0x04,0x10,0x02,0x20,0x01,0xC0,0x00,0xC0,0x00,0x20,0x01,0x10,0x02,0x08,0x04,0x00,0x00}, // 0x78
{0x01,0x04,0x01,0x03,0xC1,0x00,0x62,0x00,0x1C,0x00,0x18,0x00,0x60,0x00,0x80,0x00,0x00,0x03,0x00,0x04}, // 0x79
{0x00,0x00,0x08,0x04,0x18,0x04,0x28,0x04,0x48,0x04,0x88,0x04,0x08,0x05,0x08,0x06,0x08,0x04,0x00,0x00}, // 0x7A
{0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x7C,0x3F,0x02,0x40,0x02,0x40,0x02,0x40,0x00,0x00,0x00,0x00}, // 0x7B
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x7C
{0x00,0x00,0x00,0x00,0x02,0x40,0x02,0x40,0x02,0x40,0x7C,0x3F,0x80,0x00,0x80,0x00,0x00,0x00,0x00,0x00}, // 0x7D
{0xC0,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x80,0x00,0x80,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x80,0x01}, // 0x7E
{0x00,0x00,0xF8,0x01,0x08,0x03,0x08,0x04,0x08,0x08,0x08,0x04,0x08,0x03,0xF8,0x01,0x00,0x00,0x00,0x00}, // 0x7F
{0xC0,0x03,0x30,0x0C,0x10,0x08,0x08,0x10,0x08,0x10,0x09,0x10,0x0D,0x10,0x0B,0x18,0x00,0x00,0x00,0x00}, // 0x80
{0x00,0x00,0xF0,0x07,0x08,0x20,0x08,0x00,0x08,0x00,0x10,0x20,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x81
{0x00,0x00,0xE0,0x01,0x90,0x02,0x88,0x04,0x88,0x24,0x88,0x44,0x88,0x04,0x88,0x03,0x00,0x00,0x00,0x00}, // 0x82
{0x00,0x00,0x30,0x00,0x48,0x24,0x88,0x44,0x88,0x44,0x90,0x24,0xF8,0x03,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x83
{0x00,0x00,0x30,0x00,0x48,0x24,0x88,0x04,0x88,0x04,0x90,0x24,0xF8,0x03,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x84
{0x00,0x00,0x30,0x00,0x48,0x44,0x88,0x24,0x88,0x04,0x90,0x04,0xF8,0x03,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x85
{0x00,0x00,0x30,0x00,0x48,0x04,0x88,0x44,0x88,0xA4,0x90,0x44,0xF8,0x03,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x86
{0x00,0x00,0xE0,0x01,0x10,0x02,0x08,0x04,0x09,0x04,0x0D,0x04,0x0B,0x04,0x08,0x04,0x00,0x00,0x00,0x00}, // 0x87
{0x00,0x00,0xE0,0x01,0x90,0x22,0x88,0x44,0x88,0x44,0x88,0x24,0x88,0x04,0x88,0x03,0x00,0x00,0x00,0x00}, // 0x88
{0x00,0x00,0xE0,0x01,0x90,0x02,0x88,0x24,0x88,0x04,0x88,0x04,0x88,0x24,0x88,0x03,0x00,0x00,0x00,0x00}, // 0x89
{0x00,0x00,0xE0,0x01,0x90,0x02,0x88,0x44,0x88,0x24,0x88,0x04,0x88,0x04,0x88,0x03,0x00,0x00,0x00,0x00}, // 0x8A
{0x00,0x00,0x00,0x04,0x00,0x24,0x00,0x04,0xF8,0x07,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x8B
{0x00,0x00,0x00,0x04,0x00,0x24,0x00,0x44,0xF8,0x47,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x8C
{0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x44,0xF8,0x27,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x8D
{0x08,0x00,0x70,0x00,0xC0,0x81,0x40,0x0E,0x40,0x18,0x40,0x0C,0x40,0x83,0xC0,0x00,0x30,0x00,0x08,0x00}, // 0x8E
{0x08,0x00,0x70,0x00,0xC0,0x01,0x40,0x4E,0x40,0xB0,0x40,0xB8,0x40,0x4F,0xC0,0x01,0x70,0x00,0x08,0x00}, // 0x8F
{0x00,0x00,0xF8,0x1F,0x88,0x10,0x88,0x10,0x88,0x50,0x88,0x90,0x88,0x10,0x08,0x10,0x00,0x00,0x00,0x00}, // 0x90
{0x70,0x04,0xC8,0x04,0x88,0x04,0x88,0x04,0xF0,0x03,0x98,0x04,0x88,0x04,0x88,0x04,0x88,0x03,0x00,0x00}, // 0x91
{0x08,0x00,0x30,0x00,0xE0,0x01,0x20,0x06,0x20,0x18,0xF8,0x1F,0x88,0x10,0x88,0x10,0x08,0x10,0x00,0x00}, // 0x92
{0x00,0x00,0xE0,0x01,0x10,0x22,0x08,0x44,0x08,0x44,0x08,0x24,0x10,0x02,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0x93
{0x00,0x00,0xE0,0x01,0x10,0x22,0x08,0x04,0x08,0x04,0x08,0x24,0x10,0x02,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0x94
{0x00,0x00,0xE0,0x01,0x10,0x42,0x08,0x24,0x08,0x04,0x08,0x04,0x10,0x02,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0x95
{0x00,0x00,0xF0,0x07,0x08,0x20,0x08,0x40,0x08,0x40,0x10,0x20,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x96
{0x00,0x00,0xF0,0x07,0x08,0x40,0x08,0x20,0x08,0x00,0x10,0x00,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x97
{0x01,0x04,0x01,0x03,0xC1,0x20,0x62,0x00,0x1C,0x00,0x18,0x20,0x60,0x00,0x80,0x00,0x00,0x03,0x00,0x04}, // 0x98
{0x00,0x00,0xE0,0x07,0x10,0x88,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x90,0x10,0x08,0xE0,0x07,0x00,0x00}, // 0x99
{0x00,0x00,0xE0,0x1F,0x18,0x80,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x80,0xE0,0x1F,0x00,0x00,0x00,0x00}, // 0x9A
{0x00,0x00,0xE8,0x01,0x10,0x02,0x28,0x04,0xC8,0x04,0x08,0x05,0x10,0x02,0xE0,0x05,0x00,0x00,0x00,0x00}, // 0x9B
{0x00,0x00,0x00,0x00,0x08,0x00,0x18,0x02,0xE8,0x3F,0x08,0x42,0x08,0x42,0x08,0x40,0x00,0x00,0x00,0x00}, // 0x9C
{0x00,0x00,0xE8,0x07,0x30,0x08,0x68,0x10,0x88,0x10,0x08,0x11,0x08,0x16,0x10,0x0C,0xE0,0x17,0x00,0x00}, // 0x9D
{0x00,0x00,0x08,0x04,0x10,0x02,0x20,0x01,0xC0,0x00,0xC0,0x00,0x20,0x01,0x10,0x02,0x08,0x04,0x00,0x00}, // 0x9E
{0x00,0x00,0x01,0x00,0x01,0x04,0x01,0x04,0xFE,0x7F,0x00,0x84,0x00,0x84,0x00,0x80,0x00,0x00,0x00,0x00}, // 0x9F
{0x00,0x00,0x30,0x00,0x48,0x04,0x88,0x04,0x88,0x24,0x90,0x44,0xF8,0x03,0x08,0x00,0x00,0x00,0x00,0x00}, // 0xA0
{0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0xF8,0x27,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xA1
{0x00,0x00,0xE0,0x01,0x10,0x02,0x08,0x04,0x08,0x24,0x08,0x44,0x10,0x02,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0xA2
{0x00,0x00,0xF0,0x07,0x08,0x00,0x08,0x00,0x08,0x20,0x10,0x40,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xA3
{0x00,0x00,0xF8,0x07,0x00,0x23,0x00,0x42,0x00,0x24,0x00,0x24,0x00,0x44,0xF8,0x03,0x00,0x00,0x00,0x00}, // 0xA4
{0x00,0x00,0xF8,0x1F,0x00,0x48,0x00,0x86,0x80,0xC1,0x60,0x40,0x10,0x80,0xF8,0x1F,0x00,0x00,0x00,0x00}, // 0xA5
{0x00,0x00,0x00,0x00,0x00,0x4C,0x00,0x52,0x00,0x52,0x00,0x52,0x00,0x3E,0x00,0x02,0x00,0x00,0x00,0x00}, // 0xA6
{0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00}, // 0xA7
{0x00,0x00,0x0E,0x00,0x13,0x00,0x11,0x00,0x21,0x00,0xC1,0x06,0x01,0x00,0x07,0x00,0x00,0x00,0x00,0x00}, // 0xA8
{0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x5D,0x00,0x55,0x00,0x5D,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00}, // 0xA9
{0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0xE0,0x01,0x00,0x00}, // 0xAA
{0x08,0x40,0x30,0x7E,0x40,0x00,0x80,0x01,0x00,0x06,0x00,0x08,0x08,0x31,0x38,0x41,0x28,0x01,0xC8,0x00}, // 0xAB
{0x08,0x40,0x30,0x7E,0x40,0x00,0x80,0x01,0x00,0x06,0x60,0x08,0xA0,0x30,0x20,0x41,0xF8,0x01,0x20,0x00}, // 0xAC
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xAD
{0x00,0x00,0x80,0x00,0x40,0x01,0x20,0x02,0x10,0x04,0x80,0x00,0x40,0x01,0x20,0x02,0x10,0x04,0x00,0x00}, // 0xAE
{0x00,0x00,0x10,0x04,0x20,0x02,0x40,0x01,0x80,0x00,0x10,0x04,0x20,0x02,0x40,0x01,0x80,0x00,0x00,0x00}, // 0xAF
{0x36,0xDB,0x36,0xDB,0x00,0x00,0x36,0xDB,0x36,0xDB,0x00,0x00,0x36,0xDB,0x36,0xDB,0x00,0x00,0x00,0x00}, // 0xB0
{0xDB,0x36,0xDB,0x36,0x36,0xDB,0xFF,0xFF,0xDB,0x36,0x36,0xDB,0xFF,0xFF,0xDB,0x36,0x36,0xDB,0x36,0xDB}, // 0xB1
{0xFF,0xFF,0xFF,0xFF,0x36,0xDB,0xFF,0xFF,0xFF,0xFF,0x36,0xDB,0xFF,0xFF,0xFF,0xFF,0x36,0xDB,0x36,0xDB}, // 0xB2
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xB3
{0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xB4
{0x08,0x00,0x70,0x00,0xC0,0x01,0x40,0x0E,0x40,0x58,0x40,0x8C,0x40,0x03,0xC0,0x00,0x30,0x00,0x08,0x00}, // 0xB5
{0x08,0x00,0x70,0x00,0xC0,0x01,0x40,0x4E,0x40,0x98,0x40,0x8C,0x40,0x43,0xC0,0x00,0x30,0x00,0x08,0x00}, // 0xB6
{0x08,0x00,0x70,0x00,0xC0,0x01,0x40,0x8E,0x40,0x58,0x40,0x0C,0x40,0x03,0xC0,0x00,0x30,0x00,0x08,0x00}, // 0xB7
{0xC0,0x0F,0x30,0x30,0x98,0x67,0xC8,0x4C,0x48,0x48,0x48,0x48,0x58,0x68,0x30,0x30,0xC0,0x0F,0x00,0x00}, // 0xB8
{0x40,0x01,0x40,0x01,0x40,0x01,0x7F,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xB9
{0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xBA
{0x40,0x01,0x40,0x01,0x40,0x01,0x7F,0x01,0x00,0x01,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xBB
{0x40,0x01,0x40,0x01,0x40,0x01,0x40,0xFF,0x40,0x00,0xC0,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xBC
{0x00,0x00,0xC0,0x0F,0x20,0x10,0x30,0x20,0x10,0x20,0xF8,0x7F,0x10,0x20,0x10,0x20,0x00,0x00,0x00,0x00}, // 0xBD
{0x00,0x40,0x00,0x20,0x20,0x19,0x20,0x05,0xF8,0x03,0x20,0x05,0x20,0x09,0x00,0x10,0x00,0x20,0x00,0x40}, // 0xBE
{0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xBF
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00}, // 0xC0
{0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0xFF,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00}, // 0xC1
{0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xFF,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00}, // 0xC2
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00}, // 0xC3
{0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00}, // 0xC4
{0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xFF,0xFF,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00}, // 0xC5
{0x00,0x00,0x30,0x00,0x48,0x24,0x88,0x44,0x88,0x24,0x90,0x24,0xF8,0x43,0x08,0x00,0x00,0x00,0x00,0x00}, // 0xC6
{0x08,0x00,0x70,0x00,0xC0,0x41,0x40,0x8E,0x40,0xD8,0x40,0x4C,0x40,0x83,0xC0,0x00,0x30,0x00,0x08,0x00}, // 0xC7
{0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0x40,0x00,0x40,0xFF,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01}, // 0xC8
{0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x00,0x01,0x7F,0x01,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01}, // 0xC9
{0x40,0x01,0x40,0x01,0x40,0x01,0x40,0xFF,0x40,0x00,0x40,0xFF,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01}, // 0xCA
{0x40,0x01,0x40,0x01,0x40,0x01,0x7F,0x01,0x00,0x01,0x7F,0x01,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01}, // 0xCB
{0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x7F,0xFF,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01}, // 0xCC
{0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01}, // 0xCD
{0x40,0x01,0x40,0x01,0x40,0x01,0x7F,0xFF,0x00,0x00,0x7F,0xFF,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x01}, // 0xCE
{0x00,0x00,0x20,0x10,0xC0,0x0F,0x40,0x08,0x40,0x08,0x40,0x08,0x40,0x08,0xC0,0x0F,0x20,0x10,0x00,0x00}, // 0xCF
{0x00,0x00,0xE0,0x41,0x10,0x52,0x08,0x74,0x08,0x24,0x08,0x54,0x10,0x0E,0xE0,0x03,0x00,0x00,0x00,0x00}, // 0xD0
{0x00,0x01,0xF8,0x1F,0x08,0x11,0x08,0x11,0x08,0x10,0x08,0x10,0x10,0x08,0xE0,0x07,0x00,0x00,0x00,0x00}, // 0xD1
{0x00,0x00,0xF8,0x1F,0x88,0x10,0x88,0x50,0x88,0x90,0x88,0x90,0x88,0x50,0x08,0x10,0x00,0x00,0x00,0x00}, // 0xD2
{0x00,0x00,0xF8,0x1F,0x88,0x90,0x88,0x10,0x88,0x10,0x88,0x10,0x88,0x90,0x08,0x10,0x00,0x00,0x00,0x00}, // 0xD3
{0x00,0x00,0xF8,0x1F,0x88,0x10,0x88,0x10,0x88,0x90,0x88,0x50,0x88,0x10,0x08,0x10,0x00,0x00,0x00,0x00}, // 0xD4
{0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xD5
{0x00,0x00,0x08,0x10,0x08,0x10,0x08,0x10,0xF8,0x5F,0x08,0x90,0x08,0x10,0x08,0x10,0x00,0x00,0x00,0x00}, // 0xD6
{0x00,0x00,0x08,0x10,0x08,0x10,0x08,0x50,0xF8,0x9F,0x08,0x90,0x08,0x50,0x08,0x10,0x00,0x00,0x00,0x00}, // 0xD7
{0x00,0x00,0x08,0x10,0x08,0x90,0x08,0x10,0xF8,0x1F,0x08,0x10,0x08,0x90,0x08,0x10,0x00,0x00,0x00,0x00}, // 0xD8
{0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xD9
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00}, // 0xDA
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, // 0xDB
{0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00}, // 0xDC
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xDD
{0x00,0x00,0x08,0x10,0x08,0x10,0x08,0x90,0xF8,0x5F,0x08,0x10,0x08,0x10,0x08,0x10,0x00,0x00,0x00,0x00}, // 0xDE
{0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF}, // 0xDF
{0x00,0x00,0xE0,0x07,0x10,0x08,0x08,0x10,0x08,0x50,0x08,0x90,0x08,0x10,0x10,0x08,0xE0,0x07,0x00,0x00}, // 0xE0
{0x00,0x00,0xF8,0x3F,0x00,0x40,0x00,0x40,0x08,0x47,0x88,0x38,0x48,0x00,0x30,0x00,0x00,0x00,0x00,0x00}, // 0xE1
{0x00,0x00,0xE0,0x07,0x10,0x08,0x08,0x50,0x08,0x90,0x08,0x90,0x08,0x50,0x10,0x08,0xE0,0x07,0x00,0x00}, // 0xE2
{0x00,0x00,0xE0,0x07,0x10,0x08,0x08,0x90,0x08,0x50,0x08,0x10,0x08,0x10,0x10,0x08,0xE0,0x07,0x00,0x00}, // 0xE3
{0x00,0x00,0xE0,0x01,0x10,0x22,0x08,0x44,0x08,0x24,0x08,0x24,0x10,0x42,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0xE4
{0x00,0x00,0xE0,0x07,0x10,0x48,0x08,0x90,0x08,0xD0,0x08,0x50,0x08,0x90,0x10,0x08,0xE0,0x07,0x00,0x00}, // 0xE5
{0x00,0x00,0xFF,0x07,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0xF8,0x07,0x00,0x00,0x00,0x00}, // 0xE6
{0x00,0x00,0xFF,0x7F,0x10,0x02,0x08,0x04,0x08,0x04,0x08,0x04,0x10,0x06,0xE0,0x01,0x00,0x00,0x00,0x00}, // 0xE7
{0x00,0x00,0xF8,0x1F,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x40,0x04,0x80,0x03,0x00,0x00,0x00,0x00}, // 0xE8
{0x00,0x00,0xE0,0x1F,0x18,0x00,0x08,0x00,0x08,0x40,0x08,0x80,0x10,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00}, // 0xE9
{0x00,0x00,0xE0,0x1F,0x18,0x00,0x08,0x40,0x08,0x80,0x08,0x80,0x10,0x40,0xE0,0x1F,0x00,0x00,0x00,0x00}, // 0xEA
{0x00,0x00,0xE0,0x1F,0x18,0x00,0x08,0x80,0x08,0x40,0x08,0x00,0x10,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00}, // 0xEB
{0x01,0x04,0x01,0x03,0xC1,0x00,0x62,0x00,0x1C,0x20,0x18,0x40,0x60,0x00,0x80,0x00,0x00,0x03,0x00,0x04}, // 0xEC
{0x00,0x10,0x00,0x08,0x00,0x06,0x00,0x01,0xF8,0x40,0x00,0x81,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10}, // 0xED
{0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80}, // 0xEE
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xEF
{0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00,0x00,0x00}, // 0xF0
{0x00,0x00,0x08,0x01,0x08,0x01,0x08,0x01,0x08,0x01,0xC8,0x07,0x08,0x01,0x08,0x01,0x08,0x01,0x00,0x00}, // 0xF1
{0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00}, // 0xF2
{0x08,0x42,0x10,0x52,0x20,0x5A,0xC0,0x6C,0x00,0x01,0x60,0x02,0xA0,0x0C,0x20,0x11,0xF8,0x21,0x20,0x40}, // 0xF3
{0x00,0x00,0x00,0x38,0x00,0x7C,0x00,0x7E,0xFE,0x7F,0x00,0x40,0x00,0x40,0xFE,0x7F,0x00,0x00,0x00,0x00}, // 0xF4
{0x00,0x00,0x00,0x00,0x86,0x3B,0xC2,0x4C,0x42,0x44,0x62,0x46,0x32,0x42,0xDC,0x41,0x00,0x00,0x00,0x00}, // 0xF5
{0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x58,0x06,0x58,0x06,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00}, // 0xF6
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xF7
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,0x00,0x48,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xF8
{0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xF9
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xFA
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xFB
{0x00,0x00,0x00,0x00,0x00,0x42,0x00,0x52,0x00,0x52,0x00,0x52,0x00,0x6C,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xFC
{0x00,0x00,0x00,0x00,0x00,0x42,0x00,0x46,0x00,0x4A,0x00,0x4A,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xFD
{0x00,0x00,0xF8,0x07,0xF8,0x07,0xF8,0x07,0xF8,0x07,0xF8,0x07,0xF8,0x07,0xF8,0x07,0xF8,0x07,0x00,0x00}, // 0xFE
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // 0xFF
};

View File

@@ -1,33 +1,46 @@
#include "main.h"
// #include "main.h"
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "epd_interface.h"
extern "C" {
#include "main.h"
#include "comms.h"
#include "core_cm3.h"
#include "eeprom.h"
#include "epd.h"
#include "gpio.h"
#include "mz100.h"
#include "mz100_aon_ram.h"
#include "mz100_clock.h"
#include "mz100_flash.h"
#include "mz100_gpio.h"
#include "mz100_pinmux.h"
#include "mz100_pmu.h"
#include "mz100_sleep.h"
#include "mz100_ssp.h"
#include "mz100_uart.h"
#include "mz100/core_cm3.h"
#include "mz100/eeprom.h"
#include "mz100/gpio.h"
#include "mz100/mz100.h"
#include "mz100/mz100_aon_ram.h"
#include "mz100/mz100_clock.h"
#include "mz100/mz100_flash.h"
#include "mz100/mz100_gpio.h"
#include "mz100/mz100_pinmux.h"
#include "mz100/mz100_pmu.h"
#include "mz100/mz100_sleep.h"
#include "mz100/mz100_ssp.h"
#include "mz100/mz100_uart.h"
#include "powermgt.h"
#include "printf.h"
#include "mz100/printf.h"
#include "proto.h"
#include "settings.h"
#include "syncedproto.h"
#include "timer.h"
#include "userinterface.h"
#include "util.h"
#include "mz100/timer.h"
#include "mz100/util.h"
#include "zigbee.h"
extern void dump(const uint8_t *a, const uint16_t l);
}
#include "compression.h"
#include "userinterface.h"
#include "oepl_fs.h"
#define SW_VER_CURRENT (0x0000011300000000ull) // top 16 bits are off limits, xxxx.VV.tt.vvvv.mmmm means version V.t.v.m
#define SW_DEFAULT_MAC (0x0000000000000014ull)
@@ -51,8 +64,8 @@ bool protectedFlashWrite(uint32_t address, uint8_t *buffer, uint32_t num) {
while (attempt--) {
qspiEraseRange(address, num);
delay(50);
FLASH_Write(false, address, buffer, num);
FLASH_Read(0, address, buf2, num);
FLASH_Write((FLASH_ProgramMode_Type) false, address, buffer, num);
FLASH_Read((FLASH_ReadMode_Type)0, address, buf2, num);
if (memcmp(buffer, buf2, num) == 0) {
printf("Flash block at %06X written successfully\n", address);
free(buf2);
@@ -66,14 +79,14 @@ bool protectedFlashWrite(uint32_t address, uint8_t *buffer, uint32_t num) {
}
static void prvGetSelfMac(void) {
FLASH_Read(0, EEPROM_MAC_INFO_START, mSelfMac, 8);
FLASH_Read((FLASH_ReadMode_Type)0, EEPROM_MAC_INFO_START, mSelfMac, 8);
if ((((uint32_t *)mSelfMac)[0] | ((uint32_t *)mSelfMac)[1]) == 0 || (((uint32_t *)mSelfMac)[0] & ((uint32_t *)mSelfMac)[1]) == 0xffffffff) { // fastest way to check for all ones or all zeroes
printf("mac unknown\r\n");
// Write a blank mac to have something to work with.
memcpy(&mSelfMac, (uint8_t *)&default_mac, 8);
FLASH_Write(0, EEPROM_MAC_INFO_START, mSelfMac, 8);
FLASH_Write((FLASH_ProgramMode_Type)0, EEPROM_MAC_INFO_START, mSelfMac, 8);
// sleep_with_with_wakeup(0);
}
}
@@ -210,18 +223,18 @@ void setupUART() {
UART_CFG_Type uartcfg;
uartcfg.baudRate = 115200;
uartcfg.dataBits = UART_DATABITS_8;
uartcfg.stopBits = 1;
uartcfg.stopBits = (UART_StopBits_Type)1;
uartcfg.parity = UART_PARITY_NONE;
uartcfg.autoFlowControl = DISABLE;
UART_Init(1, &uartcfg);
UART_Init((UART_ID_Type)1, &uartcfg);
UART_FIFO_Type uartFifo;
uartFifo.FIFO_ResetRx = 1;
uartFifo.FIFO_ResetTx = 1;
uartFifo.FIFO_Function = 1;
uartFifo.FIFO_RcvrTrigger = 2;
uartFifo.FIFO_TxEmptyTrigger = 3;
UART_FIFOConfig(1, &uartFifo);
uartFifo.FIFO_ResetRx = (FunctionalState)1;
uartFifo.FIFO_ResetTx = (FunctionalState)1;
uartFifo.FIFO_Function = (FunctionalState)1;
uartFifo.FIFO_RcvrTrigger = (UART_RxFIFOLevel_Type)2;
uartFifo.FIFO_TxEmptyTrigger = (UART_TxFIFOLevel_Type)3;
UART_FIFOConfig((UART_ID_Type)1, &uartFifo);
// UART 1 DEBUG OUT
}
@@ -242,9 +255,9 @@ void setupGPIO() {
// NFC POWER Should be on if NFC is wanted to be used
GPIO_PinOutputModeConfig(NFC_POWER, PIN_OUTPUT_MODE_NORMAL_FUNCTION);
GPIO_PinModeConfig(NFC_POWER, PINMODE_DEFAULT);
GPIO_PinMuxFun(NFC_POWER, 0);
GPIO_PinMuxFun(NFC_POWER, (GPIO_PinMuxFunc_Type)0);
GPIO_SetPinDir(NFC_POWER, GPIO_OUTPUT);
GPIO_WritePinOutput(NFC_POWER, 1); // Better power NFC up so IRQ will work unpowered later
GPIO_WritePinOutput(NFC_POWER, (GPIO_IO_Type)1); // Better power NFC up so IRQ will work unpowered later
//** GPIOS
if (!(~(*(volatile unsigned int *)0x4A080000) << 30)) {
NVIC_EnableIRQ(ExtPin5_IRQn);
@@ -269,6 +282,7 @@ void setupCLKCalib() {
void TagAssociated() {
// associated
struct AvailDataInfo *avail;
printf("longDataReqCounter = %d\n", longDataReqCounter);
// Is there any reason why we should do a long (full) get data request (including reason, status)?
if ((longDataReqCounter > LONG_DATAREQ_INTERVAL) || wakeUpReason != WAKEUP_REASON_TIMED) {
// check if we should do a voltage measurement (those are pretty expensive)
@@ -298,6 +312,7 @@ void TagAssociated() {
}
powerUp(INIT_RADIO);
printf("full request\n");
avail = getAvailDataInfo();
powerDown(INIT_RADIO);
@@ -416,29 +431,31 @@ int main(void) {
setupGPIO();
setupCLKCalib();
setupUART();
// fs = new OEPLFs();
printf("Rst reason: %i\r\n", PMU_GetLastResetCause());
printf("AON is not valid!\n");
setupRTC();
clearAonRam();
prvGetSelfMac();
showSplashScreen();
delay(10000);
currentChannel = 0;
zigbeeCalibData.isValid = false;
wakeUpReason = WAKEUP_REASON_FIRSTBOOT;
prvGetSelfMac();
initializeProto();
printf("Erz data\r\n");
initPowerSaving(INTERVAL_BASE);
loadDefaultSettings();
doVoltageReading();
qspiEraseRange(EEPROM_SETTINGS_AREA_START, EEPROM_SETTINGS_AREA_LEN);
// qspiEraseRange(EEPROM_SETTINGS_AREA_START, EEPROM_SETTINGS_AREA_LEN);
sprintf(macStr, "(" MACFMT ")", MACCVT(mSelfMac));
currentChannel = showChannelSelect();
WDT_RestartCounter();
if (currentChannel) {
printf("AP Found\r\n");
delay(10000);
showAPFound();
sprintf(macStr1, "OpenEPaperLink Ch: %i", currentChannel);
timerDelay(TIMER_TICKS_PER_MSEC * 1000);
@@ -449,17 +466,20 @@ int main(void) {
sleep_with_with_wakeup(120000UL);
currentTagMode = TAG_MODE_CHANSEARCH;
}
powerUp(INIT_UART);
} else {
// setupWDT();
setupWDT(); // turn me off
setupGPIO();
// setupCLKCalib();
// setupUART();
// setupRTC();
setupCLKCalib(); // turn me off
// setupUART();// turn me off
// setupRTC();// turn me off
memset(curBlock.requestedParts, 0x00, BLOCK_REQ_PARTS_BYTES);
powerUp(INIT_UART);
// fs = new OEPLFs();
}
powerUp(INIT_UART);
while (1) {
wdt10s();
switch (currentTagMode) {
@@ -475,7 +495,7 @@ int main(void) {
}
int _write(int file, char *ptr, int len) {
UART_SendBytes(1, ptr, len);
UART_SendBytes((UART_ID_Type)1, ptr, len);
return len;
}
@@ -492,18 +512,24 @@ void applyUpdate() {
// apparently, the flash process is more reliable if we do these two first
setupCLKCalib();
setupRTC();
showApplyUpdate();
printf("Applying update\r\n");
qspiEraseRange(EEPROM_OS_START, EEPROM_OS_LEN);
size = EEPROM_OS_LEN;
for (ofst = 0; ofst < size; ofst += now) {
now = size - ofst;
if (now > pieceSz)
now = pieceSz;
printf("Cpy 0x%06x + 0x%04x to 0x%06x\r\n", EEPROM_UPDATE_START + ofst, now, EEPROM_OS_START + ofst);
FLASH_Read(0, EEPROM_UPDATE_START + ofst, chunkStore, now);
FLASH_Read((FLASH_ReadMode_Type)0, EEPROM_UPDATE_START + ofst, chunkStore, now);
protectedFlashWrite(EEPROM_OS_START + ofst, chunkStore, now);
WDT_RestartCounter();
}
NVIC_SystemReset();
printf("Resetting!\n");
delay(1000);
sleep_with_with_wakeup(1000);
}

View File

@@ -3,32 +3,31 @@
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "core_cm3.h"
//#include "core_cm3.h"
#define NO_GUI 0 // Set this to one for faster developing, not Refresh on the E-Paper while showing Full screen messages
#define TEST_PIN 3
#define RF_WAKEUP_PIN 5
#define TEST_PIN GPIO_3
#define RF_WAKEUP_PIN GPIO_5
#define UART_TX 4
#define UART_RX 6
#define UART_TX GPIO_4
#define UART_RX GPIO_6
#define NFC_POWER 1
#define NFC_IRQ 7
#define NFC_SCL 28
#define NFC_SDA 29
#define NFC_POWER GPIO_1
#define NFC_IRQ GPIO_7
#define NFC_SCL GPIO_28
#define NFC_SDA GPIO_29
#define EPD_BS 2
#define EPD_MOSI 12
#define EPD_MISO 13
#define EPD_CLK 22
#define EPD_CS 23
#define EPD_RESET 24
#define EPD_DC 26
#define EPD_BUSY 27
#define EPD_HLT_CTRL 25
#define EPD_BS GPIO_2
#define EPD_MOSI GPIO_12
#define EPD_MISO GPIO_13
#define EPD_CLK GPIO_22
#define EPD_CS GPIO_23
#define EPD_RESET GPIO_24
#define EPD_DC GPIO_26
#define EPD_BUSY GPIO_27
#define EPD_HLT_CTRL GPIO_25
#define RADIO_FIRST_CHANNEL (11) //2.4-GHz channels start at 11
void applyUpdate();
void applyUpdate();

View File

@@ -0,0 +1,223 @@
/*
* Derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm
* and modified slightly to be functionally identical but condensed into control structures.
*/
#include "md5.h"
/*
* Constants defined by the MD5 algorithm
*/
#define A 0x67452301
#define B 0xefcdab89
#define C 0x98badcfe
#define D 0x10325476
static uint32_t S[] = {7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21};
static uint32_t K[] = {0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391};
/*
* Padding used to make the size (in bits) of the input congruent to 448 mod 512
*/
static uint8_t PADDING[] = {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
/*
* Bit-manipulation functions defined by the MD5 algorithm
*/
#define F(X, Y, Z) ((X & Y) | (~X & Z))
#define G(X, Y, Z) ((X & Z) | (Y & ~Z))
#define H(X, Y, Z) (X ^ Y ^ Z)
#define I(X, Y, Z) (Y ^ (X | ~Z))
/*
* Rotates a 32-bit word left by n bits
*/
uint32_t rotateLeft(uint32_t x, uint32_t n){
return (x << n) | (x >> (32 - n));
}
/*
* Initialize a context
*/
void md5Init(MD5Context *ctx){
ctx->size = (uint64_t)0;
ctx->buffer[0] = (uint32_t)A;
ctx->buffer[1] = (uint32_t)B;
ctx->buffer[2] = (uint32_t)C;
ctx->buffer[3] = (uint32_t)D;
}
/*
* Add some amount of input to the context
*
* If the input fills out a block of 512 bits, apply the algorithm (md5Step)
* and save the result in the buffer. Also updates the overall size.
*/
void md5Update(MD5Context *ctx, uint8_t *input_buffer, size_t input_len){
uint32_t input[16];
unsigned int offset = ctx->size % 64;
ctx->size += (uint64_t)input_len;
// Copy each byte in input_buffer into the next space in our context input
for(unsigned int i = 0; i < input_len; ++i){
ctx->input[offset++] = (uint8_t)*(input_buffer + i);
// If we've filled our context input, copy it into our local array input
// then reset the offset to 0 and fill in a new buffer.
// Every time we fill out a chunk, we run it through the algorithm
// to enable some back and forth between cpu and i/o
if(offset % 64 == 0){
for(unsigned int j = 0; j < 16; ++j){
// Convert to little-endian
// The local variable `input` our 512-bit chunk separated into 32-bit words
// we can use in calculations
input[j] = (uint32_t)(ctx->input[(j * 4) + 3]) << 24 |
(uint32_t)(ctx->input[(j * 4) + 2]) << 16 |
(uint32_t)(ctx->input[(j * 4) + 1]) << 8 |
(uint32_t)(ctx->input[(j * 4)]);
}
md5Step(ctx->buffer, input);
offset = 0;
}
}
}
/*
* Pad the current input to get to 448 bytes, append the size in bits to the very end,
* and save the result of the final iteration into digest.
*/
void md5Finalize(MD5Context *ctx){
uint32_t input[16];
unsigned int offset = ctx->size % 64;
unsigned int padding_length = offset < 56 ? 56 - offset : (56 + 64) - offset;
// Fill in the padding and undo the changes to size that resulted from the update
md5Update(ctx, PADDING, padding_length);
ctx->size -= (uint64_t)padding_length;
// Do a final update (internal to this function)
// Last two 32-bit words are the two halves of the size (converted from bytes to bits)
for(unsigned int j = 0; j < 14; ++j){
input[j] = (uint32_t)(ctx->input[(j * 4) + 3]) << 24 |
(uint32_t)(ctx->input[(j * 4) + 2]) << 16 |
(uint32_t)(ctx->input[(j * 4) + 1]) << 8 |
(uint32_t)(ctx->input[(j * 4)]);
}
input[14] = (uint32_t)(ctx->size * 8);
input[15] = (uint32_t)((ctx->size * 8) >> 32);
md5Step(ctx->buffer, input);
// Move the result into digest (convert from little-endian)
for(unsigned int i = 0; i < 4; ++i){
ctx->digest[(i * 4) + 0] = (uint8_t)((ctx->buffer[i] & 0x000000FF));
ctx->digest[(i * 4) + 1] = (uint8_t)((ctx->buffer[i] & 0x0000FF00) >> 8);
ctx->digest[(i * 4) + 2] = (uint8_t)((ctx->buffer[i] & 0x00FF0000) >> 16);
ctx->digest[(i * 4) + 3] = (uint8_t)((ctx->buffer[i] & 0xFF000000) >> 24);
}
}
/*
* Step on 512 bits of input with the main MD5 algorithm.
*/
void md5Step(uint32_t *buffer, uint32_t *input){
uint32_t AA = buffer[0];
uint32_t BB = buffer[1];
uint32_t CC = buffer[2];
uint32_t DD = buffer[3];
uint32_t E;
unsigned int j;
for(unsigned int i = 0; i < 64; ++i){
switch(i / 16){
case 0:
E = F(BB, CC, DD);
j = i;
break;
case 1:
E = G(BB, CC, DD);
j = ((i * 5) + 1) % 16;
break;
case 2:
E = H(BB, CC, DD);
j = ((i * 3) + 5) % 16;
break;
default:
E = I(BB, CC, DD);
j = (i * 7) % 16;
break;
}
uint32_t temp = DD;
DD = CC;
CC = BB;
BB = BB + rotateLeft(AA + E + K[i] + input[j], S[i]);
AA = temp;
}
buffer[0] += AA;
buffer[1] += BB;
buffer[2] += CC;
buffer[3] += DD;
}
/*
* Functions that run the algorithm on the provided input and put the digest into result.
* result should be able to store 16 bytes.
*/
void md5String(char *input, uint8_t *result){
MD5Context ctx;
md5Init(&ctx);
md5Update(&ctx, (uint8_t *)input, strlen(input));
md5Finalize(&ctx);
memcpy(result, ctx.digest, 16);
}
void md5File(FILE *file, uint8_t *result){
char *input_buffer = malloc(1024);
size_t input_size = 0;
MD5Context ctx;
md5Init(&ctx);
while((input_size = fread(input_buffer, 1, 1024, file)) > 0){
md5Update(&ctx, (uint8_t *)input_buffer, input_size);
}
md5Finalize(&ctx);
free(input_buffer);
memcpy(result, ctx.digest, 16);
}

View File

@@ -0,0 +1,21 @@
#ifndef MD5_H
#define MD5_H
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
typedef struct{
uint64_t size; // Size of input in bytes
uint32_t buffer[4]; // Current accumulation of hash
uint8_t input[64]; // Input to be used in the next step
uint8_t digest[16]; // Result of algorithm
}MD5Context;
void md5Init(MD5Context *ctx);
void md5Update(MD5Context *ctx, uint8_t *input, size_t input_len);
void md5Finalize(MD5Context *ctx);
void md5Step(uint32_t *buffer, uint32_t *input);
#endif

View File

@@ -0,0 +1,253 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
//#include <iostream>
#include <vector>
#include <string.h>
#include <zlib.h>
#pragma pack(1)
/*
This prepares a FS binary for use with the 88mz100-based OEPL Tag Firmware
Jelmer Bruijn 2024
*/
#define PROGMEM
#define WINDOW_SIZE 12 // 4096 bytes
#define FILENAME_LENGTH 32
typedef struct {
uint16_t bitmapOffset; ///< Pointer into GFXfont->bitmap
uint8_t width; ///< Bitmap dimensions in pixels
uint8_t height; ///< Bitmap dimensions in pixels
uint8_t xAdvance; ///< Distance to advance cursor (x axis)
int8_t xOffset; ///< X dist from cursor pos to UL corner
int8_t yOffset; ///< Y dist from cursor pos to UL corner
} GFXglyph;
/// Data stored for FONT AS A WHOLE
typedef struct {
uint8_t *bitmap; ///< Glyph bitmaps, concatenated
GFXglyph *glyph; ///< Glyph array
uint16_t first; ///< ASCII extents (first char)
uint16_t last; ///< ASCII extents (last char)
uint8_t yAdvance; ///< Newline distance (y axis)
} GFXfont;
typedef struct {
uint16_t first;
uint16_t last;
uint8_t yAdvance;
char glyphFile[FILENAME_LENGTH];
char bitmapFile[FILENAME_LENGTH];
} GFXFontOEPL;
typedef struct {
char name[FILENAME_LENGTH];
uint32_t offset;
uint32_t len;
} OEPLFile;
std::vector<OEPLFile*> files;
uint8_t* buffer = nullptr; // temporary holds the entire FS
uint32_t curOffset = 0;
char OEPLHeader[12] = "---OEPL_FS!";
FILE *wptr;
void dump(const uint8_t *a, const uint16_t l) {
printf("\n ");
#define ROWS 16
for (uint8_t c = 0; c < ROWS; c++) {
printf(" %02X", c);
}
printf("\n--------");
for (uint8_t c = 0; c < ROWS; c++) {
printf("---");
}
for (uint16_t c = 0; c < l; c++) {
if ((c % ROWS) == 0) {
printf("\n0x%04X | ", c);
}
printf("%02X ", a[c]);
}
printf("\n--------");
for (uint8_t c = 0; c < ROWS; c++) {
printf("---");
}
printf("\n");
}
unsigned long doCompress(uint8_t* in, uint32_t in_len, uint8_t* out) {
*((uint32_t*)out) = in_len;
z_stream stream;
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
stream.opaque = Z_NULL;
stream.avail_in = (uInt)in_len;
stream.next_in = (Bytef*)in;
stream.avail_out = (uInt)(in_len+1337);
stream.next_out = (Bytef*)(out+4);
*((uint32_t*)out) = in_len;
if (deflateInit2(&stream, Z_BEST_COMPRESSION, Z_DEFLATED, WINDOW_SIZE, 8, Z_DEFAULT_STRATEGY) != Z_OK) {
fprintf(stderr, "Error initializing zlib for compression\n");
return 1;
}
if (deflate(&stream, Z_FINISH) != Z_STREAM_END) {
fprintf(stderr, "Error compressing data\n");
deflateEnd(&stream);
return 1;
}
if (deflateEnd(&stream) != Z_OK) {
fprintf(stderr, "Error finalizing compression\n");
return 1;
}
dump(out, 16);
return stream.total_out+4;
}
void addFile(uint8_t* filedata, uint16_t len, char* filename, bool compress){
char newfilename[FILENAME_LENGTH];
if(compress){
if(strlen(filename)>(FILENAME_LENGTH-3)){
printf("Filename '%s' is too long\n", filename);
return;
}
uint8_t* tmpbuffer = (uint8_t*)malloc(len + 1337);
unsigned long out_len = doCompress(filedata, len, tmpbuffer);
if(out_len==1){
printf("Compression of %s failed\n", filename);
return;
}
filedata = tmpbuffer;
uint8_t rounded = (uint8_t)((float)100*out_len/len);
printf("Compressed %s \033[50D\033[40C: %u \033[50D\033[47C -> %lu \033[70D\033[58C(%d%%)\n", filename, len, out_len, rounded);
len = out_len;
uint8_t flen = strlen(filename);
strncpy(newfilename,filename,FILENAME_LENGTH-3);
strcpy(newfilename + flen, ".z");
filename = newfilename;
}
if(strlen(filename)>(FILENAME_LENGTH-1)){
printf("Filename '%s' is too long\n", filename);
return;
}
if(!buffer){
buffer = (uint8_t*)malloc(len);
} else {
buffer = (uint8_t*)realloc((void*)buffer, curOffset + len);
}
memcpy(buffer+curOffset, filedata, len);
if(compress)free(filedata);
OEPLFile* file = new OEPLFile;
strcpy(file->name,filename);
file->offset = curOffset;
file->len = len;
files.push_back(file);
curOffset+=len;
}
void addFileFromFS(const char* filename, bool compress){
FILE* file = fopen(filename, "rb");
if (file == NULL) {
fprintf(stderr, "Error opening file: %s\n", filename);
return;
}
fseek(file, 0, SEEK_END);
long fileSize = ftell(file);
rewind(file);
char* fileContent = (char*)malloc(fileSize);
if (fileContent == NULL) {
fprintf(stderr, "Error allocating memory for file content\n");
fclose(file);
return;
}
size_t bytesRead = fread(fileContent, 1, fileSize, file);
addFile((uint8_t*)fileContent, fileSize, (char*)filename, compress);
}
void printFAT(){
printf("OEPL Filesystem Summary:\n");
uint16_t tableSize = files.size() * sizeof(OEPLFile);
tableSize += sizeof(OEPLHeader)-1;
fwrite(OEPLHeader,sizeof(OEPLHeader)-1,1,wptr);
uint32_t fssize = 0;
for(OEPLFile* file : files){
file->offset += tableSize;
fwrite((uint8_t*)file,sizeof(OEPLFile),1,wptr);
printf("file: %s \033[50D\033[37C size=%u \033[50D\033[51C offset=0x%04X\n",file->name, file->len, file->offset);
fssize = file->len + file->offset;
}
printf("Total FS size: %u\n", fssize);
}
void saveFontData(const GFXfont* font, char* name){
if(strlen(name)>(FILENAME_LENGTH-7)){
printf("Font filename '%s' is too long\n", name);
return;
}
GFXFontOEPL fontdata;
fontdata.first = font->first;
fontdata.last = font->last;
fontdata.yAdvance = font->yAdvance;
strcpy(fontdata.glyphFile, name);
strcpy(fontdata.bitmapFile, name);
uint8_t len = strlen(fontdata.glyphFile);
strcpy(fontdata.glyphFile + len, ".glyph");
strcpy(fontdata.bitmapFile + len, ".bmp");
addFile((uint8_t*)&fontdata, sizeof(GFXFontOEPL), name, false);
uint16_t glyphLen = font->last - font->first;
uint16_t lastOffset = font->glyph[glyphLen].bitmapOffset;
uint16_t lastBitmapSize = font->glyph[glyphLen].width * font->glyph[glyphLen].height;
uint8_t lastBitmapBytes = lastBitmapSize/8;
if(lastBitmapSize%8)lastBitmapBytes++;
uint16_t bitmapSize = lastOffset + lastBitmapBytes;
int16_t glyphSize = (glyphLen + 1) * sizeof(GFXglyph);
addFile((uint8_t*)font->glyph, glyphSize, fontdata.glyphFile, false);
addFile((uint8_t*)font->bitmap, bitmapSize, fontdata.bitmapFile, false);
}
#include "../../common/fonts/FreeSans9pt7b.h"
#include "../../common/fonts/FreeSansBold18pt7b.h"
#include "../../common/fonts/FreeSansBold24pt7b.h"
#include "../../common/bitmaps.h"
int main(){
wptr = fopen("../build/fs.img","wb"); // w for write, b for binary
/* FONTS */
saveFontData(&FreeSansBold24pt7b, (char*)"font/FreeSansBold24pt7b");
saveFontData(&FreeSansBold18pt7b, (char*)"font/FreeSansBold18pt7b");
saveFontData(&FreeSans9pt7b, (char*)"font/FreeSans9pt7b");
/* OTHER STUFF */
addFile((uint8_t*)sadpanda, sizeof(sadpanda), "img/sadpanda", true);
//addFileFromFS("img_tbird.bin", true);
printFAT();
fwrite(buffer,curOffset,1,wptr);
fclose(wptr);
return 0;
}

View File

@@ -0,0 +1,4 @@
rm mkfs.oepl
g++ mkfs.oepl.cpp -lz -o mkfs.oepl
./mkfs.oepl

View File

@@ -0,0 +1,57 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
int main() {
// Input string to compress
const char* inputString = "This is a sample string to compress and add a gzip header.werugweroiguie;wroigj;eworijg;oewirjg;oeiwrjg;oiewrj;goiewjr;ogiejw;rojig;ewoirjg;oewijrg;oewirj;goeiwj;roiwheg;orihg";
// Length of the input string
size_t inputLength = strlen(inputString);
// Allocate memory for compressed data
size_t compressedBufferSize = compressBound(inputLength) + 18; // Additional space for gzip header
char* compressedBuffer = (char*)malloc(compressedBufferSize);
// Compression parameters with reduced window size (8 bits)
z_stream stream;
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
stream.opaque = Z_NULL;
stream.avail_in = (uInt)inputLength;
stream.next_in = (Bytef*)inputString;
stream.avail_out = (uInt)compressedBufferSize;
stream.next_out = (Bytef*)compressedBuffer;
// Initialize compression with gzip header and reduced window size (8 bits)
if (deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 8, 8, Z_DEFAULT_STRATEGY) != Z_OK) {
fprintf(stderr, "Error initializing zlib for compression\n");
free(compressedBuffer);
return 1;
}
// Perform compression
if (deflate(&stream, Z_FINISH) != Z_STREAM_END) {
fprintf(stderr, "Error compressing data\n");
deflateEnd(&stream);
free(compressedBuffer);
return 1;
}
// Finalize compression
if (deflateEnd(&stream) != Z_OK) {
fprintf(stderr, "Error finalizing compression\n");
free(compressedBuffer);
return 1;
}
// Display results
printf("Original string length: %zu bytes\n", inputLength);
printf("Compressed data length: %lu bytes\n", (unsigned long)stream.total_out);
// Clean up
free(compressedBuffer);
return 0;
}

View File

@@ -11,14 +11,14 @@
#define EEPROM_PAGE_SIZE (0x01000UL)
#define EEPROM_OS_START (0x00000UL)
#define EEPROM_OS_LEN (0x13FFFUL) //0xE820 of image, rounded up to 4K
#define EEPROM_OS_LEN (0x1FFFFUL) //0xE820 of image, rounded up to 4K
#define EEPROM_IMG_START (0x17000UL)
#define EEPROM_IMG_START (0x20000UL)
#define EEPROM_IMG_EACH (0x1F000UL)
#define EEPROM_IMG_LEN (EEPROM_IMG_START + 0x13FFFUL)
#define EEPROM_UPDATE_START (0x17000UL) //same header as images
#define EEPROM_UPDATE_LEN (0x13FFFUL)
#define EEPROM_UPDATE_START (0x20000UL) //same header as images
#define EEPROM_UPDATE_LEN (0x1FFFFUL)
#define EEPROM_SETTINGS_AREA_START (0x14000UL)
#define EEPROM_SETTINGS_AREA_LEN (0x03000UL)
@@ -33,16 +33,6 @@
//#define EEPROM_PIECE_SZ (88)
struct EepromImageHeader { //each image space is 0x17000 bytes, we have space for ten of them
uint64_t version;
uint32_t validMarker;
uint32_t size;
uint8_t dataType;
uint32_t id;
//image data here
//we pre-erase so progress can be calculated by finding the first non-0xff byte
};
#include "../../common/eeprom_struct.h"
#endif

View File

@@ -5,7 +5,7 @@
#include <stdbool.h>
#include <string.h>
#include "core_cm3.h"
#include "main.h"
#include "../main.h"
#include "mz100_rtc.h"
#include "mz100_wdt.h"
#include "mz100_pmu.h"
@@ -194,4 +194,4 @@ void do_sleeped_epd_refresh()
PMU_ClearWakeupExtpin(PMU_GPIO5_INT);
wait_busy_sleep(2000);
printf("uDisTime : %d ms\r\n", gSleepRtcCounter);
}
}

View File

@@ -11,19 +11,20 @@ bool aonRamValid = false;
void clearAonRam() {
memset((void *)0x130000, 0, 4096);
//memcpy((void *)(0x128000 - AONSHADOW_SIZE), (uint8_t *)aonShadow, AONSHADOW_SIZE);
}
bool loadValidateAonRam() {
uint32_t testchecksum = aonChecksum;
aonChecksum = 0x00000000;
uint32_t checksum = 0xABBA5FF5;
uint32_t checksum = 0xABBA5FF7;
for (uint32_t c = 0x130000; c < 0x131000; c += 4) {
checksum += *(uint32_t *)c;
}
if (checksum == testchecksum) {
// immediately invalidate the checksum; if we reboot, we want a clean reboot
aonChecksum = 0x5445A00A;
memcpy((void *)(0x128000 - AONSHADOW_SIZE), (uint8_t*)aonShadow, AONSHADOW_SIZE);
memcpy((void *)(0x128000 - AONSHADOW_SIZE), (uint8_t *)aonShadow, AONSHADOW_SIZE);
return true;
} else {
clearAonRam();
@@ -33,9 +34,9 @@ bool loadValidateAonRam() {
}
void saveAonRam() {
memcpy((uint8_t*)aonShadow, (void *)(0x128000 - AONSHADOW_SIZE), AONSHADOW_SIZE);
memcpy((uint8_t *)aonShadow, (void *)(0x128000 - AONSHADOW_SIZE), AONSHADOW_SIZE);
aonChecksum = 0x00000000;
uint32_t checksum = 0xABBA5FF5;
uint32_t checksum = 0xABBA5FF7;
for (uint32_t c = 0x130000; c < 0x131000; c += 4) {
checksum += *(uint32_t *)c;
}

View File

@@ -12,8 +12,8 @@
#include "mz100_sleep.h"
#include "util.h"
#include "gpio.h"
#include "main.h"
#include "proto.h"
#include "../main.h"
//#include "proto.h"
#include "printf.h"
extern void saveAonRam();
@@ -88,9 +88,9 @@ void Set_Wakeup_pin_nfc()
NVIC_EnableIRQ(ExtPin7_IRQn);
}
extern struct blockRequest curBlock; // used by the block-requester, contains the next request that we'll send
extern struct AvailDataInfo curDataInfo; // last 'AvailDataInfo' we received from the AP
extern bool requestPartialBlock; // if we should ask the AP to get this block from the host or not
//extern struct blockRequest curBlock; // used by the block-requester, contains the next request that we'll send
//extern struct AvailDataInfo xferDataInfo; // last 'AvailDataInfo' we received from the AP
//extern bool requestPartialBlock; // if we should ask the AP to get this block from the host or not
void sleep_with_with_wakeup(uint32_t sleep_time_ms)
{
saveAonRam();
@@ -122,4 +122,4 @@ void sleep_with_with_wakeup(uint32_t sleep_time_ms)
Set_Wakeup_pin_rf(1);
Set_Wakeup_pin_nfc();
__WFI();
}
}

View File

@@ -160,7 +160,7 @@ void qspiEraseRange(uint32_t addr, uint32_t len) {
}
bool eepromWrite(uint32_t addr, const void *srcP, uint16_t len) {
FLASH_Write(false, addr, (void*)srcP, len);
FLASH_Write(0, addr, (void*)srcP, len);
return true;
}
@@ -182,4 +182,4 @@ void radioShutdown(void) {
*(volatile uint32_t *)0x4C000000 = 0;
*(volatile uint32_t *)0x4C010000 = 0;
*(volatile uint32_t *)0x4C010004 = 0x10000000;
}
}

View File

@@ -0,0 +1,168 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
extern "C" {
#include "mz100/mz100_flash.h"
#include "mz100/printf.h"
}
// #pragma pack(1)
#include "oepl_fs.h"
extern "C" {
__attribute__((section(".aonshadow"))) uint32_t fsEntry;
__attribute__((section(".aonshadow"))) uint32_t fsEnd;
extern void dump(const uint8_t *a, const uint16_t l);
}
OEPLFs oeplfs;
OEPLFs *fs = &oeplfs;
void OEPLFs::init() {
if (!this->isStarted) {
this->files.clear();
if (fsEntry == 0) {
silent = false;
fsEntry = this->findEntry();
} else {
silent = true;
}
if (fsEntry) this->populateFiles();
this->isStarted = true;
}
}
OEPLFs::OEPLFs() {
}
OEPLFs::~OEPLFs() {
}
uint32_t OEPLFs::findEntry() {
printf("FS: Trying to find OEPL FS...\n");
uint8_t *scan = (uint8_t *)malloc(1024);
uint32_t offset = 0;
// scan flash with some overlap, to ensure the entire string is in the buffer at some point
for (uint32_t c = 60000; c < 180000; c += 512) {
FLASH_Read(FLASH_FAST_READ_QUAD_OUT, c, scan, 1024);
uint32_t scan_offset = 0;
bool nextblock = false;
while (!nextblock) {
uint8_t *p = (uint8_t *)memchr(scan + scan_offset, '-', 1024 - scan_offset);
if (p) {
// see if the rest of the string is also there
int8_t match = memcmp(p + 1, "--OEPL_FS!", 10);
if (match == 0) {
offset = (uint32_t)(p - scan);
offset += c;
nextblock = true;
break;
} else {
scan_offset = (p - scan) + 1;
}
} else {
nextblock = true;
}
}
}
if (offset) {
printf("FS: Found at 0x%08X\n", offset);
} else {
printf("FS: Not found. Did you forget to add it?\n");
FLASH_Read(FLASH_FAST_READ_QUAD_OUT, 0x109C0, scan, 1024);
dump(scan, 1024);
}
free(scan);
return offset;
}
void OEPLFs::populateFiles() {
// get file list inside of the vector
uint8_t *buffer = (uint8_t *)malloc(1024);
FLASH_Read(FLASH_FAST_READ_QUAD_OUT, fsEntry, buffer, 1024);
bool done = false;
bool firstFile = true;
uint8_t *fatEnd = nullptr;
uint8_t *curFileP = buffer;
curFileP += 11; // set to begin file table
uint32_t fsend = 0;
while (!done) {
OEPLFSFile *file;
file = new OEPLFSFile;
memcpy((void *)file, curFileP, sizeof(OEPLFSFile));
this->files.push_back(file);
if (firstFile) {
firstFile = false;
fatEnd = buffer + file->offset - 1;
}
curFileP += sizeof(OEPLFSFile);
// print reference
char tmp[32];
memcpy(tmp, file->name, 32);
tmp[31] = 0x00;
if(!silent)printf("name=%s, size=%u, offset=%u\n", tmp, file->len, file->offset);
fsend = file->len + file->offset;
if (curFileP > fatEnd) {
done = true;
break;
}
}
fsEnd = fsend + fsEntry;
free(buffer);
}
OEPLFile *OEPLFs::getFile(char *name) {
// if (files.size() == 0) this->init();
for (uint8_t c = 0; c < files.size(); c++) {
if (strncmp(name, files.at(c)->name, FILENAME_LENGTH) == 0) {
OEPLFile *file = new OEPLFile(files.at(c)->offset + fsEntry);
file->length = files.at(c)->len;
return file;
}
}
printf("file '%s' not found in %d files\n", name, files.size());
return nullptr;
}
uint8_t OEPLFile::operator()(uint32_t i) {
return this->readByte(i);
}
void OEPLFile::getBlock(uint32_t offset, uint8_t *target, uint32_t len) {
// get a block of data from within the 'file'
FLASH_Read(FLASH_FAST_READ_QUAD_OUT, this->eepromOffset + offset, target, len);
}
uint8_t OEPLFile::readByte(uint32_t i) {
if (!buffer) {
this->buffer = (uint8_t *)malloc(OEPLFS_CACHE_SIZE);
}
// calculate requested eeprom position
uint32_t eepromPos = i + this->eepromOffset;
// check if this currently buffered
if ((eepromPos >= this->bufferBegin) && (eepromPos < (this->bufferBegin + OEPLFS_CACHE_SIZE))) {
// cache hit
} else {
// cache miss
FLASH_Read(FLASH_FAST_READ_QUAD_OUT, this->eepromOffset + i, buffer, OEPLFS_CACHE_SIZE);
this->bufferBegin = this->eepromOffset + i;
}
return buffer[(this->eepromOffset + i) - this->bufferBegin];
}
OEPLFile::OEPLFile(uint32_t offset) {
this->eepromOffset = offset;
}
OEPLFile::~OEPLFile() {
if (this->buffer) {
free(this->buffer);
}
}

View File

@@ -0,0 +1,51 @@
#pragma once
#include <stdint.h>
#include <vector>
extern "C" {
extern __attribute__((section(".aonshadow"))) uint32_t fsEntry;
extern __attribute__((section(".aonshadow"))) uint32_t fsEnd;
}
#define OEPLFS_CACHE_SIZE 128
#define FILENAME_LENGTH 32
typedef struct __attribute__((packed)) {
char name[FILENAME_LENGTH];
uint32_t offset;
uint32_t len;
} OEPLFSFile;
class OEPLFile {
public:
~OEPLFile();
OEPLFile(uint32_t begin);
uint32_t length;
uint8_t operator()(uint32_t i);
uint8_t readByte(uint32_t i);
void getBlock(uint32_t offset, uint8_t* target, uint32_t len);
protected:
uint8_t* buffer = nullptr;
uint32_t bufferBegin = 0;
uint32_t eepromOffset = 0;
};
class OEPLFs {
public:
~OEPLFs();
OEPLFs();
std::vector<OEPLFSFile*> files;
OEPLFile* getFile(char* name);
void init();
bool isStarted = false;
protected:
bool silent;
uint32_t findEntry();
void populateFiles();
};
// extern __attribute__((section(".aonshadow"))) OEPLFs fs;
extern OEPLFs* fs;

View File

@@ -7,13 +7,13 @@
#include <string.h>
#include "board.h"
#include "eeprom.h"
#include "mz100/eeprom.h"
#include "main.h"
#include "mz100_sleep.h"
#include "printf.h"
#include "mz100/mz100_sleep.h"
#include "mz100/printf.h"
#include "screen.h"
#include "syncedproto.h"
#include "util.h"
#include "mz100/util.h"
#include "zigbee.h"
__attribute__((section(".aonshadow"))) uint16_t dataReqAttemptArr[POWER_SAVING_SMOOTHING] = {0}; // Holds the amount of attempts required per data_req/check-in
@@ -148,4 +148,4 @@ uint16_t getNextSleep() {
}
avg /= POWER_SAVING_SMOOTHING;
return avg;
}
}

View File

@@ -1,9 +1,9 @@
#include "settings.h"
#include "proto.h"
#include <string.h>
#include "eeprom.h"
#include "util.h"
#include "mz100_flash.h"
#include "mz100/eeprom.h"
#include "mz100/util.h"
#include "mz100/mz100_flash.h"
#include "powermgt.h"
@@ -25,4 +25,4 @@ void loadDefaultSettings() {
tagSettings.minimumCheckInTime = INTERVAL_BASE;
tagSettings.fixedChannel = 0;
tagSettings.batLowVoltage = BATTERY_VOLTAGE_MINIMUM;
}
}

View File

@@ -3,11 +3,18 @@
#include <stdint.h>
#define FW_VERSION 20 // version number (max 2.5.5 :) )
#define FW_VERSION 0x0027 // version number (max 2.5.5 :) )
#define FW_VERSION_SUFFIX "-75" // suffix, like -RC1 or whatever.
// #define DEBUGBLOCKS // uncomment to enable extra debug information on the block transfers
// #define PRINT_LUT // uncomment if you want the tag to print the LUT for the current temperature bracket
#define DEBUG_EPD
#define DEBUG_FS
#define DEBUG_BUILD
#define DEBUG_COMPRESSION
#define SETTINGS_STRUCT_VERSION 0x01
#define DEFAULT_SETTING_FASTBOOT 0

View File

@@ -3,21 +3,22 @@
#include "board.h"
#include "comms.h"
#include "drawing.h"
#include "eeprom.h"
#include "mz100/eeprom.h"
#include "main.h"
#include "mz100_sleep.h"
#include "mz100/mz100_sleep.h"
#include "powermgt.h"
#include "printf.h"
#include "mz100/printf.h"
#include "proto.h"
#include "timer.h"
#include "util.h"
#include "mz100/timer.h"
#include "mz100/util.h"
#include "mz100/mz100_flash.h"
#include "zigbee.h"
#include "md5.h"
// download-stuff
uint8_t blockXferBuffer[BLOCK_XFER_BUFFER_SIZE] = {0};
__attribute__((section(".aonshadow"))) struct blockRequest curBlock = {0}; // used by the block-requester, contains the next request that we'll send
__attribute__((section(".aonshadow"))) struct AvailDataInfo curDataInfo = {0}; // last 'AvailDataInfo' we received from the AP
__attribute__((section(".aonshadow"))) struct AvailDataInfo xferDataInfo = {0}; // last 'AvailDataInfo' we received from the AP
bool requestPartialBlock = false; // if we should ask the AP to get this block from the host or not
#define BLOCK_TRANSFER_ATTEMPTS 10
@@ -41,6 +42,9 @@ static uint8_t outBuffer[128] = {0};
// #define DEBUGBLOCKS 1
// from drawing.cpp
extern void drawImageAtAddress(uint32_t addr, uint8_t lut);
// tools
static uint8_t getPacketType(const void *buffer) {
const struct MacFcs *fcs = buffer;
@@ -186,6 +190,7 @@ static void sendAvailDataReq() {
availreq->temperature = temperature;
availreq->batteryMv = batteryVoltage;
availreq->capabilities = capabilities;
availreq->tagSoftwareVersion = FW_VERSION;
addCRC(availreq, sizeof(struct AvailDataReq));
commsTxNoCpy(outBuffer);
}
@@ -204,7 +209,6 @@ struct AvailDataInfo *getAvailDataInfo() {
memcpy(APmac, f->src, 8);
APsrcPan = f->pan;
dataReqLastAttempt = c;
printf("%d", dataReqLastAttempt);
return (struct AvailDataInfo *)(inBuffer + sizeof(struct MacFrameNormal) + 1);
}
}
@@ -399,6 +403,33 @@ static bool validateBlockData() {
}
// EEprom related stuff
static bool validateEepromMD5(uint64_t ver, uint32_t eepromstart, uint32_t flen) {
#define CHUNK_SIZE 512
uint8_t chunk[CHUNK_SIZE];
MD5Context ctx;
md5Init(&ctx);
// Open the executable itself for reading
for (uint32_t offset = 0; offset < flen; offset += CHUNK_SIZE) {
uint32_t len = flen - offset;
if (len > CHUNK_SIZE) len = CHUNK_SIZE;
FLASH_Read(FLASH_FAST_READ_QUAD_OUT, eepromstart + offset, chunk, len);
eepromRead(eepromstart + offset, chunk, 512);
md5Update(&ctx, chunk, len);
}
// Retrieve the final hash
md5Finalize(&ctx);
bool isValid = ver == *((uint64_t *)ctx.digest);
if (!isValid) {
printf("MD5 failed check! This is what we should get:\n");
dump((const uint8_t *)&(xferDataInfo.dataVer), 8);
printf("This is what we got:\n");
dump(ctx.digest, 16);
}
return isValid;
}
static uint32_t getAddressForSlot(const uint8_t s) {
return EEPROM_IMG_START + (EEPROM_IMG_EACH * s);
}
@@ -478,6 +509,7 @@ static uint32_t getHighSlotId() {
return temp;
}
static bool getDataBlock(const uint16_t blockSize) {
static uint8_t partsThisBlock = 0;
static uint8_t blockAttempts = 0;
@@ -574,28 +606,31 @@ static bool getDataBlock(const uint16_t blockSize) {
return false;
}
uint16_t dataRequestSize = 0;
uint32_t curXferSize = 0;
static bool downloadFWUpdate(const struct AvailDataInfo *avail) {
// check if we already started the transfer of this information & haven't completed it
if (!memcmp((const void *)&avail->dataVer, (const void *)&curDataInfo.dataVer, 8) && curDataInfo.dataSize) {
if (!memcmp((const void *)&avail->dataVer, (const void *)&xferDataInfo.dataVer, 8) && xferDataInfo.dataSize) {
// looks like we did. We'll carry on where we left off.
} else {
// start, or restart the transfer from 0. Copy data from the AvailDataInfo struct, and the struct intself. This forces a new transfer
curBlock.blockId = 0;
memcpy(&(curBlock.ver), &(avail->dataVer), 8);
curBlock.type = avail->dataType;
memcpy(&curDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
memcpy(&xferDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
curXferSize = avail->dataSize;
eraseUpdateBlock();
delay(100);
}
while (curDataInfo.dataSize) {
while (xferDataInfo.dataSize) {
wdt10s();
if (curDataInfo.dataSize > BLOCK_DATA_SIZE) {
if (xferDataInfo.dataSize > BLOCK_DATA_SIZE) {
// more than one block remaining
dataRequestSize = BLOCK_DATA_SIZE;
} else {
// only one block remains
dataRequestSize = curDataInfo.dataSize;
dataRequestSize = xferDataInfo.dataSize;
}
if (getDataBlock(dataRequestSize)) {
// succesfully downloaded datablock, save to eeprom
@@ -603,20 +638,27 @@ static bool downloadFWUpdate(const struct AvailDataInfo *avail) {
saveUpdateBlockData(curBlock.blockId);
powerDown(INIT_EEPROM);
curBlock.blockId++;
curDataInfo.dataSize -= dataRequestSize;
xferDataInfo.dataSize -= dataRequestSize;
} else {
// failed to get the block we wanted, we'll stop for now, maybe resume later
return false;
}
}
// no more data, download complete
return true;
if (validateEepromMD5(xferDataInfo.dataVer, EEPROM_UPDATE_START, curXferSize)) {
// md5 matches
return true;
} else {
// md5 does not match, invalidate current transfer result, forcing a restart of the transfer
memset((void *)&xferDataInfo, 0, sizeof(struct AvailDataInfo));
return false;
}
}
uint16_t imageSize = 0;
static bool downloadImageDataToEEPROM(const struct AvailDataInfo *avail) {
// check if we already started the transfer of this information & haven't completed it
if (!memcmp((const void *)&avail->dataVer, (const void *)&curDataInfo.dataVer, 8) && curDataInfo.dataSize) {
if (!memcmp((const void *)&avail->dataVer, (const void *)&xferDataInfo.dataVer, 8) && xferDataInfo.dataSize) {
// looks like we did. We'll carry on where we left off.
printf("restarting image download");
curImgSlot = nextImgSlot;
@@ -643,19 +685,19 @@ static bool downloadImageDataToEEPROM(const struct AvailDataInfo *avail) {
memcpy(&(curBlock.ver), &(avail->dataVer), 8);
curBlock.type = avail->dataType;
memcpy(&curDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
memcpy(&xferDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
imageSize = curDataInfo.dataSize;
imageSize = xferDataInfo.dataSize;
}
while (curDataInfo.dataSize) {
while (xferDataInfo.dataSize) {
wdt10s();
if (curDataInfo.dataSize > BLOCK_DATA_SIZE) {
if (xferDataInfo.dataSize > BLOCK_DATA_SIZE) {
// more than one block remaining
dataRequestSize = BLOCK_DATA_SIZE;
} else {
// only one block remains
dataRequestSize = curDataInfo.dataSize;
dataRequestSize = xferDataInfo.dataSize;
}
if (getDataBlock(dataRequestSize)) {
// succesfully downloaded datablock, save to eeprom
@@ -666,7 +708,7 @@ static bool downloadImageDataToEEPROM(const struct AvailDataInfo *avail) {
saveImgBlockData(curImgSlot, curBlock.blockId);
powerDown(INIT_EEPROM);
curBlock.blockId++;
curDataInfo.dataSize -= dataRequestSize;
xferDataInfo.dataSize -= dataRequestSize;
} else {
// failed to get the block we wanted, we'll stop for now, probably resume later
return false;
@@ -676,20 +718,27 @@ static bool downloadImageDataToEEPROM(const struct AvailDataInfo *avail) {
// borrow the blockXferBuffer temporarily
struct EepromImageHeader *eih = (struct EepromImageHeader *)blockXferBuffer;
memcpy(&eih->version, &curDataInfo.dataVer, 8);
memcpy(&eih->version, &xferDataInfo.dataVer, 8);
eih->validMarker = EEPROM_IMG_VALID;
eih->id = ++curHighSlotId;
eih->size = imageSize;
eih->dataType = curDataInfo.dataType;
eih->dataType = xferDataInfo.dataType;
#ifdef DEBUGBLOCKS
printf("Now writing datatype 0x%02X to slot %d\n", curDataInfo.dataType, curImgSlot);
#endif
powerUp(INIT_EEPROM);
eepromWrite(getAddressForSlot(curImgSlot), eih, sizeof(struct EepromImageHeader));
powerDown(INIT_EEPROM);
return true;
if (validateEepromMD5(xferDataInfo.dataVer, getAddressForSlot(curImgSlot) + sizeof(struct EepromImageHeader), imageSize)) {
// md5 matches
eepromWrite(getAddressForSlot(curImgSlot), eih, sizeof(struct EepromImageHeader));
powerDown(INIT_EEPROM);
printf("md5 okay");
return true;
} else {
// md5 does not match, invalidate current transfer result, forcing a restart of the transfer
memset((void *)&xferDataInfo, 0, sizeof(struct AvailDataInfo));
powerDown(INIT_EEPROM);
return false;
}
}
bool processAvailDataInfo(struct AvailDataInfo *avail) {
@@ -698,8 +747,9 @@ bool processAvailDataInfo(struct AvailDataInfo *avail) {
case DATATYPE_IMG_DIFF:
case DATATYPE_IMG_RAW_1BPP:
case DATATYPE_IMG_RAW_2BPP:
case DATATYPE_IMG_ZLIB:
// check if this download is currently displayed or active
if (curDataInfo.dataSize == 0 && !memcmp((const void *)&avail->dataVer, (const void *)&curDataInfo.dataVer, 8)) {
if (xferDataInfo.dataSize == 0 && !memcmp((const void *)&avail->dataVer, (const void *)&xferDataInfo.dataVer, 8)) {
// we've downloaded this already, we're guessing it's already displayed
printf("currently shown image, send xfc\n");
powerUp(INIT_RADIO);
@@ -721,8 +771,8 @@ bool processAvailDataInfo(struct AvailDataInfo *avail) {
printf("already seen, drawing from eeprom slot %d\n", curImgSlot);
// mark as completed and draw from EEPROM
memcpy(&curDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
curDataInfo.dataSize = 0; // mark as transfer not pending
memcpy(&xferDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
xferDataInfo.dataSize = 0; // mark as transfer not pending
drawWithLut = avail->dataTypeArgument;
wdt60s();
@@ -786,4 +836,4 @@ bool processAvailDataInfo(struct AvailDataInfo *avail) {
void initializeProto() {
getNumSlots();
curHighSlotId = getHighSlotId();
}
}

View File

@@ -8,7 +8,7 @@
extern __attribute__((section(".aonshadow"))) uint8_t mSelfMac[];
extern __attribute__((section(".aonshadow"))) volatile uint8_t currentChannel;
extern __attribute__((section(".aonshadow"))) struct blockRequest curBlock; // used by the block-requester, contains the next request that we'll send
extern __attribute__((section(".aonshadow"))) struct AvailDataInfo curDataInfo; // last 'AvailDataInfo' we received from the AP // __attribute__((section(".aon")))
extern __attribute__((section(".aonshadow"))) struct AvailDataInfo xferDataInfo; // last 'AvailDataInfo' we received from the AP // __attribute__((section(".aon")))
extern uint8_t APmac[];

Some files were not shown because too many files have changed in this diff Show More