mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
import modTrezorUi source
This commit is contained in:
parent
711adbeea4
commit
0069b72f26
197
extmod/modTrezorUi/modTrezorUi-font_roboto.h
Normal file
197
extmod/modTrezorUi/modTrezorUi-font_roboto.h
Normal file
@ -0,0 +1,197 @@
|
||||
// first two bytes are width and height of the glyph
|
||||
// third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph
|
||||
// rest is packed 4-bit glyph data
|
||||
|
||||
/* */ static const uint8_t glyph_32[] = { 0, 0, 4, 0, 0, };
|
||||
/* ! */ static const uint8_t glyph_33[] = { 3, 13, 5, 1, 13, 143, 40, 242, 143, 39, 241, 127, 23, 241, 127, 23, 241, 111, 1, 64, 0, 4, 194, 111, 48 };
|
||||
/* " */ static const uint8_t glyph_34[] = { 4, 4, 6, 1, 14, 199, 109, 198, 108, 196, 106, 195, 121 };
|
||||
/* # */ static const uint8_t glyph_35[] = { 10, 13, 11, 1, 13, 0, 2, 241, 9, 176, 0, 5, 224, 12, 128, 0, 8, 176, 14, 80, 0, 11, 128, 31, 32, 79, 255, 255, 255, 253, 3, 79, 83, 172, 51, 0, 79, 0, 184, 0, 0, 139, 0, 229, 0, 255, 255, 255, 255, 243, 51, 247, 55, 227, 48, 1, 242, 8, 176, 0, 4, 240, 11, 128, 0, 7, 192, 14, 80, 0 };
|
||||
/* $ */ static const uint8_t glyph_36[] = { 10, 17, 10, 0, 15, 0, 0, 93, 0, 0, 0, 0, 110, 0, 0, 0, 26, 255, 197, 0, 0, 238, 135, 223, 64, 6, 244, 0, 14, 192, 8, 241, 0, 10, 240, 5, 247, 0, 0, 16, 0, 207, 164, 0, 0, 0, 25, 255, 213, 0, 0, 0, 22, 223, 112, 0, 0, 0, 13, 240, 14, 144, 0, 8, 241, 12, 224, 0, 11, 240, 4, 253, 118, 191, 128, 0, 76, 255, 214, 0, 0, 0, 140, 0, 0, 0, 0, 88, 0, 0 };
|
||||
/* % */ static const uint8_t glyph_37[] = { 13, 13, 13, 0, 13, 2, 207, 194, 0, 0, 0, 0, 201, 24, 208, 1, 192, 0, 15, 32, 31, 16, 170, 0, 0, 242, 1, 241, 79, 16, 0, 12, 145, 141, 13, 96, 0, 0, 43, 252, 55, 208, 0, 0, 0, 0, 1, 243, 0, 0, 0, 0, 0, 170, 10, 253, 80, 0, 0, 78, 24, 194, 95, 32, 0, 13, 96, 198, 0, 213, 0, 7, 192, 12, 96, 13, 80, 0, 163, 0, 140, 37, 242, 0, 0, 0, 0, 175, 213, 0 };
|
||||
/* & */ static const uint8_t glyph_38[] = { 12, 13, 11, 0, 13, 0, 9, 239, 177, 0, 0, 0, 175, 134, 237, 0, 0, 0, 250, 0, 111, 16, 0, 0, 250, 0, 159, 0, 0, 0, 175, 56, 247, 0, 0, 0, 30, 255, 80, 0, 0, 0, 95, 252, 0, 0, 0, 5, 250, 95, 160, 47, 80, 14, 192, 7, 247, 79, 48, 31, 128, 0, 175, 222, 0, 14, 192, 0, 13, 247, 0, 6, 252, 102, 191, 254, 16, 0, 76, 239, 198, 63, 176 };
|
||||
/* ' */ static const uint8_t glyph_39[] = { 3, 4, 3, 0, 14, 31, 49, 242, 31, 33, 241 };
|
||||
/* ( */ static const uint8_t glyph_40[] = { 5, 18, 6, 1, 14, 0, 4, 128, 4, 246, 1, 232, 0, 158, 0, 15, 128, 5, 243, 0, 159, 0, 11, 224, 0, 204, 0, 12, 208, 0, 189, 0, 9, 240, 0, 95, 48, 0, 248, 0, 9, 224, 0, 30, 112, 0, 79, 64, 0, 73 };
|
||||
/* ) */ static const uint8_t glyph_41[] = { 5, 18, 6, 0, 14, 118, 0, 3, 230, 0, 5, 242, 0, 12, 176, 0, 111, 32, 1, 247, 0, 14, 176, 0, 190, 0, 10, 240, 0, 175, 0, 12, 224, 0, 219, 0, 31, 128, 6, 242, 0, 203, 0, 79, 32, 46, 96, 7, 96, 0 };
|
||||
/* * */ static const uint8_t glyph_42[] = { 8, 8, 8, 0, 13, 0, 12, 128, 0, 0, 11, 128, 0, 87, 27, 130, 130, 143, 254, 239, 244, 1, 143, 244, 0, 0, 218, 232, 0, 9, 225, 95, 64, 2, 64, 6, 0 };
|
||||
/* + */ static const uint8_t glyph_43[] = { 10, 10, 10, 0, 11, 0, 0, 138, 0, 0, 0, 0, 206, 0, 0, 0, 0, 206, 0, 0, 0, 0, 206, 0, 0, 95, 255, 255, 255, 247, 40, 136, 239, 136, 131, 0, 0, 206, 0, 0, 0, 0, 206, 0, 0, 0, 0, 206, 0, 0, 0, 0, 104, 0, 0 };
|
||||
/* , */ static const uint8_t glyph_44[] = { 3, 5, 4, 0, 2, 13, 160, 235, 15, 133, 243, 105, 0 };
|
||||
/* - */ static const uint8_t glyph_45[] = { 5, 2, 5, 0, 6, 175, 255, 147, 85, 83 };
|
||||
/* . */ static const uint8_t glyph_46[] = { 3, 2, 5, 1, 2, 125, 24, 226 };
|
||||
/* / */ static const uint8_t glyph_47[] = { 7, 14, 7, 0, 13, 0, 0, 11, 176, 0, 1, 245, 0, 0, 126, 0, 0, 13, 128, 0, 3, 242, 0, 0, 156, 0, 0, 15, 96, 0, 5, 241, 0, 0, 186, 0, 0, 47, 64, 0, 8, 224, 0, 0, 232, 0, 0, 79, 32, 0, 10, 192, 0, 0 };
|
||||
/* 0 */ static const uint8_t glyph_48[] = { 9, 13, 10, 1, 13, 3, 191, 252, 64, 1, 254, 119, 223, 48, 143, 32, 1, 250, 12, 208, 0, 11, 224, 251, 0, 0, 159, 15, 160, 0, 8, 241, 250, 0, 0, 143, 31, 160, 0, 8, 241, 234, 0, 0, 159, 12, 192, 0, 11, 224, 143, 32, 1, 250, 1, 238, 118, 223, 32, 2, 191, 252, 48, 0 };
|
||||
/* 1 */ static const uint8_t glyph_49[] = { 6, 13, 10, 1, 13, 0, 4, 182, 6, 223, 246, 143, 183, 246, 49, 3, 246, 0, 3, 246, 0, 3, 246, 0, 3, 246, 0, 3, 246, 0, 3, 246, 0, 3, 246, 0, 3, 246, 0, 3, 246, 0, 3, 246 };
|
||||
/* 2 */ static const uint8_t glyph_50[] = { 10, 13, 10, 0, 13, 0, 76, 254, 179, 0, 6, 252, 102, 223, 64, 14, 208, 0, 31, 176, 47, 112, 0, 13, 208, 0, 0, 0, 14, 160, 0, 0, 0, 111, 48, 0, 0, 3, 249, 0, 0, 0, 46, 192, 0, 0, 1, 221, 16, 0, 0, 12, 226, 0, 0, 0, 190, 32, 0, 0, 10, 248, 85, 85, 82, 15, 255, 255, 255, 247 };
|
||||
/* 3 */ static const uint8_t glyph_51[] = { 9, 13, 10, 0, 13, 0, 76, 254, 178, 0, 95, 198, 125, 242, 14, 208, 0, 47, 144, 133, 0, 0, 235, 0, 0, 0, 31, 144, 0, 0, 43, 242, 0, 9, 255, 243, 0, 0, 53, 125, 227, 0, 0, 0, 14, 177, 132, 0, 0, 190, 15, 192, 0, 14, 192, 127, 182, 108, 244, 0, 92, 254, 179, 0 };
|
||||
/* 4 */ static const uint8_t glyph_52[] = { 10, 13, 10, 0, 13, 0, 0, 2, 254, 0, 0, 0, 11, 254, 0, 0, 0, 95, 222, 0, 0, 0, 233, 190, 0, 0, 8, 225, 190, 0, 0, 47, 96, 190, 0, 0, 204, 0, 190, 0, 6, 243, 0, 190, 0, 30, 144, 0, 190, 0, 127, 255, 255, 255, 251, 37, 85, 85, 207, 83, 0, 0, 0, 190, 0, 0, 0, 0, 190, 0 };
|
||||
/* 5 */ static const uint8_t glyph_53[] = { 9, 13, 10, 1, 13, 9, 255, 255, 255, 0, 190, 136, 136, 128, 12, 176, 0, 0, 0, 233, 0, 0, 0, 15, 205, 254, 112, 2, 254, 136, 223, 128, 2, 16, 0, 223, 16, 0, 0, 6, 244, 0, 0, 0, 79, 85, 128, 0, 5, 244, 111, 64, 0, 191, 16, 222, 118, 175, 128, 1, 157, 253, 112, 0 };
|
||||
/* 6 */ static const uint8_t glyph_54[] = { 9, 13, 10, 1, 13, 0, 7, 206, 96, 0, 29, 250, 114, 0, 11, 226, 0, 0, 3, 245, 0, 0, 0, 143, 109, 253, 96, 11, 255, 134, 207, 96, 207, 48, 0, 222, 13, 208, 0, 7, 241, 205, 0, 0, 111, 58, 240, 0, 7, 242, 95, 112, 0, 222, 0, 191, 134, 207, 80, 0, 142, 252, 80, 0 };
|
||||
/* 7 */ static const uint8_t glyph_55[] = { 10, 13, 10, 0, 13, 95, 255, 255, 255, 245, 21, 85, 85, 91, 241, 0, 0, 0, 14, 160, 0, 0, 0, 95, 48, 0, 0, 0, 220, 0, 0, 0, 4, 245, 0, 0, 0, 11, 208, 0, 0, 0, 47, 112, 0, 0, 0, 175, 0, 0, 0, 1, 249, 0, 0, 0, 8, 242, 0, 0, 0, 15, 176, 0, 0, 0, 127, 64, 0, 0 };
|
||||
/* 8 */ static const uint8_t glyph_56[] = { 10, 13, 10, 0, 13, 0, 42, 238, 179, 0, 2, 254, 118, 223, 48, 8, 243, 0, 47, 160, 11, 240, 0, 13, 192, 9, 241, 0, 14, 176, 2, 250, 17, 159, 48, 0, 79, 255, 246, 0, 2, 236, 102, 206, 48, 12, 208, 0, 12, 208, 15, 160, 0, 8, 241, 14, 208, 0, 12, 240, 6, 252, 102, 191, 128, 0, 76, 238, 197, 0 };
|
||||
/* 9 */ static const uint8_t glyph_57[] = { 9, 13, 10, 0, 13, 0, 60, 254, 145, 0, 63, 215, 143, 208, 11, 225, 0, 111, 96, 249, 0, 0, 235, 31, 128, 0, 12, 224, 249, 0, 0, 190, 12, 225, 0, 47, 224, 79, 214, 126, 237, 0, 93, 253, 77, 160, 0, 0, 2, 246, 0, 0, 1, 190, 0, 1, 121, 254, 48, 0, 95, 216, 16, 0 };
|
||||
/* : */ static const uint8_t glyph_58[] = { 3, 10, 4, 1, 10, 142, 40, 209, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125, 24, 226 };
|
||||
/* ; */ static const uint8_t glyph_59[] = { 4, 13, 4, 0, 10, 8, 226, 8, 209, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 160, 14, 176, 15, 128, 95, 48, 105, 0 };
|
||||
/* < */ static const uint8_t glyph_60[] = { 8, 8, 9, 0, 10, 0, 0, 0, 106, 0, 0, 126, 251, 1, 142, 251, 64, 79, 232, 32, 0, 79, 232, 16, 0, 1, 142, 250, 64, 0, 0, 126, 251, 0, 0, 0, 106 };
|
||||
/* = */ static const uint8_t glyph_61[] = { 8, 6, 10, 1, 9, 175, 255, 255, 250, 70, 102, 102, 100, 0, 0, 0, 0, 0, 0, 0, 0, 175, 255, 255, 250, 70, 102, 102, 100 };
|
||||
/* > */ static const uint8_t glyph_62[] = { 8, 8, 9, 1, 10, 166, 0, 0, 0, 191, 232, 16, 0, 3, 159, 250, 32, 0, 0, 108, 248, 0, 1, 109, 248, 3, 175, 249, 32, 191, 232, 16, 0, 166, 0, 0, 0 };
|
||||
/* ? */ static const uint8_t glyph_63[] = { 8, 13, 9, 0, 13, 1, 158, 252, 80, 12, 249, 124, 244, 63, 112, 1, 250, 2, 0, 0, 235, 0, 0, 2, 248, 0, 0, 29, 225, 0, 0, 223, 48, 0, 8, 244, 0, 0, 12, 224, 0, 0, 4, 48, 0, 0, 0, 0, 0, 0, 9, 160, 0, 0, 11, 208, 0 };
|
||||
/* @ */ static const uint8_t glyph_64[] = { 16, 17, 16, 0, 13, 0, 0, 4, 190, 254, 181, 0, 0, 0, 0, 175, 132, 35, 125, 193, 0, 0, 12, 193, 0, 0, 0, 156, 0, 0, 126, 0, 0, 0, 0, 12, 96, 0, 244, 0, 26, 253, 128, 5, 192, 6, 224, 0, 219, 37, 242, 0, 240, 10, 144, 7, 224, 3, 240, 0, 226, 13, 112, 13, 144, 5, 240, 0, 211, 15, 80, 15, 80, 6, 208, 0, 227, 14, 80, 47, 64, 8, 192, 0, 241, 13, 96, 31, 80, 12, 176, 5, 208, 11, 144, 13, 213, 173, 242, 62, 80, 6, 208, 3, 223, 144, 175, 230, 0, 1, 246, 0, 0, 0, 0, 0, 0, 0, 111, 64, 0, 0, 0, 0, 0, 0, 7, 250, 66, 36, 144, 0, 0, 0, 0, 58, 239, 236, 128, 0, 0 };
|
||||
/* A */ static const uint8_t glyph_65[] = { 12, 13, 12, 0, 13, 0, 0, 14, 224, 0, 0, 0, 0, 79, 244, 0, 0, 0, 0, 173, 218, 0, 0, 0, 1, 247, 127, 16, 0, 0, 6, 241, 47, 96, 0, 0, 12, 176, 12, 192, 0, 0, 47, 96, 6, 242, 0, 0, 143, 0, 0, 248, 0, 0, 239, 255, 255, 254, 0, 4, 248, 102, 102, 143, 64, 11, 224, 0, 0, 14, 160, 31, 144, 0, 0, 9, 241, 127, 64, 0, 0, 4, 246 };
|
||||
/* B */ static const uint8_t glyph_66[] = { 10, 13, 11, 1, 13, 143, 255, 255, 180, 0, 143, 118, 104, 239, 64, 143, 32, 0, 47, 176, 143, 32, 0, 14, 208, 143, 32, 0, 15, 176, 143, 32, 2, 191, 64, 143, 255, 255, 246, 0, 143, 117, 86, 191, 96, 143, 32, 0, 12, 240, 143, 32, 0, 8, 242, 143, 32, 0, 12, 241, 143, 118, 103, 207, 128, 143, 255, 254, 197, 0 };
|
||||
/* C */ static const uint8_t glyph_67[] = { 10, 13, 12, 1, 13, 0, 59, 239, 215, 0, 6, 253, 119, 175, 192, 47, 192, 0, 7, 246, 143, 48, 0, 0, 252, 222, 0, 0, 0, 52, 236, 0, 0, 0, 0, 252, 0, 0, 0, 0, 236, 0, 0, 0, 0, 222, 0, 0, 0, 51, 159, 48, 0, 0, 252, 47, 176, 0, 7, 246, 7, 252, 118, 175, 176, 0, 76, 255, 215, 0 };
|
||||
/* D */ static const uint8_t glyph_68[] = { 10, 13, 12, 1, 13, 143, 255, 253, 112, 0, 143, 118, 106, 253, 16, 143, 32, 0, 63, 192, 143, 32, 0, 7, 243, 143, 32, 0, 1, 248, 143, 32, 0, 0, 250, 143, 32, 0, 0, 235, 143, 32, 0, 0, 250, 143, 32, 0, 1, 248, 143, 32, 0, 7, 243, 143, 32, 0, 63, 192, 143, 118, 106, 253, 16, 143, 255, 252, 112, 0 };
|
||||
/* E */ static const uint8_t glyph_69[] = { 9, 13, 10, 1, 13, 143, 255, 255, 255, 136, 247, 102, 102, 99, 143, 32, 0, 0, 8, 242, 0, 0, 0, 143, 32, 0, 0, 8, 242, 0, 0, 0, 143, 255, 255, 251, 8, 247, 102, 102, 64, 143, 32, 0, 0, 8, 242, 0, 0, 0, 143, 32, 0, 0, 8, 247, 102, 102, 99, 143, 255, 255, 255, 144 };
|
||||
/* F */ static const uint8_t glyph_70[] = { 9, 13, 10, 1, 13, 143, 255, 255, 255, 104, 247, 102, 102, 98, 143, 32, 0, 0, 8, 242, 0, 0, 0, 143, 32, 0, 0, 8, 242, 0, 0, 0, 143, 255, 255, 248, 8, 247, 102, 102, 48, 143, 32, 0, 0, 8, 242, 0, 0, 0, 143, 32, 0, 0, 8, 242, 0, 0, 0, 143, 32, 0, 0, 0 };
|
||||
/* G */ static const uint8_t glyph_71[] = { 10, 13, 12, 1, 13, 0, 75, 239, 216, 0, 7, 253, 118, 175, 192, 47, 176, 0, 6, 247, 159, 32, 0, 0, 219, 206, 0, 0, 0, 0, 236, 0, 0, 0, 0, 236, 0, 0, 0, 0, 237, 0, 11, 255, 255, 207, 0, 4, 102, 223, 127, 64, 0, 0, 207, 31, 209, 0, 0, 207, 5, 254, 134, 123, 250, 0, 42, 239, 235, 96 };
|
||||
/* H */ static const uint8_t glyph_72[] = { 11, 13, 13, 1, 13, 143, 32, 0, 0, 111, 88, 242, 0, 0, 6, 245, 143, 32, 0, 0, 111, 88, 242, 0, 0, 6, 245, 143, 32, 0, 0, 111, 88, 242, 0, 0, 6, 245, 143, 255, 255, 255, 255, 88, 247, 102, 102, 105, 245, 143, 32, 0, 0, 111, 88, 242, 0, 0, 6, 245, 143, 32, 0, 0, 111, 88, 242, 0, 0, 6, 245, 143, 32, 0, 0, 111, 80 };
|
||||
/* I */ static const uint8_t glyph_73[] = { 3, 13, 5, 1, 13, 111, 70, 244, 111, 70, 244, 111, 70, 244, 111, 70, 244, 111, 70, 244, 111, 70, 244, 111, 64 };
|
||||
/* J */ static const uint8_t glyph_74[] = { 9, 13, 10, 0, 13, 0, 0, 0, 47, 128, 0, 0, 2, 248, 0, 0, 0, 47, 128, 0, 0, 2, 248, 0, 0, 0, 47, 128, 0, 0, 2, 248, 0, 0, 0, 47, 128, 0, 0, 2, 248, 0, 0, 0, 47, 133, 178, 0, 3, 248, 95, 112, 0, 143, 80, 223, 150, 159, 192, 1, 157, 254, 144, 0 };
|
||||
/* K */ static const uint8_t glyph_75[] = { 11, 13, 11, 1, 13, 143, 32, 0, 9, 247, 8, 242, 0, 6, 249, 0, 143, 32, 4, 251, 0, 8, 242, 2, 252, 0, 0, 143, 33, 237, 16, 0, 8, 243, 207, 32, 0, 0, 143, 205, 246, 0, 0, 8, 253, 25, 243, 0, 0, 143, 48, 13, 208, 0, 8, 242, 0, 63, 160, 0, 143, 32, 0, 143, 96, 8, 242, 0, 0, 207, 48, 143, 32, 0, 2, 253, 0 };
|
||||
/* L */ static const uint8_t glyph_76[] = { 9, 13, 10, 1, 13, 143, 48, 0, 0, 8, 243, 0, 0, 0, 143, 48, 0, 0, 8, 243, 0, 0, 0, 143, 48, 0, 0, 8, 243, 0, 0, 0, 143, 48, 0, 0, 8, 243, 0, 0, 0, 143, 48, 0, 0, 8, 243, 0, 0, 0, 143, 48, 0, 0, 8, 247, 102, 102, 97, 143, 255, 255, 255, 64 };
|
||||
/* M */ static const uint8_t glyph_77[] = { 14, 13, 16, 1, 13, 143, 208, 0, 0, 0, 47, 243, 143, 244, 0, 0, 0, 159, 243, 143, 250, 0, 0, 0, 239, 243, 143, 175, 16, 0, 5, 249, 243, 143, 79, 112, 0, 11, 214, 243, 143, 28, 208, 0, 47, 118, 243, 143, 38, 243, 0, 143, 22, 243, 143, 32, 249, 0, 234, 7, 243, 143, 32, 159, 5, 244, 7, 243, 143, 32, 63, 107, 208, 7, 243, 143, 32, 12, 223, 112, 7, 243, 143, 32, 6, 255, 16, 7, 243, 143, 32, 0, 250, 0, 7, 243 };
|
||||
/* N */ static const uint8_t glyph_78[] = { 11, 13, 13, 1, 13, 111, 160, 0, 0, 63, 118, 255, 64, 0, 3, 247, 111, 253, 0, 0, 63, 118, 250, 248, 0, 3, 247, 111, 91, 243, 0, 63, 118, 245, 31, 208, 3, 247, 111, 80, 111, 112, 63, 118, 245, 0, 207, 35, 247, 111, 80, 2, 252, 63, 118, 245, 0, 8, 250, 247, 111, 80, 0, 13, 255, 118, 245, 0, 0, 63, 247, 111, 80, 0, 0, 159, 112 };
|
||||
/* O */ static const uint8_t glyph_79[] = { 11, 13, 12, 1, 13, 0, 59, 239, 198, 0, 0, 95, 232, 123, 251, 0, 31, 192, 0, 7, 247, 8, 243, 0, 0, 12, 224, 206, 0, 0, 0, 143, 46, 192, 0, 0, 6, 244, 251, 0, 0, 0, 95, 94, 192, 0, 0, 6, 244, 206, 0, 0, 0, 143, 40, 244, 0, 0, 12, 224, 47, 192, 0, 6, 247, 0, 95, 232, 123, 251, 0, 0, 59, 239, 215, 0, 0 };
|
||||
/* P */ static const uint8_t glyph_80[] = { 10, 13, 11, 1, 13, 191, 255, 255, 198, 0, 191, 102, 103, 207, 144, 191, 0, 0, 11, 242, 191, 0, 0, 4, 246, 191, 0, 0, 3, 247, 191, 0, 0, 7, 245, 191, 0, 1, 95, 224, 191, 255, 255, 253, 32, 191, 102, 101, 48, 0, 191, 0, 0, 0, 0, 191, 0, 0, 0, 0, 191, 0, 0, 0, 0, 191, 0, 0, 0, 0 };
|
||||
/* Q */ static const uint8_t glyph_81[] = { 12, 15, 12, 0, 13, 0, 5, 207, 235, 64, 0, 0, 159, 200, 141, 247, 0, 5, 249, 0, 0, 175, 48, 12, 241, 0, 0, 31, 160, 31, 160, 0, 0, 12, 224, 47, 128, 0, 0, 10, 240, 63, 112, 0, 0, 9, 241, 47, 128, 0, 0, 10, 240, 31, 160, 0, 0, 12, 224, 12, 241, 0, 0, 31, 160, 5, 249, 0, 0, 175, 48, 0, 159, 199, 124, 247, 0, 0, 5, 207, 255, 245, 0, 0, 0, 0, 1, 207, 128, 0, 0, 0, 0, 9, 112 };
|
||||
/* R */ static const uint8_t glyph_82[] = { 10, 13, 11, 1, 13, 159, 255, 254, 180, 0, 159, 118, 103, 223, 112, 159, 32, 0, 13, 240, 159, 32, 0, 9, 242, 159, 32, 0, 11, 240, 159, 32, 1, 143, 144, 159, 255, 255, 249, 0, 159, 118, 109, 224, 0, 159, 32, 5, 247, 0, 159, 32, 0, 222, 0, 159, 32, 0, 95, 112, 159, 32, 0, 13, 241, 159, 32, 0, 5, 248 };
|
||||
/* S */ static const uint8_t glyph_83[] = { 11, 13, 11, 0, 13, 0, 24, 223, 234, 32, 0, 30, 249, 104, 239, 48, 9, 244, 0, 1, 237, 0, 191, 0, 0, 8, 224, 7, 247, 0, 0, 0, 0, 13, 252, 97, 0, 0, 0, 7, 239, 251, 48, 0, 0, 0, 56, 255, 80, 0, 0, 0, 1, 238, 1, 233, 0, 0, 9, 242, 13, 225, 0, 0, 207, 0, 63, 232, 103, 207, 112, 0, 25, 223, 235, 64, 0 };
|
||||
/* T */ static const uint8_t glyph_84[] = { 11, 13, 11, 0, 13, 159, 255, 255, 255, 255, 83, 102, 106, 248, 102, 98, 0, 0, 127, 48, 0, 0, 0, 7, 243, 0, 0, 0, 0, 127, 48, 0, 0, 0, 7, 243, 0, 0, 0, 0, 127, 48, 0, 0, 0, 7, 243, 0, 0, 0, 0, 127, 48, 0, 0, 0, 7, 243, 0, 0, 0, 0, 127, 48, 0, 0, 0, 7, 243, 0, 0, 0, 0, 127, 48, 0, 0 };
|
||||
/* U */ static const uint8_t glyph_85[] = { 10, 13, 12, 1, 13, 159, 16, 0, 0, 250, 159, 16, 0, 0, 250, 159, 16, 0, 0, 250, 159, 16, 0, 0, 250, 159, 16, 0, 0, 250, 159, 16, 0, 0, 250, 159, 16, 0, 0, 250, 159, 16, 0, 0, 250, 159, 16, 0, 0, 250, 143, 48, 0, 2, 249, 63, 160, 0, 9, 244, 10, 251, 119, 191, 160, 0, 108, 255, 198, 0 };
|
||||
/* V */ static const uint8_t glyph_86[] = { 11, 13, 11, 0, 13, 207, 0, 0, 0, 15, 214, 245, 0, 0, 5, 247, 31, 176, 0, 0, 191, 16, 191, 16, 0, 31, 176, 5, 246, 0, 6, 245, 0, 14, 176, 0, 191, 0, 0, 159, 16, 31, 160, 0, 3, 246, 6, 244, 0, 0, 13, 176, 190, 0, 0, 0, 143, 63, 128, 0, 0, 2, 253, 242, 0, 0, 0, 12, 252, 0, 0, 0, 0, 111, 112, 0, 0 };
|
||||
/* W */ static const uint8_t glyph_87[] = { 16, 13, 16, 0, 13, 95, 80, 0, 12, 224, 0, 3, 247, 31, 128, 0, 15, 243, 0, 7, 243, 14, 192, 0, 79, 247, 0, 10, 240, 10, 240, 0, 158, 172, 0, 14, 176, 6, 243, 0, 217, 111, 0, 31, 128, 2, 247, 2, 245, 47, 64, 95, 64, 0, 235, 6, 240, 13, 144, 143, 0, 0, 174, 11, 192, 9, 208, 204, 0, 0, 127, 47, 112, 4, 242, 248, 0, 0, 63, 159, 32, 0, 249, 245, 0, 0, 15, 238, 0, 0, 206, 241, 0, 0, 11, 249, 0, 0, 127, 208, 0, 0, 7, 245, 0, 0, 63, 144, 0 };
|
||||
/* X */ static const uint8_t glyph_88[] = { 11, 13, 11, 0, 13, 47, 208, 0, 0, 159, 96, 127, 112, 0, 47, 192, 0, 223, 16, 11, 242, 0, 3, 250, 5, 248, 0, 0, 9, 244, 237, 0, 0, 0, 14, 255, 64, 0, 0, 0, 143, 208, 0, 0, 0, 30, 239, 80, 0, 0, 10, 243, 222, 16, 0, 4, 249, 4, 249, 0, 0, 222, 16, 10, 243, 0, 143, 96, 0, 31, 208, 63, 192, 0, 0, 127, 112 };
|
||||
/* Y */ static const uint8_t glyph_89[] = { 11, 13, 11, 0, 13, 159, 80, 0, 0, 143, 81, 253, 0, 0, 31, 208, 8, 245, 0, 8, 244, 0, 14, 208, 1, 251, 0, 0, 127, 80, 159, 48, 0, 0, 221, 47, 160, 0, 0, 5, 253, 242, 0, 0, 0, 12, 249, 0, 0, 0, 0, 127, 48, 0, 0, 0, 7, 243, 0, 0, 0, 0, 127, 48, 0, 0, 0, 7, 243, 0, 0, 0, 0, 127, 48, 0, 0 };
|
||||
/* Z */ static const uint8_t glyph_90[] = { 11, 13, 11, 0, 13, 47, 255, 255, 255, 252, 0, 102, 102, 102, 175, 144, 0, 0, 0, 30, 224, 0, 0, 0, 10, 244, 0, 0, 0, 5, 249, 0, 0, 0, 1, 237, 0, 0, 0, 0, 191, 48, 0, 0, 0, 111, 128, 0, 0, 0, 31, 208, 0, 0, 0, 11, 243, 0, 0, 0, 6, 248, 0, 0, 0, 1, 255, 102, 102, 102, 96, 79, 255, 255, 255, 255, 16 };
|
||||
/* [ */ static const uint8_t glyph_91[] = { 4, 18, 5, 1, 15, 191, 249, 191, 83, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 190, 0, 191, 83, 191, 249 };
|
||||
/* \ */ static const uint8_t glyph_92[] = { 8, 14, 7, 0, 13, 127, 16, 0, 0, 31, 112, 0, 0, 11, 208, 0, 0, 4, 243, 0, 0, 0, 233, 0, 0, 0, 143, 0, 0, 0, 47, 96, 0, 0, 12, 192, 0, 0, 6, 242, 0, 0, 0, 248, 0, 0, 0, 174, 0, 0, 0, 79, 64, 0, 0, 13, 160, 0, 0, 7, 241 };
|
||||
/* ] */ static const uint8_t glyph_93[] = { 4, 18, 5, 0, 15, 239, 246, 87, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 3, 246, 87, 246, 239, 246 };
|
||||
/* ^ */ static const uint8_t glyph_94[] = { 8, 6, 8, 0, 13, 0, 12, 192, 0, 0, 63, 243, 0, 0, 173, 218, 0, 1, 246, 111, 16, 8, 224, 15, 128, 15, 128, 9, 224 };
|
||||
/* _ */ static const uint8_t glyph_95[] = { 9, 2, 8, 0, 0, 255, 255, 255, 255, 21, 85, 85, 85, 80 };
|
||||
/* ` */ static const uint8_t glyph_96[] = { 5, 3, 6, 0, 14, 47, 192, 0, 95, 112, 0, 155, 0 };
|
||||
/* a */ static const uint8_t glyph_97[] = { 8, 10, 10, 1, 10, 3, 191, 235, 48, 63, 198, 109, 225, 157, 0, 3, 246, 0, 0, 1, 248, 5, 190, 255, 249, 127, 164, 35, 249, 220, 0, 1, 249, 237, 0, 5, 249, 143, 183, 175, 249, 8, 239, 195, 236 };
|
||||
/* b */ static const uint8_t glyph_98[] = { 9, 14, 10, 1, 14, 221, 0, 0, 0, 13, 208, 0, 0, 0, 221, 0, 0, 0, 13, 208, 0, 0, 0, 221, 109, 253, 80, 13, 254, 119, 223, 64, 223, 16, 0, 236, 13, 208, 0, 9, 240, 221, 0, 0, 127, 45, 208, 0, 7, 242, 221, 0, 0, 159, 13, 242, 0, 30, 192, 223, 231, 125, 244, 13, 182, 223, 213, 0 };
|
||||
/* c */ static const uint8_t glyph_99[] = { 9, 10, 9, 0, 10, 0, 76, 254, 145, 0, 95, 198, 126, 208, 14, 192, 0, 79, 100, 246, 0, 0, 116, 111, 64, 0, 0, 6, 244, 0, 0, 0, 79, 96, 0, 2, 16, 236, 0, 2, 247, 6, 251, 103, 237, 0, 5, 207, 233, 16 };
|
||||
/* d */ static const uint8_t glyph_100[] = { 9, 14, 10, 0, 14, 0, 0, 0, 13, 192, 0, 0, 0, 220, 0, 0, 0, 13, 192, 0, 0, 0, 220, 0, 93, 253, 109, 192, 79, 215, 126, 252, 13, 225, 0, 31, 193, 249, 0, 0, 220, 63, 112, 0, 13, 195, 246, 0, 0, 220, 31, 144, 0, 13, 192, 206, 16, 1, 252, 4, 253, 119, 239, 192, 4, 223, 214, 204 };
|
||||
/* e */ static const uint8_t glyph_101[] = { 9, 10, 10, 1, 10, 0, 142, 252, 64, 0, 207, 134, 207, 64, 111, 64, 0, 220, 11, 224, 0, 8, 240, 239, 255, 255, 255, 46, 213, 85, 85, 80, 206, 0, 0, 0, 7, 246, 0, 3, 64, 13, 249, 88, 251, 0, 25, 239, 216, 0 };
|
||||
/* f */ static const uint8_t glyph_102[] = { 7, 14, 6, 0, 14, 0, 26, 238, 16, 11, 248, 96, 0, 250, 0, 0, 31, 128, 0, 159, 255, 248, 2, 95, 164, 32, 1, 248, 0, 0, 31, 128, 0, 1, 248, 0, 0, 31, 128, 0, 1, 248, 0, 0, 31, 128, 0, 1, 248, 0, 0, 31, 128, 0 };
|
||||
/* g */ static const uint8_t glyph_103[] = { 9, 14, 10, 0, 10, 0, 77, 253, 107, 208, 79, 215, 125, 253, 12, 241, 0, 30, 209, 250, 0, 0, 205, 47, 112, 0, 12, 210, 247, 0, 0, 205, 15, 144, 0, 12, 208, 207, 16, 1, 237, 4, 253, 119, 223, 208, 4, 223, 214, 205, 0, 0, 0, 14, 192, 55, 0, 3, 248, 6, 250, 87, 238, 16, 5, 207, 234, 32 };
|
||||
/* h */ static const uint8_t glyph_104[] = { 8, 14, 10, 1, 14, 190, 0, 0, 0, 190, 0, 0, 0, 190, 0, 0, 0, 190, 0, 0, 0, 190, 60, 253, 112, 191, 232, 108, 244, 191, 48, 1, 249, 190, 0, 0, 235, 190, 0, 0, 236, 190, 0, 0, 236, 190, 0, 0, 236, 190, 0, 0, 236, 190, 0, 0, 236, 190, 0, 0, 236 };
|
||||
/* i */ static const uint8_t glyph_105[] = { 3, 14, 4, 1, 14, 155, 11, 208, 0, 0, 0, 205, 12, 208, 205, 12, 208, 205, 12, 208, 205, 12, 208, 205, 12, 208 };
|
||||
/* j */ static const uint8_t glyph_106[] = { 4, 18, 4, -1, 14, 0, 169, 0, 219, 0, 0, 0, 0, 0, 220, 0, 220, 0, 220, 0, 220, 0, 220, 0, 220, 0, 220, 0, 220, 0, 220, 0, 220, 0, 220, 0, 235, 72, 248, 175, 177 };
|
||||
/* k */ static const uint8_t glyph_107[] = { 9, 14, 9, 1, 14, 205, 0, 0, 0, 12, 208, 0, 0, 0, 205, 0, 0, 0, 12, 208, 0, 0, 0, 205, 0, 11, 244, 12, 208, 9, 245, 0, 205, 6, 247, 0, 12, 212, 249, 0, 0, 206, 239, 48, 0, 12, 247, 205, 0, 0, 206, 2, 249, 0, 12, 208, 7, 245, 0, 205, 0, 12, 225, 12, 208, 0, 47, 176 };
|
||||
/* l */ static const uint8_t glyph_108[] = { 2, 14, 4, 1, 14, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 };
|
||||
/* m */ static const uint8_t glyph_109[] = { 14, 10, 16, 1, 10, 174, 76, 254, 112, 109, 253, 80, 175, 231, 108, 251, 231, 125, 243, 175, 32, 1, 255, 32, 2, 248, 175, 0, 0, 221, 0, 0, 250, 175, 0, 0, 221, 0, 0, 250, 175, 0, 0, 221, 0, 0, 250, 175, 0, 0, 221, 0, 0, 250, 175, 0, 0, 221, 0, 0, 250, 175, 0, 0, 221, 0, 0, 250, 175, 0, 0, 221, 0, 0, 250 };
|
||||
/* n */ static const uint8_t glyph_110[] = { 8, 10, 10, 1, 10, 189, 60, 253, 112, 191, 232, 108, 244, 191, 48, 1, 249, 190, 0, 0, 235, 190, 0, 0, 236, 190, 0, 0, 236, 190, 0, 0, 236, 190, 0, 0, 236, 190, 0, 0, 236, 190, 0, 0, 236 };
|
||||
/* o */ static const uint8_t glyph_111[] = { 10, 10, 10, 0, 10, 0, 59, 255, 179, 0, 3, 253, 119, 223, 48, 13, 225, 0, 30, 192, 47, 128, 0, 8, 242, 79, 80, 0, 5, 244, 79, 80, 0, 6, 244, 47, 128, 0, 8, 242, 13, 224, 0, 30, 192, 3, 253, 103, 223, 48, 0, 59, 254, 179, 0 };
|
||||
/* p */ static const uint8_t glyph_112[] = { 9, 14, 10, 1, 10, 218, 109, 253, 80, 13, 253, 119, 239, 64, 222, 16, 1, 252, 13, 192, 0, 9, 241, 220, 0, 0, 127, 45, 192, 0, 7, 242, 220, 0, 0, 159, 13, 224, 0, 31, 192, 223, 214, 109, 244, 13, 199, 223, 213, 0, 220, 0, 0, 0, 13, 192, 0, 0, 0, 220, 0, 0, 0, 13, 192, 0, 0, 0 };
|
||||
/* q */ static const uint8_t glyph_113[] = { 9, 14, 10, 0, 10, 0, 93, 253, 108, 176, 95, 215, 125, 251, 13, 225, 0, 31, 178, 249, 0, 0, 235, 79, 96, 0, 14, 180, 246, 0, 0, 235, 47, 128, 0, 14, 176, 222, 0, 1, 251, 5, 253, 102, 223, 176, 5, 223, 214, 235, 0, 0, 0, 14, 176, 0, 0, 0, 235, 0, 0, 0, 14, 176, 0, 0, 0, 235 };
|
||||
/* r */ static const uint8_t glyph_114[] = { 5, 10, 6, 1, 10, 220, 126, 189, 255, 167, 223, 32, 13, 208, 0, 221, 0, 13, 208, 0, 221, 0, 13, 208, 0, 221, 0, 13, 208, 0 };
|
||||
/* s */ static const uint8_t glyph_115[] = { 9, 10, 9, 0, 10, 0, 125, 253, 128, 0, 143, 150, 159, 176, 14, 176, 0, 159, 16, 222, 32, 0, 0, 4, 239, 200, 32, 0, 0, 89, 239, 128, 1, 0, 0, 191, 35, 248, 0, 7, 243, 11, 248, 87, 253, 0, 8, 223, 233, 16 };
|
||||
/* t */ static const uint8_t glyph_116[] = { 6, 12, 6, 0, 12, 2, 248, 0, 2, 248, 0, 223, 255, 244, 53, 250, 65, 2, 248, 0, 2, 248, 0, 2, 248, 0, 2, 248, 0, 2, 248, 0, 1, 248, 0, 0, 237, 98, 0, 94, 244 };
|
||||
/* u */ static const uint8_t glyph_117[] = { 8, 10, 10, 1, 10, 205, 0, 0, 235, 205, 0, 0, 235, 205, 0, 0, 235, 205, 0, 0, 235, 205, 0, 0, 235, 205, 0, 0, 235, 190, 0, 0, 235, 175, 16, 2, 251, 79, 198, 142, 251, 6, 223, 214, 219 };
|
||||
/* v */ static const uint8_t glyph_118[] = { 9, 10, 9, 0, 10, 111, 48, 0, 79, 81, 249, 0, 9, 240, 11, 224, 0, 234, 0, 95, 48, 63, 80, 0, 248, 8, 240, 0, 10, 208, 218, 0, 0, 95, 79, 64, 0, 0, 253, 240, 0, 0, 10, 249, 0, 0, 0, 79, 64, 0 };
|
||||
/* w */ static const uint8_t glyph_119[] = { 14, 10, 14, 0, 10, 79, 80, 0, 220, 0, 6, 243, 15, 144, 2, 255, 16, 10, 224, 11, 208, 6, 239, 80, 14, 160, 6, 241, 11, 155, 160, 31, 80, 2, 245, 15, 86, 240, 95, 16, 0, 217, 79, 2, 244, 157, 0, 0, 157, 155, 0, 216, 216, 0, 0, 95, 230, 0, 142, 244, 0, 0, 15, 242, 0, 63, 240, 0, 0, 12, 208, 0, 14, 176, 0 };
|
||||
/* x */ static const uint8_t glyph_120[] = { 9, 10, 9, 0, 10, 63, 160, 0, 207, 32, 159, 48, 95, 112, 1, 236, 14, 208, 0, 5, 252, 243, 0, 0, 11, 249, 0, 0, 0, 207, 160, 0, 0, 111, 175, 64, 0, 31, 176, 206, 0, 11, 242, 3, 249, 5, 248, 0, 10, 243 };
|
||||
/* y */ static const uint8_t glyph_121[] = { 9, 14, 9, 0, 10, 111, 96, 0, 95, 97, 251, 0, 10, 241, 11, 240, 0, 235, 0, 95, 80, 63, 96, 0, 250, 8, 241, 0, 10, 240, 219, 0, 0, 79, 111, 96, 0, 0, 238, 241, 0, 0, 9, 251, 0, 0, 0, 79, 96, 0, 0, 6, 241, 0, 0, 0, 203, 0, 0, 7, 191, 48, 0, 0, 254, 96, 0, 0 };
|
||||
/* z */ static const uint8_t glyph_122[] = { 9, 10, 9, 0, 10, 47, 255, 255, 255, 16, 85, 85, 127, 192, 0, 0, 12, 242, 0, 0, 8, 246, 0, 0, 3, 251, 0, 0, 0, 222, 16, 0, 0, 159, 64, 0, 0, 79, 144, 0, 0, 30, 245, 85, 85, 19, 255, 255, 255, 245 };
|
||||
/* { */ static const uint8_t glyph_123[] = { 6, 17, 6, 0, 14, 0, 0, 138, 0, 12, 227, 0, 95, 64, 0, 143, 16, 0, 159, 0, 0, 159, 0, 0, 191, 0, 4, 250, 0, 127, 208, 0, 40, 247, 0, 0, 206, 0, 0, 159, 0, 0, 159, 0, 0, 143, 0, 0, 95, 64, 0, 13, 210, 0, 0, 154 };
|
||||
/* | */ static const uint8_t glyph_124[] = { 2, 15, 4, 1, 13, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125 };
|
||||
/* } */ static const uint8_t glyph_125[] = { 6, 17, 6, 0, 14, 168, 0, 0, 62, 176, 0, 5, 244, 0, 1, 248, 0, 0, 249, 0, 0, 249, 0, 0, 250, 0, 0, 175, 64, 0, 12, 247, 0, 127, 130, 0, 235, 0, 0, 249, 0, 0, 249, 0, 1, 248, 0, 5, 245, 0, 45, 192, 0, 168, 0, 0 };
|
||||
/* ~ */ static const uint8_t glyph_126[] = { 10, 4, 12, 1, 7, 9, 238, 128, 0, 91, 143, 137, 252, 33, 203, 216, 0, 78, 255, 226, 32, 0, 0, 85, 16 };
|
||||
|
||||
const uint8_t * const Font_Roboto_Regular_18[126 + 1 - 32] = {
|
||||
glyph_32,
|
||||
glyph_33,
|
||||
glyph_34,
|
||||
glyph_35,
|
||||
glyph_36,
|
||||
glyph_37,
|
||||
glyph_38,
|
||||
glyph_39,
|
||||
glyph_40,
|
||||
glyph_41,
|
||||
glyph_42,
|
||||
glyph_43,
|
||||
glyph_44,
|
||||
glyph_45,
|
||||
glyph_46,
|
||||
glyph_47,
|
||||
glyph_48,
|
||||
glyph_49,
|
||||
glyph_50,
|
||||
glyph_51,
|
||||
glyph_52,
|
||||
glyph_53,
|
||||
glyph_54,
|
||||
glyph_55,
|
||||
glyph_56,
|
||||
glyph_57,
|
||||
glyph_58,
|
||||
glyph_59,
|
||||
glyph_60,
|
||||
glyph_61,
|
||||
glyph_62,
|
||||
glyph_63,
|
||||
glyph_64,
|
||||
glyph_65,
|
||||
glyph_66,
|
||||
glyph_67,
|
||||
glyph_68,
|
||||
glyph_69,
|
||||
glyph_70,
|
||||
glyph_71,
|
||||
glyph_72,
|
||||
glyph_73,
|
||||
glyph_74,
|
||||
glyph_75,
|
||||
glyph_76,
|
||||
glyph_77,
|
||||
glyph_78,
|
||||
glyph_79,
|
||||
glyph_80,
|
||||
glyph_81,
|
||||
glyph_82,
|
||||
glyph_83,
|
||||
glyph_84,
|
||||
glyph_85,
|
||||
glyph_86,
|
||||
glyph_87,
|
||||
glyph_88,
|
||||
glyph_89,
|
||||
glyph_90,
|
||||
glyph_91,
|
||||
glyph_92,
|
||||
glyph_93,
|
||||
glyph_94,
|
||||
glyph_95,
|
||||
glyph_96,
|
||||
glyph_97,
|
||||
glyph_98,
|
||||
glyph_99,
|
||||
glyph_100,
|
||||
glyph_101,
|
||||
glyph_102,
|
||||
glyph_103,
|
||||
glyph_104,
|
||||
glyph_105,
|
||||
glyph_106,
|
||||
glyph_107,
|
||||
glyph_108,
|
||||
glyph_109,
|
||||
glyph_110,
|
||||
glyph_111,
|
||||
glyph_112,
|
||||
glyph_113,
|
||||
glyph_114,
|
||||
glyph_115,
|
||||
glyph_116,
|
||||
glyph_117,
|
||||
glyph_118,
|
||||
glyph_119,
|
||||
glyph_120,
|
||||
glyph_121,
|
||||
glyph_122,
|
||||
glyph_123,
|
||||
glyph_124,
|
||||
glyph_125,
|
||||
glyph_126,
|
||||
};
|
442
extmod/modTrezorUi/modTrezorUi-inflate.h
Normal file
442
extmod/modTrezorUi/modTrezorUi-inflate.h
Normal file
@ -0,0 +1,442 @@
|
||||
/*
|
||||
* stream_inflate - tiny inflate library with output streaming
|
||||
*
|
||||
* Copyright (c) 2003 by Joergen Ibsen / Jibz
|
||||
* All Rights Reserved
|
||||
* http://www.ibsensoftware.com/
|
||||
*
|
||||
* Copyright (c) 2014 by Paul Sokolovsky
|
||||
*
|
||||
* Copyright (c) 2016 by Pavol Rusnak
|
||||
*
|
||||
* This software is provided 'as-is', without any express
|
||||
* or implied warranty. In no event will the authors be
|
||||
* held liable for any damages arising from the use of
|
||||
* this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software
|
||||
* for any purpose, including commercial applications,
|
||||
* and to alter it and redistribute it freely, subject to
|
||||
* the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be
|
||||
* misrepresented; you must not claim that you
|
||||
* wrote the original software. If you use this
|
||||
* software in a product, an acknowledgment in
|
||||
* the product documentation would be appreciated
|
||||
* but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked
|
||||
* as such, and must not be misrepresented as
|
||||
* being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from
|
||||
* any source distribution.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef SINF_WRITE
|
||||
#error Must define SINF_WRITE(byte) macro
|
||||
#endif
|
||||
|
||||
// maximum possible window size (in bits) used during compression/deflate
|
||||
#define SINF_WBITS 10
|
||||
|
||||
#define SINF_OK 0
|
||||
#define SINF_ERROR (-3)
|
||||
|
||||
typedef struct {
|
||||
uint16_t table[16]; /* table of code length counts */
|
||||
uint16_t trans[288]; /* code -> symbol translation table */
|
||||
} SINF_TREE;
|
||||
|
||||
typedef struct {
|
||||
const uint8_t *source;
|
||||
uint32_t tag;
|
||||
uint32_t bitcount;
|
||||
uint8_t cbuf[1 << SINF_WBITS];
|
||||
int cbufi;
|
||||
SINF_TREE ltree; /* dynamic length/symbol tree */
|
||||
SINF_TREE dtree; /* dynamic distance tree */
|
||||
} SINF_DATA;
|
||||
|
||||
/* --------------------------------------------------- *
|
||||
* -- uninitialized global data (static structures) -- *
|
||||
* --------------------------------------------------- */
|
||||
|
||||
const uint8_t SINF_LENGTH_BITS[30] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 4, 4, 4, 4,
|
||||
5, 5, 5, 5
|
||||
};
|
||||
const uint16_t SINF_LENGTH_BASE[30] = {
|
||||
3, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 13, 15, 17, 19, 23, 27, 31,
|
||||
35, 43, 51, 59, 67, 83, 99, 115,
|
||||
131, 163, 195, 227, 258
|
||||
};
|
||||
|
||||
const uint8_t SINF_DIST_BITS[30] = {
|
||||
0, 0, 0, 0, 1, 1, 2, 2,
|
||||
3, 3, 4, 4, 5, 5, 6, 6,
|
||||
7, 7, 8, 8, 9, 9, 10, 10,
|
||||
11, 11, 12, 12, 13, 13
|
||||
};
|
||||
const uint16_t SINF_DIST_BASE[30] = {
|
||||
1, 2, 3, 4, 5, 7, 9, 13,
|
||||
17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
||||
4097, 6145, 8193, 12289, 16385, 24577
|
||||
};
|
||||
|
||||
/* special ordering of code length codes */
|
||||
const uint8_t SINF_CLCIDX[] = {
|
||||
16, 17, 18, 0, 8, 7, 9, 6,
|
||||
10, 5, 11, 4, 12, 3, 13, 2,
|
||||
14, 1, 15
|
||||
};
|
||||
|
||||
/* ----------------------- *
|
||||
* -- utility functions -- *
|
||||
* ----------------------- */
|
||||
|
||||
static void sinf_write(SINF_DATA *d, uint8_t byte)
|
||||
{
|
||||
d->cbuf[d->cbufi] = byte;
|
||||
d->cbufi = (d->cbufi + 1) % (1 << SINF_WBITS);
|
||||
SINF_WRITE(byte);
|
||||
}
|
||||
|
||||
/* build the fixed huffman trees */
|
||||
static void sinf_build_fixed_trees(SINF_TREE *lt, SINF_TREE *dt)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* build fixed length tree */
|
||||
for (i = 0; i < 7; ++i) lt->table[i] = 0;
|
||||
|
||||
lt->table[7] = 24;
|
||||
lt->table[8] = 152;
|
||||
lt->table[9] = 112;
|
||||
|
||||
for (i = 0; i < 24; ++i) lt->trans[i] = 256 + i;
|
||||
for (i = 0; i < 144; ++i) lt->trans[24 + i] = i;
|
||||
for (i = 0; i < 8; ++i) lt->trans[24 + 144 + i] = 280 + i;
|
||||
for (i = 0; i < 112; ++i) lt->trans[24 + 144 + 8 + i] = 144 + i;
|
||||
|
||||
/* build fixed distance tree */
|
||||
for (i = 0; i < 5; ++i) dt->table[i] = 0;
|
||||
|
||||
dt->table[5] = 32;
|
||||
|
||||
for (i = 0; i < 32; ++i) dt->trans[i] = i;
|
||||
}
|
||||
|
||||
/* given an array of code lengths, build a tree */
|
||||
static void sinf_build_tree(SINF_TREE *t, const uint8_t *lengths, uint32_t num)
|
||||
{
|
||||
uint16_t offs[16];
|
||||
uint32_t i, sum;
|
||||
|
||||
/* clear code length count table */
|
||||
for (i = 0; i < 16; ++i) t->table[i] = 0;
|
||||
|
||||
/* scan symbol lengths, and sum code length counts */
|
||||
for (i = 0; i < num; ++i) t->table[lengths[i]]++;
|
||||
|
||||
t->table[0] = 0;
|
||||
|
||||
/* compute offset table for distribution sort */
|
||||
for (sum = 0, i = 0; i < 16; ++i)
|
||||
{
|
||||
offs[i] = sum;
|
||||
sum += t->table[i];
|
||||
}
|
||||
|
||||
/* create code->symbol translation table (symbols sorted by code) */
|
||||
for (i = 0; i < num; ++i)
|
||||
{
|
||||
if (lengths[i]) t->trans[offs[lengths[i]]++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------- *
|
||||
* -- decode functions -- *
|
||||
* ---------------------- */
|
||||
|
||||
/* get one bit from source stream */
|
||||
static int sinf_getbit(SINF_DATA *d)
|
||||
{
|
||||
uint32_t bit;
|
||||
|
||||
/* check if tag is empty */
|
||||
if (!d->bitcount--)
|
||||
{
|
||||
/* load next tag */
|
||||
d->tag = *d->source++;
|
||||
d->bitcount = 7;
|
||||
}
|
||||
|
||||
/* shift bit out of tag */
|
||||
bit = d->tag & 0x01;
|
||||
d->tag >>= 1;
|
||||
|
||||
return bit;
|
||||
}
|
||||
|
||||
/* read a num bit value from a stream and add base */
|
||||
static uint32_t sinf_read_bits(SINF_DATA *d, int num, int base)
|
||||
{
|
||||
uint32_t val = 0;
|
||||
|
||||
/* read num bits */
|
||||
if (num)
|
||||
{
|
||||
uint32_t limit = 1 << (num);
|
||||
uint32_t mask;
|
||||
|
||||
for (mask = 1; mask < limit; mask *= 2)
|
||||
if (sinf_getbit(d)) val += mask;
|
||||
}
|
||||
|
||||
return val + base;
|
||||
}
|
||||
|
||||
/* given a data stream and a tree, decode a symbol */
|
||||
static int sinf_decode_symbol(SINF_DATA *d, SINF_TREE *t)
|
||||
{
|
||||
int sum = 0, cur = 0, len = 0;
|
||||
|
||||
/* get more bits while code value is above sum */
|
||||
do {
|
||||
|
||||
cur = 2*cur + sinf_getbit(d);
|
||||
|
||||
++len;
|
||||
|
||||
sum += t->table[len];
|
||||
cur -= t->table[len];
|
||||
|
||||
} while (cur >= 0);
|
||||
|
||||
return t->trans[sum + cur];
|
||||
}
|
||||
|
||||
/* given a data stream, decode dynamic trees from it */
|
||||
static void sinf_decode_trees(SINF_DATA *d, SINF_TREE *lt, SINF_TREE *dt)
|
||||
{
|
||||
uint8_t lengths[288+32];
|
||||
uint32_t hlit, hdist, hclen;
|
||||
uint32_t i, num, length;
|
||||
|
||||
/* get 5 bits HLIT (257-286) */
|
||||
hlit = sinf_read_bits(d, 5, 257);
|
||||
|
||||
/* get 5 bits HDIST (1-32) */
|
||||
hdist = sinf_read_bits(d, 5, 1);
|
||||
|
||||
/* get 4 bits HCLEN (4-19) */
|
||||
hclen = sinf_read_bits(d, 4, 4);
|
||||
|
||||
for (i = 0; i < 19; ++i) lengths[i] = 0;
|
||||
|
||||
/* read code lengths for code length alphabet */
|
||||
for (i = 0; i < hclen; ++i)
|
||||
{
|
||||
/* get 3 bits code length (0-7) */
|
||||
uint32_t clen = sinf_read_bits(d, 3, 0);
|
||||
|
||||
lengths[SINF_CLCIDX[i]] = clen;
|
||||
}
|
||||
|
||||
/* build code length tree, temporarily use length tree */
|
||||
sinf_build_tree(lt, lengths, 19);
|
||||
|
||||
/* decode code lengths for the dynamic trees */
|
||||
for (num = 0; num < hlit + hdist; )
|
||||
{
|
||||
int sym = sinf_decode_symbol(d, lt);
|
||||
|
||||
switch (sym)
|
||||
{
|
||||
case 16:
|
||||
/* copy previous code length 3-6 times (read 2 bits) */
|
||||
{
|
||||
uint8_t prev = lengths[num - 1];
|
||||
for (length = sinf_read_bits(d, 2, 3); length; --length)
|
||||
{
|
||||
lengths[num++] = prev;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
/* repeat code length 0 for 3-10 times (read 3 bits) */
|
||||
for (length = sinf_read_bits(d, 3, 3); length; --length)
|
||||
{
|
||||
lengths[num++] = 0;
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
/* repeat code length 0 for 11-138 times (read 7 bits) */
|
||||
for (length = sinf_read_bits(d, 7, 11); length; --length)
|
||||
{
|
||||
lengths[num++] = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* values 0-15 represent the actual code lengths */
|
||||
lengths[num++] = sym;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* build dynamic trees */
|
||||
sinf_build_tree(lt, lengths, hlit);
|
||||
sinf_build_tree(dt, lengths + hlit, hdist);
|
||||
}
|
||||
|
||||
/* ----------------------------- *
|
||||
* -- block inflate functions -- *
|
||||
* ----------------------------- */
|
||||
|
||||
/* given a stream and two trees, inflate a block of data */
|
||||
static int sinf_inflate_block_data(SINF_DATA *d, SINF_TREE *lt, SINF_TREE *dt)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
int sym = sinf_decode_symbol(d, lt);
|
||||
|
||||
/* check for end of block */
|
||||
if (sym == 256)
|
||||
{
|
||||
return SINF_OK;
|
||||
}
|
||||
|
||||
if (sym < 256)
|
||||
{
|
||||
sinf_write(d, sym);
|
||||
} else {
|
||||
|
||||
uint32_t length, offs, i;
|
||||
int dist;
|
||||
|
||||
sym -= 257;
|
||||
|
||||
/* possibly get more bits from length code */
|
||||
length = sinf_read_bits(d, SINF_LENGTH_BITS[sym], SINF_LENGTH_BASE[sym]);
|
||||
|
||||
dist = sinf_decode_symbol(d, dt);
|
||||
|
||||
/* possibly get more bits from distance code */
|
||||
offs = sinf_read_bits(d, SINF_DIST_BITS[dist], SINF_DIST_BASE[dist]);
|
||||
|
||||
/* copy match */
|
||||
for (i = 0; i < length; ++i)
|
||||
{
|
||||
sinf_write(d, d->cbuf[(d->cbufi + (1 << SINF_WBITS) - offs) % (1 << SINF_WBITS)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* inflate an uncompressed block of data */
|
||||
static int sinf_inflate_uncompressed_block(SINF_DATA *d)
|
||||
{
|
||||
uint32_t length, invlength;
|
||||
uint32_t i;
|
||||
|
||||
/* get length */
|
||||
length = d->source[1];
|
||||
length = 256*length + d->source[0];
|
||||
|
||||
/* get one's complement of length */
|
||||
invlength = d->source[3];
|
||||
invlength = 256*invlength + d->source[2];
|
||||
|
||||
/* check length */
|
||||
if (length != (~invlength & 0x0000ffff)) return SINF_ERROR;
|
||||
|
||||
d->source += 4;
|
||||
|
||||
/* copy block */
|
||||
for (i = length; i; --i) sinf_write(d, *d->source++);
|
||||
|
||||
/* make sure we start next block on a byte boundary */
|
||||
d->bitcount = 0;
|
||||
|
||||
return SINF_OK;
|
||||
}
|
||||
|
||||
/* inflate a block of data compressed with fixed huffman trees */
|
||||
static int sinf_inflate_fixed_block(SINF_DATA *d)
|
||||
{
|
||||
/* build fixed huffman trees */
|
||||
sinf_build_fixed_trees(&d->ltree, &d->dtree);
|
||||
|
||||
/* decode block using fixed trees */
|
||||
return sinf_inflate_block_data(d, &d->ltree, &d->dtree);
|
||||
}
|
||||
|
||||
/* inflate a block of data compressed with dynamic huffman trees */
|
||||
static int sinf_inflate_dynamic_block(SINF_DATA *d)
|
||||
{
|
||||
/* decode trees from stream */
|
||||
sinf_decode_trees(d, &d->ltree, &d->dtree);
|
||||
|
||||
/* decode block using decoded trees */
|
||||
return sinf_inflate_block_data(d, &d->ltree, &d->dtree);
|
||||
}
|
||||
|
||||
/* ---------------------- *
|
||||
* -- public functions -- *
|
||||
* ---------------------- */
|
||||
|
||||
/* inflate stream from source */
|
||||
static int sinf_inflate(uint8_t *data)
|
||||
{
|
||||
SINF_DATA d;
|
||||
int bfinal;
|
||||
|
||||
/* initialise data */
|
||||
d.bitcount = 0;
|
||||
d.cbufi = 0;
|
||||
d.source = data;
|
||||
|
||||
do {
|
||||
|
||||
uint32_t btype;
|
||||
int res;
|
||||
|
||||
/* read final block flag */
|
||||
bfinal = sinf_getbit(&d);
|
||||
|
||||
/* read block type (2 bits) */
|
||||
btype = sinf_read_bits(&d, 2, 0);
|
||||
|
||||
/* decompress block */
|
||||
switch (btype)
|
||||
{
|
||||
case 0:
|
||||
/* decompress uncompressed block */
|
||||
res = sinf_inflate_uncompressed_block(&d);
|
||||
break;
|
||||
case 1:
|
||||
/* decompress block with fixed huffman trees */
|
||||
res = sinf_inflate_fixed_block(&d);
|
||||
break;
|
||||
case 2:
|
||||
/* decompress block with dynamic huffman trees */
|
||||
res = sinf_inflate_dynamic_block(&d);
|
||||
break;
|
||||
default:
|
||||
return SINF_ERROR;
|
||||
}
|
||||
|
||||
if (res != SINF_OK) return SINF_ERROR;
|
||||
|
||||
} while (!bfinal);
|
||||
|
||||
return SINF_OK;
|
||||
}
|
129
extmod/modTrezorUi/modTrezorUi-stmhal.h
Normal file
129
extmod/modTrezorUi/modTrezorUi-stmhal.h
Normal file
@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
*
|
||||
* Licensed under Microsoft Reference Source License (Ms-RSL)
|
||||
* see LICENSE.md file for details
|
||||
*/
|
||||
|
||||
#include STM32_HAL_H
|
||||
|
||||
#define CMD(X) (*((__IO uint8_t *)((uint32_t)(0x60000000))) = (X))
|
||||
#define DATA(X) (*((__IO uint8_t *)((uint32_t)(0x60000000 | 0x10000))) = (X))
|
||||
|
||||
static void DATAS(void *bytes, int len);
|
||||
|
||||
void sram_init(void) {
|
||||
__GPIOE_CLK_ENABLE();
|
||||
__FSMC_CLK_ENABLE();
|
||||
|
||||
/*
|
||||
// LCD_RST/PA3
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_3;
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_SET);
|
||||
*/
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
|
||||
GPIO_InitStructure.Alternate = GPIO_AF12_FSMC;
|
||||
// LCD_CS/PD7 LCD_RS/PD11 LCD_RD/PD4 LCD_WR/PD5
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_7 | GPIO_PIN_11 | GPIO_PIN_4 | GPIO_PIN_5;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure);
|
||||
// LCD_D0/PD14 LCD_D1/PD15 LCD_D2/PD0 LCD_D3/PD1
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_14 | GPIO_PIN_15 | GPIO_PIN_0 | GPIO_PIN_1;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure);
|
||||
// LCD_D4/PE7 LCD_D5/PE8 LCD_D6/PE9 LCD_D7/PE10
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStructure);
|
||||
|
||||
// timing values from:
|
||||
// http://ele-tech.com/html/it-is-developed-that-embedded-stm32-fsmc-interface-drives-tft-lcd-to-be-designed.html
|
||||
|
||||
FSMC_NORSRAM_InitTypeDef FSMC_NORSRAMInitStructure;
|
||||
FSMC_NORSRAM_TimingTypeDef FSMC_NORSRAMTimingStructure;
|
||||
|
||||
FSMC_NORSRAMTimingStructure.AddressSetupTime = 2;
|
||||
FSMC_NORSRAMTimingStructure.AddressHoldTime = 0;
|
||||
FSMC_NORSRAMTimingStructure.DataSetupTime = 5;
|
||||
FSMC_NORSRAMTimingStructure.BusTurnAroundDuration = 0;
|
||||
FSMC_NORSRAMTimingStructure.CLKDivision = 0;
|
||||
FSMC_NORSRAMTimingStructure.DataLatency = 0;
|
||||
FSMC_NORSRAMTimingStructure.AccessMode = FSMC_ACCESS_MODE_B;
|
||||
|
||||
FSMC_NORSRAMInitStructure.NSBank = FSMC_NORSRAM_BANK1;
|
||||
FSMC_NORSRAMInitStructure.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
|
||||
FSMC_NORSRAMInitStructure.MemoryType = FSMC_MEMORY_TYPE_NOR;
|
||||
FSMC_NORSRAMInitStructure.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_8;
|
||||
FSMC_NORSRAMInitStructure.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE;
|
||||
FSMC_NORSRAMInitStructure.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
|
||||
FSMC_NORSRAMInitStructure.WrapMode = FSMC_WRAP_MODE_DISABLE;
|
||||
FSMC_NORSRAMInitStructure.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
|
||||
FSMC_NORSRAMInitStructure.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
|
||||
FSMC_NORSRAMInitStructure.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
|
||||
FSMC_NORSRAMInitStructure.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE;
|
||||
FSMC_NORSRAMInitStructure.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
|
||||
FSMC_NORSRAMInitStructure.WriteBurst = FSMC_WRITE_BURST_DISABLE;
|
||||
FSMC_NORSRAMInitStructure.PageSize = FSMC_PAGE_SIZE_NONE;
|
||||
|
||||
FSMC_NORSRAM_Init(FSMC_NORSRAM_DEVICE, &FSMC_NORSRAMInitStructure);
|
||||
FSMC_NORSRAM_Timing_Init(FSMC_NORSRAM_DEVICE, &FSMC_NORSRAMTimingStructure, FSMC_NORSRAMInitStructure.NSBank);
|
||||
// FSMC_NORSRAM_Extended_Timing_Init(FSMC_NORSRAM_EXTENDED_DEVICE, &FSMC_NORSRAMTimingStructure, FSMC_NORSRAMInitStructure.NSBank, FSMC_NORSRAMInitStructure.ExtendedMode);
|
||||
__FSMC_NORSRAM_ENABLE(FSMC_NORSRAM_DEVICE, FSMC_NORSRAMInitStructure.NSBank);
|
||||
}
|
||||
|
||||
/*
|
||||
static void display_sleep(void) {
|
||||
CMD(0x28); // display off
|
||||
HAL_Delay(20);
|
||||
CMD(0x10); // enter sleep
|
||||
}
|
||||
*/
|
||||
|
||||
static void display_unsleep(void) {
|
||||
CMD(0x11); // exit sleep
|
||||
HAL_Delay(20);
|
||||
CMD(0x29); // display
|
||||
}
|
||||
|
||||
static void display_init(void) {
|
||||
sram_init();
|
||||
CMD(0x01); // software reset
|
||||
HAL_Delay(20);
|
||||
CMD(0x28); // display off
|
||||
CMD(0xCF); DATAS("\x00\xC1\x30", 3);
|
||||
CMD(0xED); DATAS("\x64\x03\x12\x81", 4);
|
||||
CMD(0xE8); DATAS("\x85\x10\x7A", 3);
|
||||
CMD(0xCB); DATAS("\x39\x2C\x00\x34\x02", 5);
|
||||
CMD(0xF7); DATA(0x20);
|
||||
CMD(0xEA); DATAS("\x00\x00", 2);
|
||||
CMD(0xC0); DATA(0x23); // power control VRH[5:0]
|
||||
CMD(0xC1); DATA(0x12); // power control SAP[2:0] BT[3:0]
|
||||
CMD(0xC5); DATAS("\x60\x44", 2); // vcm control 1
|
||||
CMD(0xC7); DATA(0x8A); // vcm control 2
|
||||
CMD(0x36); DATA(0x08); // memory access control (RGB)
|
||||
CMD(0x3A); DATA(0x55); // memory access control (16-bit 565)
|
||||
CMD(0xB1); DATAS("\x00\x18", 2); // framerate
|
||||
CMD(0xB6); DATAS("\x0A\xA2", 2); // display function control
|
||||
CMD(0xF6); DATAS("\x01\x30\x00", 3); // interface control
|
||||
CMD(0xF2); DATA(0x00); // 3 gamma func disable
|
||||
CMD(0x26); DATA(0x01); // gamma func enable
|
||||
CMD(0xE0); DATAS("\x0F\x2F\x2C\x0B\x0F\x09\x56\xD9\x4A\x0B\x14\x05\x0C\x06\x00", 15); // gamma curve 1
|
||||
CMD(0xE1); DATAS("\x00\x10\x13\x04\x10\x06\x25\x26\x3B\x04\x0B\x0A\x33\x39\x0F", 15); // gamma curve 2
|
||||
CMD(0x21); // invert colors
|
||||
display_unsleep();
|
||||
}
|
||||
|
||||
static void display_set_window(uint8_t x, uint8_t y, uint8_t w, uint8_t h) {
|
||||
CMD(0x2A); DATA(0); DATA(x); DATA(0); DATA(x + w - 1); // column addr set
|
||||
CMD(0x2B); DATA(0); DATA(y); DATA(0); DATA(y + h - 1); // row addr set
|
||||
CMD(0x2C);
|
||||
}
|
||||
|
||||
static void display_update(void) {
|
||||
}
|
69
extmod/modTrezorUi/modTrezorUi-unix.h
Normal file
69
extmod/modTrezorUi/modTrezorUi-unix.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
*
|
||||
* Licensed under Microsoft Reference Source License (Ms-RSL)
|
||||
* see LICENSE.md file for details
|
||||
*/
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
static int SDL_inited = 0;
|
||||
static SDL_Renderer *RENDERER = 0;
|
||||
static SDL_Surface *SCREEN = 0;
|
||||
static SDL_Texture *TEXTURE = 0;
|
||||
static int DATAODD = 0;
|
||||
static int POSX, POSY, SX, SY, EX, EY = 0;
|
||||
|
||||
static void DATA(uint8_t x) {
|
||||
if (!SDL_inited) return;
|
||||
if (POSX <= EX && POSY <= EY) {
|
||||
((uint8_t *)SCREEN->pixels)[POSX * 2 + POSY * SCREEN->pitch + (DATAODD ^ 1)] = x;
|
||||
}
|
||||
DATAODD = !DATAODD;
|
||||
if (DATAODD == 0) {
|
||||
POSX++;
|
||||
if (POSX > EX) {
|
||||
POSX = SX;
|
||||
POSY++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void display_init(void)
|
||||
{
|
||||
if (SDL_inited) return;
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||
printf("SDL_Init Error: %s\n", SDL_GetError());
|
||||
}
|
||||
SDL_Window *win = SDL_CreateWindow("TREZOR", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, RESX, RESY, SDL_WINDOW_SHOWN);
|
||||
if (!win) {
|
||||
printf("SDL_CreateWindow Error: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
}
|
||||
RENDERER = SDL_CreateRenderer(win, -1, SDL_RENDERER_SOFTWARE);
|
||||
if (!RENDERER) {
|
||||
printf("SDL_CreateRenderer Error: %s\n", SDL_GetError());
|
||||
SDL_DestroyWindow(win);
|
||||
SDL_Quit();
|
||||
}
|
||||
SDL_RenderClear(RENDERER);
|
||||
SCREEN = SDL_CreateRGBSurface(0, RESX, RESY, 16, 0xF800, 0x07E0, 0x001F, 0x0000);
|
||||
TEXTURE = SDL_CreateTexture(RENDERER, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, RESX, RESY);
|
||||
SDL_inited = 1;
|
||||
}
|
||||
|
||||
static void display_set_window(uint8_t x, uint8_t y, uint8_t w, uint8_t h) {
|
||||
if (!SDL_inited) return;
|
||||
SX = x; SY = y;
|
||||
EX = x + w - 1; EY = y + h - 1;
|
||||
POSX = SX; POSY = SY;
|
||||
DATAODD = 0;
|
||||
}
|
||||
|
||||
static void display_update(void)
|
||||
{
|
||||
if (!SDL_inited) return;
|
||||
SDL_UpdateTexture(TEXTURE, NULL, SCREEN->pixels, SCREEN->pitch);
|
||||
SDL_RenderCopy(RENDERER, TEXTURE, NULL, NULL);
|
||||
SDL_RenderPresent(RENDERER);
|
||||
}
|
222
extmod/modTrezorUi/modTrezorUi.c
Normal file
222
extmod/modTrezorUi/modTrezorUi.c
Normal file
@ -0,0 +1,222 @@
|
||||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
*
|
||||
* Licensed under Microsoft Reference Source License (Ms-RSL)
|
||||
* see LICENSE.md file for details
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/binary.h"
|
||||
|
||||
#if MICROPY_PY_TREZORUI
|
||||
|
||||
#define RESX 240
|
||||
#define RESY 240
|
||||
|
||||
#if defined STM32_HAL_H
|
||||
#include "modTrezorUi-stmhal.h"
|
||||
#elif defined UNIX
|
||||
#include "modTrezorUi-unix.h"
|
||||
#else
|
||||
#error Unsupported port. Only STMHAL and UNIX ports are supported.
|
||||
#endif
|
||||
|
||||
#define SINF_WRITE DATA
|
||||
|
||||
#include "modTrezorUi-inflate.h"
|
||||
#include "modTrezorUi-font_roboto.h"
|
||||
|
||||
// common functions
|
||||
|
||||
static void DATAS(void *bytes, int len) {
|
||||
const uint8_t *c = (const uint8_t *)bytes;
|
||||
while (len-- > 0) {
|
||||
DATA(*c);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
static void display_bar(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t c) {
|
||||
display_set_window(x, y, w, h);
|
||||
int i;
|
||||
for (i = 0; i < w * h; i++) {
|
||||
DATA(c >> 8);
|
||||
DATA(c & 0xFF);
|
||||
}
|
||||
display_update();
|
||||
}
|
||||
|
||||
static void display_blit(uint8_t x, uint8_t y, uint8_t w, uint8_t h, void *data, int datalen) {
|
||||
display_set_window(x, y, w, h);
|
||||
DATAS(data, datalen);
|
||||
display_update();
|
||||
}
|
||||
|
||||
static void display_image(uint8_t x, uint8_t y, uint8_t w, uint8_t h, void *data, int datalen) {
|
||||
display_set_window(x, y, w, h);
|
||||
sinf_inflate(data);
|
||||
display_update();
|
||||
}
|
||||
|
||||
// first two bytes are width and height of the glyph
|
||||
// third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph
|
||||
// rest is packed 4-bit glyph data
|
||||
static void display_text(uint8_t x, uint8_t y, uint8_t *text, int textlen, uint16_t fgcolor, uint16_t bgcolor) {
|
||||
int i, j, xx = x;
|
||||
const uint8_t *g;
|
||||
uint8_t c, cr, cg, cb;
|
||||
uint16_t ct[16];
|
||||
// precompute color table
|
||||
for (i = 0; i < 16; i++) {
|
||||
cr = (((fgcolor & 0xF800) >> 11) * i + ((bgcolor & 0xF800) >> 11) * (15 - i)) / 15;
|
||||
cg = (((fgcolor & 0x07E0) >> 5) * i + ((bgcolor & 0x07E0) >> 5) * (15 - i)) / 15;
|
||||
cb = ((fgcolor & 0x001F) * i + (bgcolor & 0x001F) * (15 - i)) / 15;
|
||||
ct[i] = (cr << 11) | (cg << 5) | cb;
|
||||
}
|
||||
// render glyphs
|
||||
for (i = 0; i < textlen; i++) {
|
||||
if (text[i] >= ' ' && text[i] <= '~') {
|
||||
g = Font_Roboto_Regular_18[text[i] - ' '];
|
||||
} else
|
||||
// UTF-8 handling: https://en.wikipedia.org/wiki/UTF-8#Description
|
||||
if (text[i] >= 0xC0) {
|
||||
// bytes 11xxxxxx are first byte of UTF-8 characters
|
||||
g = Font_Roboto_Regular_18['_' - ' '];
|
||||
} else {
|
||||
// bytes 10xxxxxx are successive UTF-8 characters
|
||||
continue;
|
||||
}
|
||||
// g[0], g[1] = width, height
|
||||
// g[2] = advance
|
||||
// g[3], g[4] = bearingX, bearingY
|
||||
if (g[0] && g[1]) {
|
||||
display_set_window(xx + g[3], y - g[4], g[0], g[1]);
|
||||
for (j = 0; j < g[0] * g[1]; j++) {
|
||||
if (j % 2 == 0) {
|
||||
c = g[5 + j/2] >> 4;
|
||||
} else {
|
||||
c = g[5 + j/2] & 0x0F;
|
||||
}
|
||||
DATA(ct[c] >> 8);
|
||||
DATA(ct[c] & 0xFF);
|
||||
}
|
||||
display_update();
|
||||
}
|
||||
xx += g[2];
|
||||
}
|
||||
}
|
||||
|
||||
// uPy wrappers
|
||||
|
||||
// class Display(object):
|
||||
typedef struct _mp_obj_Display_t {
|
||||
mp_obj_base_t base;
|
||||
} mp_obj_Display_t;
|
||||
|
||||
// def Display.__init__(self):
|
||||
STATIC mp_obj_t mod_TrezorUi_Display_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
display_init();
|
||||
mp_obj_Display_t *o = m_new_obj(mp_obj_Display_t);
|
||||
o->base.type = type;
|
||||
return MP_OBJ_FROM_PTR(o);
|
||||
}
|
||||
|
||||
// def Display.bar(self, x: int, y: int, w: int, h: int, color: int) -> None:
|
||||
STATIC mp_obj_t mod_TrezorUi_Display_bar(size_t n_args, const mp_obj_t *args) {
|
||||
mp_int_t x = mp_obj_get_int(args[1]);
|
||||
mp_int_t y = mp_obj_get_int(args[2]);
|
||||
mp_int_t w = mp_obj_get_int(args[3]);
|
||||
mp_int_t h = mp_obj_get_int(args[4]);
|
||||
uint16_t c = mp_obj_get_int(args[5]);
|
||||
if ((x < 0) || (y < 0) || (x + w > RESX) || (y + h > RESY)) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Out of bounds"));
|
||||
}
|
||||
display_bar(x, y, w, h, c);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_bar_obj, 6, 6, mod_TrezorUi_Display_bar);
|
||||
|
||||
// def Display.blit(self, x: int, y: int, w: int, h: int, data: bytes) -> None:
|
||||
STATIC mp_obj_t mod_TrezorUi_Display_blit(size_t n_args, const mp_obj_t *args) {
|
||||
mp_int_t x = mp_obj_get_int(args[1]);
|
||||
mp_int_t y = mp_obj_get_int(args[2]);
|
||||
mp_int_t w = mp_obj_get_int(args[3]);
|
||||
mp_int_t h = mp_obj_get_int(args[4]);
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[5], &bufinfo, MP_BUFFER_READ);
|
||||
if (bufinfo.len != 2 * w * h) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Wrong data size (got %d bytes, expected %d bytes)", bufinfo.len, 2 * w * h));
|
||||
}
|
||||
display_blit(x, y, w, h, bufinfo.buf, bufinfo.len);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_blit_obj, 6, 6, mod_TrezorUi_Display_blit);
|
||||
|
||||
// def Display.image(self, x: int, y: int, image: bytes) -> None:
|
||||
STATIC mp_obj_t mod_TrezorUi_Display_image(size_t n_args, const mp_obj_t *args) {
|
||||
mp_int_t x = mp_obj_get_int(args[1]);
|
||||
mp_int_t y = mp_obj_get_int(args[2]);
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ);
|
||||
uint8_t *data = bufinfo.buf;
|
||||
if (bufinfo.len < 8 || memcmp(data, "TOIa", 4) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Invalid image format"));
|
||||
}
|
||||
mp_int_t w = (data[4] << 8) | data[5];
|
||||
mp_int_t h = (data[6] << 8) | data[7];
|
||||
if ((x < 0) || (y < 0) || (x + w > RESX) || (y + h > RESY)) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Out of bounds"));
|
||||
}
|
||||
display_image(x, y, w, h, data + 8, bufinfo.len - 8);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_image_obj, 4, 4, mod_TrezorUi_Display_image);
|
||||
|
||||
// def Display.text(self, x: int, y: int, text: bytes, fgcolor: int, bgcolor: int) -> None:
|
||||
STATIC mp_obj_t mod_TrezorUi_Display_text(size_t n_args, const mp_obj_t *args) {
|
||||
mp_int_t x = mp_obj_get_int(args[1]);
|
||||
mp_int_t y = mp_obj_get_int(args[2]);
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ);
|
||||
mp_int_t fgcolor = mp_obj_get_int(args[4]);
|
||||
mp_int_t bgcolor = mp_obj_get_int(args[5]);
|
||||
display_text(x, y, bufinfo.buf, bufinfo.len, fgcolor, bgcolor);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_obj, 6, 6, mod_TrezorUi_Display_text);
|
||||
|
||||
STATIC const mp_rom_map_elem_t mod_TrezorUi_Display_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_bar), MP_ROM_PTR(&mod_TrezorUi_Display_bar_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_blit), MP_ROM_PTR(&mod_TrezorUi_Display_blit_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_image), MP_ROM_PTR(&mod_TrezorUi_Display_image_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_text), MP_ROM_PTR(&mod_TrezorUi_Display_text_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(mod_TrezorUi_Display_locals_dict, mod_TrezorUi_Display_locals_dict_table);
|
||||
|
||||
STATIC const mp_obj_type_t mod_TrezorUi_Display_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Display,
|
||||
.make_new = mod_TrezorUi_Display_make_new,
|
||||
.locals_dict = (void*)&mod_TrezorUi_Display_locals_dict,
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t mp_module_TrezorUi_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_TrezorUi) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Display), MP_ROM_PTR(&mod_TrezorUi_Display_type) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_module_TrezorUi_globals, mp_module_TrezorUi_globals_table);
|
||||
|
||||
const mp_obj_module_t mp_module_TrezorUi = {
|
||||
.base = { &mp_type_module },
|
||||
.name = MP_QSTR_TrezorUi,
|
||||
.globals = (mp_obj_dict_t*)&mp_module_TrezorUi_globals,
|
||||
};
|
||||
|
||||
|
||||
#endif // MICROPY_PY_TREZORUI
|
Loading…
Reference in New Issue
Block a user