Compare commits

...

5 Commits

Author SHA1 Message Date
Sheikah
30ece44ea4 WIP, ui_menu 2023-02-05 01:02:48 +08:00
Sheikah
a6d091a7e5 many improvement 2023-02-03 01:22:15 +08:00
Sheikah
504a985a49 improve flash useage 2023-02-02 01:21:22 +08:00
Sheikah
9343f8bff3 add kt0915 lib 2023-01-30 23:46:55 +08:00
Sheikah
0f649630e6 improvement 2023-01-30 23:19:38 +08:00
128 changed files with 800 additions and 335 deletions

1
.gitignore vendored
View File

@ -3,5 +3,6 @@ __pycache__
tools/**/*.png
tools/**/*.psd
tools/**/*.jpg
tools/**/*.xcf
tools/**/*.c
tools/**/*.h

View File

@ -7,6 +7,9 @@
"type_traits": "c",
"gpio.h": "c",
"stdint.h": "c",
"time.h": "c"
"time.h": "c",
"st7735.h": "c",
"stdbool.h": "c",
"bmfont.h": "c"
}
}

View File

@ -1,197 +1,103 @@
#pragma once
#include <stdint.h>
const uint8_t FONT_UNIFONT_16_16[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 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, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x7E, 0x00,
0x24, 0x00, 0x24, 0x00, 0x7E, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x49, 0x00, 0x48, 0x00,
0x38, 0x00, 0x0E, 0x00, 0x09, 0x00, 0x49, 0x00, 0x3E, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x4A, 0x00, 0x4C, 0x00, 0x34, 0x00,
0x08, 0x00, 0x18, 0x00, 0x16, 0x00, 0x29, 0x00, 0x49, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x22, 0x00, 0x14, 0x00,
0x18, 0x00, 0x29, 0x00, 0x45, 0x00, 0x42, 0x00, 0x46, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 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, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00,
0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x49, 0x00,
0x2A, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x49, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x7F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 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, 0x18, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3C, 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, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00,
0x08, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x24, 0x00, 0x42, 0x00, 0x46, 0x00,
0x4A, 0x00, 0x52, 0x00, 0x62, 0x00, 0x42, 0x00, 0x24, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x28, 0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x02, 0x00, 0x02, 0x00,
0x0C, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x02, 0x00, 0x02, 0x00,
0x1E, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x00, 0x14, 0x00, 0x24, 0x00,
0x44, 0x00, 0x44, 0x00, 0x7E, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00,
0x7C, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00,
0x7C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00,
0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x3C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x3E, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
const uint8_t FONT_UNIFONT_8_16[] = {
0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00,
0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x12, 0x7E, 0x24, 0x24, 0x7E, 0x48, 0x48, 0x48, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x3E, 0x49, 0x48, 0x38, 0x0E, 0x09, 0x49, 0x3E, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x31, 0x4A, 0x4C, 0x34, 0x08, 0x18, 0x16, 0x29, 0x49, 0x46, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x14, 0x18, 0x29, 0x45, 0x42, 0x46, 0x39, 0x00, 0x00,
0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x04, 0x00,
0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x49, 0x2A, 0x1C, 0x2A, 0x49, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x7F, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00,
0x10, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00,
0x08, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x02, 0x00, 0x02, 0x00,
0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x4A, 0x00, 0x56, 0x00,
0x52, 0x00, 0x52, 0x00, 0x52, 0x00, 0x4E, 0x00, 0x20, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x24, 0x00, 0x24, 0x00, 0x42, 0x00,
0x42, 0x00, 0x7E, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x7C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x40, 0x00, 0x40, 0x00,
0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x44, 0x00, 0x42, 0x00, 0x42, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x44, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00,
0x7C, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00,
0x7C, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x40, 0x00, 0x40, 0x00,
0x40, 0x00, 0x4E, 0x00, 0x42, 0x00, 0x42, 0x00, 0x46, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x7E, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00,
0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x44, 0x00, 0x44, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x44, 0x00, 0x48, 0x00, 0x50, 0x00,
0x60, 0x00, 0x60, 0x00, 0x50, 0x00, 0x48, 0x00, 0x44, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00,
0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00, 0x66, 0x00, 0x66, 0x00,
0x5A, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x62, 0x00, 0x62, 0x00, 0x52, 0x00,
0x52, 0x00, 0x4A, 0x00, 0x4A, 0x00, 0x46, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x7C, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x5A, 0x00, 0x66, 0x00, 0x3C, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x7C, 0x00, 0x48, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x40, 0x00, 0x40, 0x00,
0x30, 0x00, 0x0C, 0x00, 0x02, 0x00, 0x02, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x22, 0x00,
0x22, 0x00, 0x22, 0x00, 0x14, 0x00, 0x14, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00,
0x5A, 0x00, 0x66, 0x00, 0x66, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00, 0x24, 0x00, 0x24, 0x00,
0x18, 0x00, 0x24, 0x00, 0x24, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x22, 0x00, 0x22, 0x00,
0x14, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00,
0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x20, 0x00, 0x10, 0x00,
0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00,
0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x70, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x24, 0x00, 0x42, 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, 0x7F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 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, 0x3C, 0x00, 0x42, 0x00,
0x02, 0x00, 0x3E, 0x00, 0x42, 0x00, 0x42, 0x00, 0x46, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x5C, 0x00, 0x62, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x62, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00,
0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x3A, 0x00, 0x46, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x46, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00,
0x42, 0x00, 0x7E, 0x00, 0x40, 0x00, 0x40, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x7C, 0x00,
0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x44, 0x00, 0x44, 0x00,
0x44, 0x00, 0x38, 0x00, 0x20, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x5C, 0x00, 0x62, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x04, 0x00,
0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x48, 0x00, 0x30, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x44, 0x00, 0x48, 0x00,
0x50, 0x00, 0x60, 0x00, 0x50, 0x00, 0x48, 0x00, 0x44, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x49, 0x00,
0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x62, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x62, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x62, 0x00, 0x5C, 0x00, 0x40, 0x00, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x46, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x46, 0x00, 0x3A, 0x00, 0x02, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x62, 0x00,
0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00,
0x40, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x02, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x7C, 0x00,
0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x46, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00,
0x42, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x49, 0x00,
0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00,
0x24, 0x00, 0x18, 0x00, 0x24, 0x00, 0x24, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00,
0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x26, 0x00, 0x1A, 0x00, 0x02, 0x00, 0x02, 0x00, 0x3C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x02, 0x00,
0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00,
0x10, 0x00, 0x20, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x0C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
0x08, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x30, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x49, 0x00, 0x46, 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, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x46, 0x4A, 0x52, 0x62, 0x42, 0x24, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x02, 0x0C, 0x10, 0x20, 0x40, 0x40, 0x7E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x02, 0x1E, 0x02, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x24, 0x44, 0x44, 0x7E, 0x04, 0x04, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x02, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x40, 0x40, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x3E, 0x02, 0x02, 0x02, 0x04, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x02, 0x04, 0x08, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x4A, 0x56, 0x52, 0x52, 0x52, 0x4E, 0x20, 0x1E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x40, 0x4E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x66, 0x66, 0x5A, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x42, 0x62, 0x62, 0x52, 0x52, 0x4A, 0x4A, 0x46, 0x42, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x5A, 0x66, 0x3C, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x48, 0x44, 0x44, 0x44, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x30, 0x0C, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x5A, 0x66, 0x66, 0x42, 0x42, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x18, 0x24, 0x24, 0x42, 0x42, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0E, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00,
0x00, 0x00, 0x18, 0x24, 0x42, 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, 0x7F, 0x00,
0x00, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x7E, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0C, 0x10, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x44, 0x44, 0x44, 0x38, 0x20, 0x3C, 0x42, 0x42, 0x3C, 0x00,
0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x48, 0x30,
0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x40, 0x40,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x30, 0x0C, 0x02, 0x42, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x24, 0x42, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x26, 0x1A, 0x02, 0x02, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C,
0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x00, 0x30, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x30,
0x00, 0x00, 0x00, 0x31, 0x49, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const uint8_t FONT_UNIFONT_ASCII_WIDTH_16_16[] = {
const uint8_t FONT_UNIFONT_ASCII_WIDTH_8_16[] = {
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,

View File

@ -0,0 +1,37 @@
const uint16_t mute[][16] = {
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x05F8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x60FF,0x0000,0x0000,0x04E0,0x0000,},
{0x0000,0x0000,0x05F8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x60FF,0x0000,0x05F0,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x05F8,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x04F0,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x60FF,0x60FF,0x60FF,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x05F8,0x0000,0x80FF,0x0000,0x0000,0x04F0,0x60FF,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x05F8,0x60FF,0x60FF,0x05F0,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x05F0,0x60FF,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x05F8,0x60FF,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x05F0,0x80FF,0x60FF,0x05F8,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x05F0,0x0000,0x60FF,0x0000,0x0000,0x05F8,0x60FF,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x60FF,0x60FF,0x60FF,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x05F0,0x0000,0x0000,0x0000,0x0000,0x80FF,0x0000,0x0000,0x60FF,0x04F8,0x0000,0x0000,0x0000,},
{0x0000,0xA210,0x04F0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x60FF,0x0000,0x05F8,0x0000,0x0000,},
{0x0000,0x04F0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x60FF,0x0000,0x0000,0x05F8,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
};
const uint16_t stereo[][16] = {
{0x0000,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,},
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x4008,0x4008,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,},
{0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,},
{0x0000,0x60FF,0x0000,0x8010,0x6010,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,},
{0x0000,0x60FF,0x4008,0x4008,0x60FF,0x0000,0x0000,0x80FF,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x0000,},
{0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x60FF,0x60FF,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,},
{0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x60FF,0x60FF,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,},
{0x0000,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x80FF,0x0000,},
{0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,},
{0x2000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,},
{0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,},
{0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
};

View File

@ -0,0 +1,10 @@
#pragma once
#include <stdint.h>
const uint8_t IMG_STEREO[] = {
0x0F, 0x09, 0x30, 0xCC, 0x03, 0x30, 0x48, 0x00, 0x30, 0x78, 0x78, 0x30, 0x00, 0x48, 0x30, 0x03,
0xCC, 0x30, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x00, 0x00,
};
const uint32_t DATA_SIZE_IMG_STEREO = 34;

View File

@ -32,13 +32,13 @@ bmf_BitmapFont font_quan_8x8_obj = {
FONT_QUAN_ASCII_WIDTH_8_8
};
bmf_BitmapFont font_unifont_16x16_obj = {
bmf_BitmapFont font_unifont_8x16_obj = {
af_get_char_data,
FONT_UNIFONT_16_16,
FONT_UNIFONT_8_16,
8,
16,
16,
FONT_UNIFONT_ASCII_WIDTH_16_16
FONT_UNIFONT_ASCII_WIDTH_8_16
};
bmf_BitmapFont *font_quan_8x8 = &font_quan_8x8_obj;
bmf_BitmapFont *font_unifont_16x16 = &font_unifont_16x16_obj;
bmf_BitmapFont *font_unifont_8x16 = &font_unifont_8x16_obj;

View File

@ -3,4 +3,4 @@
#include "bmfont.h"
extern bmf_BitmapFont *font_quan_8x8;
extern bmf_BitmapFont *font_unifont_16x16;
extern bmf_BitmapFont *font_unifont_8x16;

View File

@ -1,11 +1,8 @@
#include <stdint.h>
#include <stdlib.h>
#include "bmfont.h"
#include "st7735.h"
#define malloc(s) malloc(s)
#define free(p) free(p)
#define BMFONT_CHAR_BUFFER_SIZE 32
#define bmf_TAB_SIZE 2
#define bmf_ASCII_EOF 0
#define bmf_ASCII_T 9
@ -26,7 +23,7 @@ typedef struct {
int16_t char_y;
uint32_t count;
uint32_t unicode;
uint8_t *utf8_text;
const uint8_t *utf8_text;
uint8_t last_char_width;
uint8_t is_looping;
} bmf_LoopState;
@ -37,7 +34,7 @@ void place_next_char(bmf_BitmapFont *font, bmf_LoopState *state) {
// get unicode char
uint32_t b_off = state->byte_offset;
uint32_t b_lim = state->byte_limit;
uint8_t *utf8_text = state->utf8_text;
const uint8_t *utf8_text = state->utf8_text;
if (b_off >= b_lim) {
state->is_looping = 0;
state->unicode = bmf_ASCII_EOF;
@ -80,7 +77,7 @@ void place_next_char(bmf_BitmapFont *font, bmf_LoopState *state) {
state->char_y += font->char_height;
state->char_x = state->start_x;
}
if (state->height_limit > 0 && (state->char_y + font->char_height - state->start_y > state->width_limit)) {
if (state->height_limit > 0 && (state->char_y + font->char_height - state->start_y > state->height_limit)) {
if (unicode == bmf_ASCII_N) {
state->byte_offset = b_off;
state->unicode = unicode;
@ -97,7 +94,7 @@ void place_next_char(bmf_BitmapFont *font, bmf_LoopState *state) {
return;
}
uint16_t bmf_get_text_width(bmf_BitmapFont *font, uint8_t *text, uint32_t bytes_len) {
uint16_t bmf_get_text_width(bmf_BitmapFont *font, const uint8_t *text, uint32_t bytes_len) {
uint16_t total_width = 0;
uint32_t b_off = 0;
while (b_off < bytes_len) {
@ -138,7 +135,7 @@ uint16_t bmf_get_text_width(bmf_BitmapFont *font, uint8_t *text, uint32_t bytes_
return total_width;
}
uint32_t bmf_draw_text(bmf_BitmapFont *font, uint8_t *text, uint32_t bytes_len, uint16_t x, uint16_t y, uint16_t width_limit, uint16_t height_limit, uint16_t color) {
uint32_t bmf_draw_text(bmf_BitmapFont *font, const uint8_t *text, uint32_t bytes_len, uint16_t x, uint16_t y, uint16_t width_limit, uint16_t height_limit, uint16_t color) {
bmf_LoopState state_obj = {bytes_len, 0, x, y, width_limit, height_limit, x, y, 0, 0, text, 0, 1};
bmf_LoopState *state = &state_obj;
bmf_FunctionGetCharImage get_char_image = font->get_char_image;
@ -147,7 +144,10 @@ uint32_t bmf_draw_text(bmf_BitmapFont *font, uint8_t *text, uint32_t bytes_len,
uint8_t wp = ch_w / 8;
wp += (ch_w % 8) ? 1 : 0;
uint16_t buffer_size = wp * ch_h;
uint8_t *buffer = malloc(buffer_size);
if (buffer_size > BMFONT_CHAR_BUFFER_SIZE) {
return 0;
}
uint8_t buffer[BMFONT_CHAR_BUFFER_SIZE];
while (state_obj.is_looping) {
place_next_char(font, state);
if (state_obj.is_looping && state_obj.unicode != bmf_ASCII_R && state_obj.unicode != bmf_ASCII_N && state_obj.unicode != bmf_ASCII_T && state_obj.unicode != bmf_ASCII_SPACE) {
@ -175,11 +175,10 @@ uint32_t bmf_draw_text(bmf_BitmapFont *font, uint8_t *text, uint32_t bytes_len,
}
}
}
free(buffer);
return state_obj.byte_offset;
}
uint32_t bmf_get_text_offset(bmf_BitmapFont *font, uint8_t *text, uint32_t bytes_len, uint16_t width_limit, uint16_t height_limit) {
uint32_t bmf_get_text_offset(bmf_BitmapFont *font, const uint8_t *text, uint32_t bytes_len, uint16_t width_limit, uint16_t height_limit) {
bmf_LoopState state_obj = {bytes_len, 0, 0, 0, width_limit, height_limit, 0, 0, 0, 0, text, 0, 1};
bmf_LoopState *state = &state_obj;
while (state_obj.is_looping) {

View File

@ -14,6 +14,6 @@ typedef struct bmf_BitmapFont {
const uint8_t *ascii_width; // size [94]
} bmf_BitmapFont;
uint16_t bmf_get_text_width(bmf_BitmapFont *font, uint8_t *text, uint32_t bytes_len);
uint32_t bmf_draw_text(bmf_BitmapFont *font, uint8_t *text, uint32_t bytes_len, uint16_t x, uint16_t y, uint16_t width_limit, uint16_t height_limit, uint16_t color);
uint32_t bmf_get_text_offset(bmf_BitmapFont *font, uint8_t *text, uint32_t bytes_len, uint16_t width_limit, uint16_t height_limit);
uint16_t bmf_get_text_width(bmf_BitmapFont *font, const uint8_t *text, uint32_t bytes_len);
uint32_t bmf_draw_text(bmf_BitmapFont *font, const uint8_t *text, uint32_t bytes_len, uint16_t x, uint16_t y, uint16_t width_limit, uint16_t height_limit, uint16_t color);
uint32_t bmf_get_text_offset(bmf_BitmapFont *font, const uint8_t *text, uint32_t bytes_len, uint16_t width_limit, uint16_t height_limit);

View File

@ -1,5 +1,6 @@
#include <stdint.h>
#include "monoimg.h"
#include "st7735.h"
#define max(a,b) ((a) >= (b) ? (a) : (b))
#define min(a,b) ((a) <= (b) ? (a) : (b))
@ -23,7 +24,7 @@ uint8_t mimg_get_pixel(const uint8_t *img, uint16_t x, uint16_t y) {
return mimg_get_pixel_unsafe(img, (uint8_t)x, (uint8_t)y);
}
void mimg_draw(mimg_FunctionSetPixel set_pixel, uint16_t x, uint16_t y, uint16_t color, const uint8_t *img, mimg_Area area) {
void mimg_draw(uint16_t x, uint16_t y, uint16_t color, const uint8_t *img, mimg_Area area) {
uint8_t width_s1 = img[0]; // width - 1
uint8_t height_s1 = img[1]; // height - 1
uint8_t ix = min(area.x, width_s1);
@ -34,13 +35,13 @@ void mimg_draw(mimg_FunctionSetPixel set_pixel, uint16_t x, uint16_t y, uint16_t
for (off_y = 0; off_y < ih; off_y ++) {
for (off_x = 0; off_x < iw; off_x ++) {
if (mimg_get_pixel_unsafe(img, ix + off_x, iy + off_y)) {
set_pixel(x + off_x, y + off_y, color);
ST7735_DrawPixel(x + off_x, y + off_y, color);
}
}
}
}
void mimg_draw_with_bg(mimg_FunctionSetPixel set_pixel, uint16_t x, uint16_t y, uint16_t color, uint16_t bg_color, const uint8_t *img, mimg_Area area) {
void mimg_draw_with_bg(uint16_t x, uint16_t y, uint16_t color, uint16_t bg_color, const uint8_t *img, mimg_Area area) {
uint8_t width_s1 = img[0]; // width - 1
uint8_t height_s1 = img[1]; // height - 1
uint8_t ix = min(area.x, width_s1);
@ -48,15 +49,22 @@ void mimg_draw_with_bg(mimg_FunctionSetPixel set_pixel, uint16_t x, uint16_t y,
uint8_t iw = min(area.w, width_s1 - ix + 1);
uint8_t ih = min(area.h, height_s1 - iy + 1);
uint8_t off_x, off_y;
ST7735_Select();
ST7735_SetAddressWindow(x, y, x + iw - 1, y + ih - 1);
ST7735_WriteCommand(ST7735_RAMWR);
HAL_GPIO_WritePin(ST7735_DC_GPIO_Port, ST7735_DC_Pin, GPIO_PIN_SET);
uint8_t data_color[] = {color >> 8, color & 0xFF};
uint8_t data_bg_color[] = {bg_color >> 8, bg_color & 0xFF};
for (off_y = 0; off_y < ih; off_y ++) {
for (off_x = 0; off_x < iw; off_x ++) {
if (mimg_get_pixel_unsafe(img, ix + off_x, iy + off_y)) {
set_pixel(x + off_x, y + off_y, color);
HAL_SPI_Transmit(&ST7735_SPI_PORT, data_color, sizeof(data_color), HAL_MAX_DELAY);
} else {
set_pixel(x + off_x, y + off_y, bg_color);
HAL_SPI_Transmit(&ST7735_SPI_PORT, data_bg_color, sizeof(data_bg_color), HAL_MAX_DELAY);
}
}
}
ST7735_Unselect();
}
mimg_Area mimg_get_tile_area(const uint8_t *img, uint8_t cols, uint8_t rows, uint8_t index) {

View File

@ -14,7 +14,7 @@ typedef struct mimg_Area
/** get a pixel from img, return 1 or 0 */
uint8_t mimg_get_pixel(const uint8_t *img, uint16_t x, uint16_t y);
/** draw a part of img {ix, iy, iw, ih} , at (x, y) with color */
void mimg_draw(mimg_FunctionSetPixel set_pixel, uint16_t x, uint16_t y, uint16_t color, const uint8_t *img, mimg_Area area);
void mimg_draw_with_bg(mimg_FunctionSetPixel set_pixel, uint16_t x, uint16_t y, uint16_t color, uint16_t bg_color, const uint8_t *img, mimg_Area area);
void mimg_draw(uint16_t x, uint16_t y, uint16_t color, const uint8_t *img, mimg_Area area);
void mimg_draw_with_bg(uint16_t x, uint16_t y, uint16_t color, uint16_t bg_color, const uint8_t *img, mimg_Area area);
/** calc tile area */
mimg_Area mimg_get_tile_area(const uint8_t *img, uint8_t cols, uint8_t rows, uint8_t index);

View File

@ -4,9 +4,11 @@
#include "time.h"
#include "st7735.h"
#include "Images/digi18x32.h"
#include "Images/img_stereo.h"
#include "monoimg.h"
#include "bmfont.h"
#include "asciifont.h"
#include "ui_utils.h"
void ui_text_number18x32(uint32_t num, uint16_t x, uint16_t y, uint16_t color) {
uint32_t tmp = num;
@ -20,12 +22,12 @@ void ui_text_number18x32(uint32_t num, uint16_t x, uint16_t y, uint16_t color) {
div = div / 10;
if (div == 0) {
mimg_Area area = mimg_get_tile_area(IMG_DIGI_18_32, 10, 1, 0);
mimg_draw(ST7735_DrawPixel, x, y, color, IMG_DIGI_18_32, area);
mimg_draw(x, y, color, IMG_DIGI_18_32, area);
} else {
while (div > 0) {
tmp = (num / div) % 10;
mimg_Area area = mimg_get_tile_area(IMG_DIGI_18_32, 10, 1, tmp);
mimg_draw(ST7735_DrawPixel, x, y, color, IMG_DIGI_18_32, area);
mimg_draw(x, y, color, IMG_DIGI_18_32, area);
x = x + 18;
div = div / 10;
}
@ -44,12 +46,12 @@ void ui_text_number18x32_with_bg(uint32_t num, uint16_t x, uint16_t y, uint16_t
div = div / 10;
if (div == 0) {
mimg_Area area = mimg_get_tile_area(IMG_DIGI_18_32, 10, 1, 0);
mimg_draw_with_bg(ST7735_DrawPixel, x, y, color, bg_color, IMG_DIGI_18_32, area);
mimg_draw_with_bg(x, y, color, bg_color, IMG_DIGI_18_32, area);
} else {
while (div > 0) {
tmp = (num / div) % 10;
mimg_Area area = mimg_get_tile_area(IMG_DIGI_18_32, 10, 1, tmp);
mimg_draw_with_bg(ST7735_DrawPixel, x, y, color, bg_color, IMG_DIGI_18_32, area);
mimg_draw_with_bg(x, y, color, bg_color, IMG_DIGI_18_32, area);
x = x + 18;
div = div / 10;
}
@ -72,8 +74,8 @@ void ui_com_title_bar(uint8_t clear, uint8_t *text, uint32_t bytes_len) {
if (clear) {
ST7735_FillRectangle(1, 1, ST7735_WIDTH - 2, 16, ST7735_BLACK);
}
uint16_t off_x = (ST7735_WIDTH - 2 - bmf_get_text_width(font_unifont_16x16, text, bytes_len)) / 2 + 1;
bmf_draw_text(font_unifont_16x16, text, bytes_len, off_x, 1, ST7735_WIDTH - 2, 16, ST7735_YELLOW);
uint16_t off_x = (ST7735_WIDTH - 2 - bmf_get_text_width(font_unifont_8x16, text, bytes_len)) / 2 + 1;
bmf_draw_text(font_unifont_8x16, text, bytes_len, off_x, 1, ST7735_WIDTH - 2, 16, ST7735_YELLOW);
}
void ui_com_freq_digital(uint8_t clear, uint8_t only_pointer) {
@ -105,12 +107,12 @@ void ui_com_freq_digital(uint8_t clear, uint8_t only_pointer) {
uint8_t blink_state = (ticks_ms() / UI_BLINK_MS) % 2;
uint8_t blink_state2 = !(global_data.point_mode & G_PMOD_PBLINK_MASK);
if (!(global_data.point_mode & G_PMOD_PMOVE_MASK) || (blink_state ^ blink_state2)) {
uint8_t p_pos = (global_data.point_mode & G_POMD_POS_MASK) >> G_POMD_POS_BOFF;
uint8_t p_pos = bit_fetch(global_data.point_mode, G_POMD_POS_BOFF, G_POMD_POS_MASK);
uint16_t p_off = (4 - p_pos) * 18 + 2 + off_x;
ST7735_FillRectangle(p_off, off_y + 33, 14, 2, color_orange);
global_data.point_mode = global_data.point_mode | G_PMOD_PBLINK2_MASK;
bit_set(global_data.point_mode, G_PMOD_PBLINK2_MASK);
} else {
global_data.point_mode = global_data.point_mode & (~G_PMOD_PBLINK2_MASK);
bit_clear(global_data.point_mode, G_PMOD_PBLINK2_MASK);
}
}
uint16_t scale = 10000;
@ -138,34 +140,28 @@ void ui_com_fm_am(uint8_t clear) {
ST7735_FillRectangle(ST7735_WIDTH - area_w - 1 - 1, off_y, area_w, 16, ST7735_BLACK);
}
if (global_data.rf_mode == G_RF_MODE_AM) {
off_x = (area_w - bmf_get_text_width(font_unifont_16x16, u8str("AM"), 2)) / 2;
bmf_draw_text(font_unifont_16x16, u8str("AM"), 2, off_x, off_y, area_w, 16, ST7735_YELLOW);
off_x = ST7735_WIDTH - area_w - 1 + (area_w - bmf_get_text_width(font_unifont_16x16, u8str("KHz"), 3)) / 2;
bmf_draw_text(font_unifont_16x16, u8str("KHz"), 3, off_x, off_y, area_w, 16, ST7735_BLUE);
off_x = (area_w - bmf_get_text_width(font_unifont_8x16, u8str("AM"), 2)) / 2;
bmf_draw_text(font_unifont_8x16, u8str("AM"), 2, off_x, off_y, area_w, 16, ST7735_YELLOW);
off_x = ST7735_WIDTH - area_w - 1 + (area_w - bmf_get_text_width(font_unifont_8x16, u8str("KHz"), 3)) / 2;
bmf_draw_text(font_unifont_8x16, u8str("KHz"), 3, off_x, off_y, area_w, 16, ST7735_BLUE);
} else {
off_x = (area_w - bmf_get_text_width(font_unifont_16x16, u8str("FM"), 2)) / 2;
bmf_draw_text(font_unifont_16x16, u8str("FM"), 2, off_x, off_y, area_w, 16, ST7735_GREEN);
off_x = ST7735_WIDTH - area_w - 1 + (area_w - bmf_get_text_width(font_unifont_16x16, u8str("MHz"), 3)) / 2;
bmf_draw_text(font_unifont_16x16, u8str("MHz"), 3, off_x, off_y, area_w, 16, ST7735_BLUE);
off_x = (area_w - bmf_get_text_width(font_unifont_8x16, u8str("FM"), 2)) / 2;
bmf_draw_text(font_unifont_8x16, u8str("FM"), 2, off_x, off_y, area_w, 16, ST7735_GREEN);
off_x = ST7735_WIDTH - area_w - 1 + (area_w - bmf_get_text_width(font_unifont_8x16, u8str("MHz"), 3)) / 2;
bmf_draw_text(font_unifont_8x16, u8str("MHz"), 3, off_x, off_y, area_w, 16, ST7735_BLUE);
}
}
void ui_com_progress_bar(uint8_t clear, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t border_color, uint16_t fill_color, uint32_t current, uint32_t total) {
if (clear) {
ST7735_FillRectangle(x, y, w, h, ST7735_BLACK);
}
void ui_com_progress_bar(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t border_color, uint16_t fill_color, uint32_t current, uint32_t total) {
// border
ST7735_FillRectangle(x, y, w, 1, border_color);
ST7735_FillRectangle(x, y + h - 1, w, 1, border_color);
ST7735_FillRectangle(x, y, 1, h, border_color);
ST7735_FillRectangle(x + w - 1, y, 1, h, border_color);
// bar
x += 1;
y += 1;
w -= 2;
h -= 2;
uint16_t bar_width = w * current / total;
ST7735_FillRectangle(x, y, bar_width, h, fill_color);
uint16_t bar_width = (w - 2) * current / total;
ST7735_FillRectangle(x + 1, y + 1, bar_width, h - 2, fill_color);
ST7735_FillRectangle(x + bar_width + 1, y + 1, (w - 2 - bar_width), h - 2, ST7735_BLACK);
}
void ui_com_vol_bar(uint8_t clear) {
@ -176,11 +172,17 @@ void ui_com_vol_bar(uint8_t clear) {
}
uint16_t color_skyblue = ST7735_COLOR565(0, 0x7F, 0xFF);
// text, 32x16
off_x = off_x + (32 - bmf_get_text_width(font_unifont_16x16, u8str("VOL"), 3)) / 2;
bmf_draw_text(font_unifont_16x16, u8str("VOL"), 3, off_x, off_y, 32, 16, color_skyblue);
off_x = off_x + (32 - bmf_get_text_width(font_unifont_8x16, u8str("VOL"), 3)) / 2;
bmf_draw_text(font_unifont_8x16, u8str("VOL"), 3, off_x, off_y, 32, 16, color_skyblue);
// bar
off_x = 1 + 32;
ui_com_progress_bar(clear, 33, off_y + 2, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, color_skyblue, global_data.volumn, 16);
if (global_data.flag & G_FL_MUTE) {
color_skyblue = ST7735_COLOR565(0x20, 0x20, 0x20);
// ui_com_progress_bar(33, off_y + 2, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, ST7735_COLOR565(0x20, 0x20, 0x20), G_VOLUMN_MAX, G_VOLUMN_MAX);
} else {
// ui_com_progress_bar(33, off_y + 2, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, color_skyblue, global_data.volumn, G_VOLUMN_MAX);
}
ui_com_progress_bar(33, off_y + 2, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, color_skyblue, global_data.volumn, G_VOLUMN_MAX);
}
void ui_com_sig_bar(uint8_t clear) {
@ -190,11 +192,22 @@ void ui_com_sig_bar(uint8_t clear) {
ST7735_FillRectangle(off_x, off_y, ST7735_WIDTH - 2, 16, ST7735_BLACK);
}
// text, 32x16
off_x = off_x + (32 - bmf_get_text_width(font_unifont_16x16, u8str("SIG"), 3)) / 2;
bmf_draw_text(font_unifont_16x16, u8str("SIG"), 3, off_x, off_y, 32, 16, ST7735_GREEN);
off_x = off_x + (32 - bmf_get_text_width(font_unifont_8x16, u8str("SIG"), 3)) / 2;
bmf_draw_text(font_unifont_8x16, u8str("SIG"), 3, off_x, off_y, 32, 16, ST7735_GREEN);
// bar
off_x = 1 + 32;
ui_com_progress_bar(clear, 33, off_y + 1, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, ST7735_GREEN, global_data.signal, 255);
ui_com_progress_bar(33, off_y + 1, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, ST7735_GREEN, global_data.signal, G_RSSI_MAX);
}
/* 图标 */
void icon_stereo() {
mimg_Area area = mimg_get_tile_area(IMG_STEREO, 1, 1, 0);
// margin 1px from left top border
if (global_data.flag & G_FL_MONO) {
ST7735_FillRectangle(8, 25, area.w, area.h, ST7735_BLACK);
} else {
mimg_draw_with_bg(8, 25, ST7735_YELLOW, ST7735_BLACK, IMG_STEREO, area);
}
}
/* 供外部调用的方法 */
@ -206,6 +219,7 @@ void ui_screen_main() {
ui_com_freq_digital(0, 0);
ui_com_vol_bar(0);
ui_com_sig_bar(0);
icon_stereo();
}
void ui_screen_main_animation() {

View File

@ -11,6 +11,8 @@ void ui_com_freq_digital(uint8_t clear, uint8_t only_pointer);
void ui_com_fm_am(uint8_t clear);
void ui_com_vol_bar(uint8_t clear);
void ui_com_sig_bar(uint8_t clear);
/* 图标 */
void icon_stereo();
/* 绘制主界面 */
void ui_screen_main();
void ui_screen_main_animation();

175
Core/App/Graphic/ui_menu.c Normal file
View File

@ -0,0 +1,175 @@
#include <stdint.h>
#include "keypad.h"
#include "st7735.h"
#include "asciifont.h"
#include "ui_menu.h"
#include "ui_utils.h"
#define LIST_STYLE_SELECTED_COLOR_BG ST7735_COLOR565(0x40, 0x40, 0x40)
#define LIST_STYLE_OFFSET_LEFT 32
#define UI_HALF_Y (UI_Y + (UI_H / 2))
#define LIST_PAGE_SIZE (UI_H / font_unifont_8x16->char_height)
#define LIST_PAGE_SIZE_HALF ((LIST_PAGE_SIZE + 1) / 2)
#define LIST_ITEM_LEVEL(p) ((p < LIST_PAGE_SIZE_HALF) ? (p) : (LIST_PAGE_SIZE - p - 1))
#define UI_LIST_OFFSET_X(p) (UI_X + (LIST_STYLE_OFFSET_LEFT * LIST_ITEM_LEVEL(p) / (LIST_PAGE_SIZE_HALF - 1)) + 8)
#define UI_LIST_OFFSET_Y(p) (UI_Y + (font_unifont_8x16->char_height * p))
#define UI_LIST_WIDTH(p) (UI_W - (LIST_STYLE_OFFSET_LEFT * LIST_ITEM_LEVEL(p) / (LIST_PAGE_SIZE_HALF - 1)) - 8)
#define U8_RESET 255
/*
0
1
2
3
4
5
6
7
8
*/
static uint16_t get_item_count(uiu_GetStrItemFunc get_item) {
uint16_t len = 0;
while (get_item(len).len > 0) {
len ++;
}
return len;
}
static void render_page_number(uint8_t curr, uint8_t total) {
uint8_t number_str[4] = {0, 0, 0, 0};
uint8_t scale = 100;
uint8_t num_pos = 0;
while (scale > 0) {
uint8_t num = (curr / scale) % 10;
scale /= 10;
if (num == 0 && num_pos == 0) continue;
number_str[num_pos] = '0' + num;
num_pos ++;
}
uiu_text_area(font_quan_8x8, number_str, 4,
UI_X, UI_HALF_Y - 1 - font_quan_8x8->char_height - 1,
font_quan_8x8->char_width * 3, font_quan_8x8->char_height,
uiu_ALIGN_HCENTER | uiu_ALIGN_VCENTER, ST7735_YELLOW, ST7735_BLACK
);
number_str[0] = 0;
number_str[1] = 0;
number_str[2] = 0;
number_str[3] = 0;
scale = 100;
num_pos = 0;
while (scale > 0) {
uint8_t num = (total / scale) % 10;
scale /= 10;
if (num == 0 && num_pos == 0) continue;
number_str[num_pos] = '0' + num;
num_pos ++;
}
uiu_text_area(font_quan_8x8, number_str, 4,
UI_X, UI_HALF_Y + 2,
font_quan_8x8->char_width * 3, font_quan_8x8->char_height,
uiu_ALIGN_HCENTER | uiu_ALIGN_VCENTER, ST7735_YELLOW, ST7735_BLACK
);
}
IndexResult iui_list_select(const uint8_t *title, uint32_t len, uiu_GetStrItemFunc get_item, uint16_t init_index) {
uint16_t item_count = get_item_count(get_item);
uint16_t pointer = init_index % item_count;
uint8_t tmp_pointer = U8_RESET;
uint8_t last_pointer = U8_RESET;
uint16_t page_start = (pointer / LIST_PAGE_SIZE) * LIST_PAGE_SIZE;
printf("item count: %u\n", item_count);
// clear
ST7735_FillScreen(ST7735_BLACK);
// render title
uiu_title(title, len);
// render line
ST7735_DrawLine(UI_X, UI_Y + font_unifont_8x16->char_height, LIST_STYLE_OFFSET_LEFT - 1, UI_HALF_Y - 1, ST7735_YELLOW);
ST7735_DrawLine(UI_X, UI_Y + UI_H - font_unifont_8x16->char_height - 1, LIST_STYLE_OFFSET_LEFT - 1, UI_HALF_Y, ST7735_YELLOW);
ST7735_FillRectangle(UI_X, UI_HALF_Y - 1, LIST_STYLE_OFFSET_LEFT - 1, 1, ST7735_YELLOW);
while (1) {
uint8_t event = kp_query();
uint8_t et = kp_Type(event);
uint8_t ev = kp_Value(event);
// process event
if (et == kp_ROTATE_RIGHT || et == kp_ROTATE_LEFT) {
if (et == kp_ROTATE_RIGHT) {
pointer += ev;
} else {
pointer += (0x7FFF / item_count) * item_count;
pointer -= ev;
}
pointer %= item_count;
if (((pointer / LIST_PAGE_SIZE) * LIST_PAGE_SIZE) != page_start) {
last_pointer = U8_RESET;
page_start = ((pointer / LIST_PAGE_SIZE) * LIST_PAGE_SIZE);
}
tmp_pointer = U8_RESET;
printf("Move list pointer to %u\n", pointer);
} else if (et == kp_SHORT_CLICK) {
if (ev == kp_KEYENCODER) {
discare_kp_events();
printf("Confirm list item %u\n", pointer);
IndexResult ret = {pointer, 1};
return ret;
}
} else if (et == kp_LONG_PRESS) {
if (ev == kp_KEYENCODER) {
discare_kp_events();
printf("Cancel list item %u\n", pointer);
IndexResult ret = {pointer, 0};
return ret;
}
} else if (et != kp_NOP) {
printf("Unhandled event: %u %u\n", et, ev);
}
// render items
if (tmp_pointer == U8_RESET) {
// need render
if (last_pointer == U8_RESET) {
// render all
render_page_number((pointer / LIST_PAGE_SIZE) + 1, (item_count + LIST_PAGE_SIZE - 1) / LIST_PAGE_SIZE);
for (tmp_pointer = 0; tmp_pointer < LIST_PAGE_SIZE; tmp_pointer ++) {
uint16_t current = page_start + tmp_pointer;
if (current >= item_count) {
uiu_text_area(font_unifont_8x16, u8str(" "), 1,
UI_LIST_OFFSET_X(tmp_pointer), UI_LIST_OFFSET_Y(tmp_pointer),
UI_LIST_WIDTH(tmp_pointer), font_unifont_8x16->char_height,
uiu_ALIGN_HCENTER | uiu_ALIGN_VCENTER, ST7735_WHITE, ST7735_BLACK
);
continue;
}
StrItem item = get_item(current);
if (current == pointer) {
uiu_text_area(font_unifont_8x16, item.text, item.len,
UI_LIST_OFFSET_X(tmp_pointer), UI_LIST_OFFSET_Y(tmp_pointer),
UI_LIST_WIDTH(tmp_pointer), font_unifont_8x16->char_height,
uiu_ALIGN_HCENTER | uiu_ALIGN_VCENTER, ST7735_GREEN, LIST_STYLE_SELECTED_COLOR_BG
);
last_pointer = tmp_pointer;
} else {
uiu_text_area(font_unifont_8x16, item.text, item.len,
UI_LIST_OFFSET_X(tmp_pointer), UI_LIST_OFFSET_Y(tmp_pointer),
UI_LIST_WIDTH(tmp_pointer), font_unifont_8x16->char_height,
uiu_ALIGN_HCENTER | uiu_ALIGN_VCENTER, ST7735_WHITE, ST7735_BLACK
);
}
}
} else {
StrItem item = get_item(page_start + last_pointer);
uiu_text_area(font_unifont_8x16, item.text, item.len,
UI_LIST_OFFSET_X(last_pointer), UI_LIST_OFFSET_Y(last_pointer),
UI_LIST_WIDTH(last_pointer), font_unifont_8x16->char_height,
uiu_ALIGN_HCENTER | uiu_ALIGN_VCENTER, ST7735_WHITE, ST7735_BLACK
);
last_pointer = pointer - page_start;
StrItem item_curr = get_item(pointer);
uiu_text_area(font_unifont_8x16, item_curr.text, item_curr.len,
UI_LIST_OFFSET_X(last_pointer), UI_LIST_OFFSET_Y(last_pointer),
UI_LIST_WIDTH(last_pointer), font_unifont_8x16->char_height,
uiu_ALIGN_HCENTER | uiu_ALIGN_VCENTER, ST7735_GREEN, LIST_STYLE_SELECTED_COLOR_BG
);
}
tmp_pointer = 0;
}
}
}

View File

@ -0,0 +1,5 @@
#pragma once
#include <stdint.h>
#include "ui_utils.h"
IndexResult iui_list_select(const uint8_t *title, uint32_t len, uiu_GetStrItemFunc get_item, uint16_t init_index);

View File

@ -0,0 +1,60 @@
#include <stdint.h>
#include "ui_utils.h"
#include "st7735.h"
#include "bmfont.h"
#include "asciifont.h"
#define MAX_LINES 16
#define TITLE_COLOR_BG ST7735_COLOR565(0x20, 0x20, 0x20)
const StrItem NULL_STR_ITEM = { NULL, 0 };
void uiu_text_area(bmf_BitmapFont *font, const uint8_t *text, uint32_t len, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t align, uint16_t color, uint16_t bg_color) {
// calc line width
uint16_t lws[MAX_LINES];
uint16_t gws[MAX_LINES];
uint16_t max_width = 0;
uint8_t lines = 0;
uint16_t p_off = 0;
while ((p_off < len) && ((lines + 1) * font->char_height <= h) && (lines < MAX_LINES)) {
uint16_t fitlen = bmf_get_text_offset(font, text + p_off, len - p_off, w, font->char_height);
if (fitlen == 0) {
break;
}
lws[lines] = fitlen;
gws[lines] = bmf_get_text_width(font, text + p_off, fitlen);
max_width = (gws[lines] > max_width) ? gws[lines] : max_width;
lines ++;
p_off += fitlen;
}
// draw lines
uint16_t off_x = 0;
uint16_t off_y = 0;
if (align & uiu_ALIGN_VBOTTOM) {
off_y = y + (h - (lines * font->char_height));
}else if (align & uiu_ALIGN_VCENTER) {
off_y = y + ((h - (lines * font->char_height)) / 2);
}else {
off_y = y;
}
uint8_t cur_lines;
p_off = 0;
ST7735_FillRectangle(x, y, w, h, bg_color);
for (cur_lines = 0; cur_lines < lines; cur_lines ++) {
if (align & uiu_ALIGN_HRIGHT) {
off_x = x + (w - gws[cur_lines]);
} else if (align & uiu_ALIGN_HCENTER) {
off_x = x + ((w - gws[cur_lines]) / 2);
} else {
off_x = x;
}
bmf_draw_text(font, text + p_off, lws[cur_lines], off_x, off_y, gws[cur_lines], font->char_height, color);
off_y += font->char_height;
p_off += lws[cur_lines];
}
}
void uiu_title(const uint8_t *text, uint32_t len) {
ST7735_FillRectangle(0, 0, ST7735_WIDTH, 16, TITLE_COLOR_BG);
uiu_text_area(font_unifont_8x16, text, len, 0, 0, ST7735_WIDTH, 16, uiu_ALIGN_HCENTER | uiu_ALIGN_VCENTER, ST7735_YELLOW, TITLE_COLOR_BG);
}

View File

@ -0,0 +1,41 @@
#pragma once
#include <stdint.h>
#include <stdlib.h>
#include "bmfont.h"
#include "st7735.h"
#define uiu_ALIGN_HLEFT 0b00000001
#define uiu_ALIGN_HCENTER 0b00000010
#define uiu_ALIGN_HRIGHT 0b00000100
#define uiu_ALIGN_VTOP 0b00010000
#define uiu_ALIGN_VCENTER 0b00100000
#define uiu_ALIGN_VBOTTOM 0b01000000
#define UI_X 0
#define UI_Y 16
#define UI_W (ST7735_WIDTH)
#define UI_H (ST7735_HEIGHT - 16)
typedef struct
{
const uint8_t *text;
const uint32_t len;
} StrItem;
typedef struct
{
uint16_t index;
uint8_t confirmed;
} IndexResult;
extern const StrItem NULL_STR_ITEM;
/** get string item in the list.
* @param index item index
* @return STR_ITEM, if STR_ITEM.len == 0 means item not exist.
*/
typedef StrItem (*uiu_GetStrItemFunc)(uint16_t index);
void uiu_text_area(bmf_BitmapFont *font, const uint8_t *text, uint32_t len, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t align, uint16_t color, uint16_t bg_color);
void uiu_title(const uint8_t *text, uint32_t len);

View File

@ -92,3 +92,10 @@ uint8_t kp_query() {
}
return K_EVENT(kp_NOP, 0);
}
void discare_kp_events() {
uint8_t event = kp_query();
while (kp_Type(event) != kp_NOP) {
event = kp_query();
}
}

View File

@ -19,7 +19,8 @@
#define kp_Type(x) (x & 0b1111)
#define kp_Value(x) (x >> 4)
#define kp_LONG_PRESS_TIMEOUT_MS 250
#define kp_LONG_PRESS_TIMEOUT_MS 500
// query and return keypad event
uint8_t kp_query();
void discare_kp_events(void);

View File

@ -4,6 +4,40 @@
#include "keypad.h"
#include "global.h"
#include "time.h"
#include "kt0915.h"
/** test */
#include "ui_menu.h"
#include "ui_utils.h"
static const uint8_t *item_text = u8str("qwertyuiop");
static StrItem app_get_item(uint16_t index) {
if (index >= 10) {
return NULL_STR_ITEM;
}
StrItem item = { item_text, 1 };
item.text += index;
return item;
}
void test() {
ST7735_FillScreen(ST7735_BLACK);
printf("test start.\n");
while (1) {
IndexResult res = iui_list_select(u8str("Kobold's Menu"), 33, app_get_item, 0);
printf("You Selected '%s'\n", app_get_item(res.index).text);
if (res.confirmed) {
printf("and you confirmed it.\n");
} else {
printf("but you canceled it.\n");
}
}
// end
printf("test end.\n");
while (1) {
}
}
/** test end */
void __limit_freq_range() {
uint16_t limit_min = (global_data.rf_mode == G_RF_MODE_AM) ? G_AM_FREQ_MIN : G_FM_FREQ_MIN;
@ -15,23 +49,81 @@ void __limit_freq_range() {
}
}
void __ensure_mute() {
if (global_data.flag & G_FL_MUTE) {
KT0915_setAudioMute(1);
} else {
KT0915_setAudioMute(0);
}
}
void __send_freq() {
// TODO: 发送频率
if (global_data.rf_mode == G_RF_MODE_AM) {
KT0915_setFrequency(global_data.freq);
printf("Set Frequency to %u kHz\n", global_data.freq);
} else {
KT0915_setFrequency(global_data.freq * 50ul);
printf("Set Frequency to %lu kHz\n", global_data.freq * 50ul);
}
}
void __send_volumn() {
KT0915_setVolume(global_data.volumn);
printf("Set Volumn to %u\n", global_data.volumn);
}
void __switch_to_fm() {
// TODO: 切换到FM模式
KT0915_setFM(G_FM_FREQ_MIN * 50ul, G_FM_FREQ_MAX * 50ul, G_FM_FREQ_MIN * 50ul, 50u);
printf("Switched to FM Mode\n");
__send_freq();
__ensure_mute();
}
void __switch_to_am() {
// TODO: 切换到AM模式
KT0915_setAM(G_AM_FREQ_MIN, G_AM_FREQ_MAX, G_AM_FREQ_MIN, 1, 0);
printf("Switched to AM Mode\n");
__send_freq();
__ensure_mute();
}
uint16_t __read_rssi() {
if (global_data.rf_mode == G_RF_MODE_AM) {
return (uint16_t)KT0915_getAmRssi() / 3;
} else {
return (uint16_t)KT0915_getFmRssi() / 3;
}
}
void __init_kt0915() {
KT0915_enable(1);
KT0915_setup(OSCILLATOR_32KHZ, 0);
KT0915_setSoftMute(1);
KT0915_setMono(0);
uint16_t did = KT0915_getDeviceId();
printf("kt0915 device id: %X\n", did);
__switch_to_fm();
__send_volumn();
KT0915_setSoftMute(0);
}
static int32_t target_time_stamp = 0;
void timer_event() {
if (ticks_diff(ticks_ms(), target_time_stamp) > 0) {
target_time_stamp = ticks_add(target_time_stamp, 500);
// update rssi
global_data.signal = __read_rssi();
ui_com_sig_bar(0);
}
}
void app_init() {
// 程序开始时执行一次
ui_screen_main();
kp_query();
printf("\n====start====\n");
target_time_stamp = ticks_add(ticks_ms(), 500);
kp_query();
// __init_kt0915();
// ui_screen_main();
test();
}
void app_main_loop() {
@ -42,7 +134,7 @@ void app_main_loop() {
if (event_type == kp_ROTATE_RIGHT || event_type == kp_ROTATE_LEFT) {
if (global_data.point_mode & G_PMOD_MODE_MASK) {
// 指针模式调整
uint8_t p_pos = (global_data.point_mode & G_POMD_POS_MASK) >> G_POMD_POS_BOFF;
uint8_t p_pos = bit_fetch(global_data.point_mode, G_POMD_POS_BOFF, G_POMD_POS_MASK);
if (global_data.point_mode & G_PMOD_PMOVE_MASK) {
// 调整指针位置
if (event_type == kp_ROTATE_RIGHT) {
@ -52,8 +144,7 @@ void app_main_loop() {
p_pos += event_value;
}
p_pos %= 5; // 0~4, 右边第一个数值为0号位置
global_data.point_mode = global_data.point_mode & (~G_POMD_POS_MASK);
global_data.point_mode = global_data.point_mode | ((p_pos << G_POMD_POS_BOFF) & G_POMD_POS_MASK);
bit_replace(global_data.point_mode, p_pos, G_POMD_POS_BOFF, G_POMD_POS_MASK);
printf("Adjust Point Pos: %u\n", p_pos);
} else {
// 调整指针位置的数字
@ -120,17 +211,22 @@ void app_main_loop() {
global_data.freq = num_freq / 5;
}
printf("Adjust Freq: %u\n", global_data.freq);
__limit_freq_range();
__send_freq();
}
} else {
// 直接调整频率
if (global_data.rf_mode == G_RF_MODE_FM) {
event_value = event_value * 2;
}
if (event_type == kp_ROTATE_RIGHT) {
global_data.freq += event_value;
} else {
global_data.freq -= event_value;
}
printf("Adjust Freq: %u\n", global_data.freq);
__limit_freq_range();
__send_freq();
printf("Adjust Freq: %u\n", global_data.freq);
}
ui_com_freq_digital(1, 0);
} else if (event_type == kp_SHORT_CLICK) {
@ -138,16 +234,16 @@ void app_main_loop() {
if (event_value == kp_KEYENCODER) {
if (global_data.point_mode & G_PMOD_PMOVE_MASK) {
// 退出移动指针模式
global_data.point_mode = global_data.point_mode & (~G_PMOD_PMOVE_MASK);
bit_clear(global_data.point_mode, G_PMOD_PMOVE_MASK);
printf("Exit Pointer Move Mode.\n");
} else {
// 进入移动指针模式
global_data.point_mode = global_data.point_mode | G_PMOD_PMOVE_MASK;
bit_set(global_data.point_mode, G_PMOD_PMOVE_MASK);
uint8_t blink_state = (ticks_ms() / UI_BLINK_MS) % 2; // 该时间段指示条消失
if (blink_state) {
global_data.point_mode = global_data.point_mode | G_PMOD_PBLINK_MASK;
bit_set(global_data.point_mode, G_PMOD_PBLINK_MASK);
} else {
global_data.point_mode = global_data.point_mode & (~G_PMOD_PBLINK_MASK);
bit_clear(global_data.point_mode, G_PMOD_PBLINK_MASK);
}
printf("Enter Pointer Move Mode.\n");
}
@ -166,25 +262,45 @@ void app_main_loop() {
}
ui_com_fm_am(1);
ui_com_freq_digital(1, 0);
} else if (event_value == kp_KEY3) {
if (global_data.volumn < G_VOLUMN_MAX) {
global_data.volumn += 1;
__send_volumn();
ui_com_vol_bar(0);
}
} else if (event_value == kp_KEY5) {
if (global_data.volumn > 0) {
global_data.volumn -= 1;
__send_volumn();
ui_com_vol_bar(0);
}
}
} else if (event_type == kp_LONG_PRESS) {
if (event_value == kp_KEYENCODER) {
if (global_data.point_mode & G_PMOD_MODE_MASK) {
// 退出指针模式
global_data.point_mode = global_data.point_mode & (~G_PMOD_MODE_MASK);
__limit_freq_range();
__send_freq();
bit_clear(global_data.point_mode, G_PMOD_MODE_MASK);
printf("Exit Pointer Mode.\n");
} else {
// 进入指针模式
global_data.point_mode = global_data.point_mode | G_PMOD_MODE_MASK;
global_data.point_mode = global_data.point_mode & (~G_PMOD_PMOVE_MASK);
bit_set(global_data.point_mode, G_PMOD_MODE_MASK);
bit_clear(global_data.point_mode, G_PMOD_PMOVE_MASK);
printf("Enter Pointer Mode.\n");
}
ui_com_freq_digital(1, 0);
} else if (event_value == kp_KEY5) {
if (global_data.flag & G_FL_MUTE) {
KT0915_setAudioMute(0);
CLEAR_BIT(global_data.flag, G_FL_MUTE);
} else {
KT0915_setAudioMute(1);
SET_BIT(global_data.flag, G_FL_MUTE);
}
ui_com_vol_bar(0);
}
} else if (event_type != kp_NOP) {
printf("event: %u, key: %u\n", event_type, event_value);
}
timer_event();
ui_screen_main_animation();
}

View File

@ -2,9 +2,11 @@
#include "global.h"
GlobalData global_data = {
880 * 2, // freq
0b0000000000000001, //flag
// 880 * 2, // freq
893 * 2, // freq
G_RF_MODE_FM, //rf_mode
16, // volumn
97, //signal
0, //signal
0b00000000 //point_mode
};

View File

@ -3,21 +3,35 @@
#include <stdint.h>
#define G_RF_MODE_FM 0x00
#define G_RF_MODE_AM 0x01
#define G_FM_FREQ_MIN 880*2
#define G_FM_FREQ_MIN 330*2
#define G_FM_FREQ_MAX 1080*2
#define G_AM_FREQ_MIN 100
#define G_AM_FREQ_MAX 33000
#define G_VOLUMN_MIN 0
#define G_VOLUMN_MAX 31
#define G_RSSI_MAX 0b11111
#define G_FL_MUTE 0b0000000000000001
#define G_FL_MONO 0b0000000000000010
#define G_PMOD_MODE_MASK 0b00000001
#define G_PMOD_PMOVE_MASK 0b00000010
#define G_POMD_POS_MASK 0b00011100
#define G_POMD_POS_BOFF 2
#define G_POMD_POS_BLEN 3
#define G_PMOD_PBLINK_MASK 0b00100000
#define G_PMOD_PBLINK2_MASK 0b01000000
#define bit_set(x, mask) (x = x | mask)
#define bit_clear(x, mask) (x = x & (~mask))
#define bit_replace(x, v, voff, mask) ((x = x & (~mask)), (x = x | ((v << voff) & mask)))
#define bit_fetch(x, voff, mask) ((x & mask) >> voff)
typedef struct GlobalData {
/** FM x50kHz AM x1kHz */
/** 各种flag
* bit 0 signal改变flag
*/
uint16_t flag;
uint16_t freq;
uint8_t rf_mode;
uint8_t volumn;
@ -29,7 +43,7 @@ typedef struct GlobalData {
* bit 5 ()
* bit 6 ()
*/
volatile uint8_t point_mode;
uint8_t point_mode;
} GlobalData;
extern GlobalData global_data;

View File

@ -1,4 +1,4 @@
#include "KT0915.h"
#include "kt0915.h"
#define enablePort GPIOB

View File

@ -77,7 +77,7 @@ static const uint8_t
ST7735_DISPON, DELAY, // 4: Main screen turn on, no args w/delay
100}; // 100 ms delay
static void ST7735_Select()
void ST7735_Select()
{
HAL_GPIO_WritePin(ST7735_CS_GPIO_Port, ST7735_CS_Pin, GPIO_PIN_RESET);
}
@ -87,21 +87,21 @@ void ST7735_Unselect()
HAL_GPIO_WritePin(ST7735_CS_GPIO_Port, ST7735_CS_Pin, GPIO_PIN_SET);
}
static void ST7735_Reset()
void ST7735_Reset()
{
HAL_GPIO_WritePin(ST7735_RES_GPIO_Port, ST7735_RES_Pin, GPIO_PIN_RESET);
HAL_Delay(5);
HAL_GPIO_WritePin(ST7735_RES_GPIO_Port, ST7735_RES_Pin, GPIO_PIN_SET);
}
static void ST7735_WriteCommand(uint8_t cmd)
void ST7735_WriteCommand(uint8_t cmd)
{
HAL_GPIO_WritePin(ST7735_DC_GPIO_Port, ST7735_DC_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(&ST7735_SPI_PORT, &cmd, sizeof(cmd), HAL_MAX_DELAY);
// SPI_Write(&cmd, sizeof(cmd));
}
static void ST7735_WriteData(uint8_t *buff, size_t buff_size)
void ST7735_WriteData(uint8_t *buff, size_t buff_size)
{
HAL_GPIO_WritePin(ST7735_DC_GPIO_Port, ST7735_DC_Pin, GPIO_PIN_SET);
HAL_SPI_Transmit(&ST7735_SPI_PORT, buff, buff_size, HAL_MAX_DELAY);
@ -139,7 +139,7 @@ static void ST7735_ExecuteCommandList(const uint8_t *addr)
}
}
static void ST7735_SetAddressWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)
void ST7735_SetAddressWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)
{
// column address set
ST7735_WriteCommand(ST7735_CASET);
@ -178,54 +178,61 @@ void ST7735_DrawPixel(uint16_t x, uint16_t y, uint16_t color) //画点
ST7735_Unselect();
}
void ST7735_DrawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,uint16_t color) //画线
void ST7735_DrawLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2,uint16_t color)
{
int16_t dx = x2 - x1;
int16_t sx;
if (dx > 0) {
sx = 1;
} else {
dx = -dx;
sx = -1;
}
int16_t dy = y2 - y1;
int16_t sy;
if (dy > 0) {
sy = 1;
} else {
dy = -dy;
sy = -1;
}
uint8_t steep;
if (dy > dx) {
int16_t temp;
int16_t steep = abs(y1 - y0) > abs(x1 - x0);
if (steep) {
temp = x0;
x0 = y0;
y0 = temp;
temp = x1;
x0 = y1;
x1 = y1;
y1 = temp;
}
if (x0 > x1) {
temp = x1;
x1 = x0;
x0 = temp;
temp = y1;
y1 = y0;
y0 = temp;
}
int16_t dx, dy;
dx = x1 - x0;
dy = abs(y1 - y0);
int16_t err = dx / 2;
int16_t ystep;
if (y0 < y1) {
ystep = 1;
temp = dx;
dx = dy;
dy = temp;
temp = sx;
sx = sy;
sy = temp;
steep = 1;
} else {
ystep = -1;
steep = 0;
}
for (; x0 <= x1; x0++) {
int16_t e = 2 * dy - dx;
int16_t i;
for (i = 0; i < dx; ++i) {
if (steep) {
ST7735_DrawPixel(y0, x0, color);
if (0 <= y1 && y1 < ST7735_WIDTH && 0 <= x1 && x1 < ST7735_HEIGHT) {
ST7735_DrawPixel(y1, x1, color);
}
} else {
ST7735_DrawPixel(x0, y0, color);
if (0 <= x1 && x1 < ST7735_WIDTH && 0 <= y1 && y1 < ST7735_HEIGHT) {
ST7735_DrawPixel(x1, y1, color);
}
err -= dy;
if (err < 0) {
y0 += ystep;
err += dx;
}
while (e >= 0) {
y1 += sy;
e -= 2 * dx;
}
x1 += sx;
e += 2 * dy;
}
if (0 <= x2 && x2 < ST7735_WIDTH && 0 <= y2 && y2 < ST7735_HEIGHT) {
ST7735_DrawPixel(x2, y2, color);
}
}

View File

@ -237,6 +237,11 @@ extern SPI_HandleTypeDef ST7735_SPI_PORT;
// call before initializing any SPI devices
void ST7735_Unselect(void);
void ST7735_Select(void);
void ST7735_Reset(void);
void ST7735_WriteCommand(uint8_t cmd);
void ST7735_WriteData(uint8_t *buff, size_t buff_size);
void ST7735_SetAddressWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1);
void ST7735_Init(void);
void ST7735_DrawPixel(uint16_t x, uint16_t y, uint16_t color);

View File

@ -73,13 +73,15 @@ Core/App/app.c \
Core/App/global.c \
Core/Hardware/RotaryCoder/RotaryCoder.c \
Core/Hardware/ST7735/st7735.c \
Core/Hardware/KT0915/kt0915.c \
Core/Hardware/SWI2C/i2c_sw.c \
Core/App/Graphic/monoimg.c \
Core/App/Graphic/ui_menu.c \
Core/App/Graphic/ui_utils.c \
Core/App/Graphic/ui.c \
Core/App/Graphic/bmfont.c \
Core/App/Graphic/asciifont.c \
Core/App/Input/keypad.c \
#Core/Hardware/kt0915/KT0915.C \
#Core/Hardware/SWI2C/i2c_sw.c \
Core/App/Input/keypad.c
# ASM sources
@ -146,16 +148,16 @@ C_INCLUDES = \
-ICore/App \
-ICore/Hardware/RotaryCoder \
-ICore/Hardware/ST7735 \
-ICore/Hardware/KT0915 \
-ICore/Hardware/SWI2C \
-ICore/App/Graphic \
-ICore/App/Input \
#-ICore/Hardware/kt0915 \
#-ICore/Hardware/SWI2C \
-ICore/App/Input
# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections -fstack-usage
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
@ -221,7 +223,10 @@ clean:
# flash
#######################################
flash:
-JLinkExe cmd.jexe
-JLinkExe flash.jexe
reset:
-JLinkExe reset.jexe
#######################################
# dependencies

View File

@ -1,3 +0,0 @@
#!/bin/bash
JLinkExe cmd.jexe

7
reset.jexe Normal file
View File

@ -0,0 +1,7 @@
Device STM32G030C8
SelectInterface SWD
Speed auto
Connect
Reset
Go
EXit

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