Increased font size in menus

This commit is contained in:
Dennis Real 2019-09-23 18:18:13 +02:00
parent c848019f54
commit c7e7fdb6d4
8 changed files with 793 additions and 318 deletions

315
Font5x7.c
View file

@ -13,15 +13,15 @@ const uint8_t x5x7_bits [] =
{
/* Character (0x00):
bbw=5, bbh=7, bbx=0, bby=-1, width=5
+----------------+
|**** |
|**** |
|**** |
|**** |
|**** |
|**** |
| |
+----------------+ */
+--------+
|**** |
|**** |
|**** |
|**** |
|**** |
|**** |
| |
+--------+ */
0xf0,
0xf0,
0xf0,
@ -30,6 +30,45 @@ const uint8_t x5x7_bits [] =
0xf0,
0x00,
/* Character (0x01):
bbw=5, bbh=7, bbx=0, bby=-1, width=5
+--------+
| |
| * |
| *** |
|***** |
| *** |
| * |
| |
+--------+ */
0x00,
0x20,
0x70,
0xf8,
0x70,
0x20,
0x00,
/* Character (0x02):
bbw=5, bbh=7, bbx=0, bby=-1, width=5
+--------+
| * * |
|* * |
| * * |
|* * |
| * * |
|* * |
| |
+--------+ */
0x50,
0xa0,
0x50,
0xa0,
0x50,
0xa0,
0x00,
/* Character ():
bbw=5, bbh=7, bbx=0, bby=-1, width=5
+--------+
@ -1954,133 +1993,133 @@ const uint8_t x5x7_bits [] =
/* Character width data. */
static UNS_8 x5x7_width [] =
{
5, /* (0x00) */
5, /* (0x01) */
5, /* (0x02) */
5, /* (0x03) */
5, /* (0x04) */
5, /* (0x05) */
5, /* (0x06) */
5, /* (0x07) */
5, /* (0x08) */
5, /* (0x09) */
5, /* (0x0a) */
5, /* (0x0b) */
5, /* (0x0c) */
5, /* (0x0d) */
5, /* (0x0e) */
5, /* (0x0f) */
5, /* (0x10) */
5, /* (0x11) */
5, /* (0x12) */
5, /* (0x13) */
5, /* (0x14) */
5, /* (0x15) */
5, /* (0x16) */
5, /* (0x17) */
5, /* (0x18) */
5, /* (0x19) */
5, /* (0x1a) */
5, /* (0x1b) */
5, /* (0x1c) */
5, /* (0x1d) */
5, /* (0x1e) */
5, /* (0x1f) */
5, /* (0x20) */
5, /* (0x21) */
5, /* (0x22) */
5, /* (0x23) */
5, /* (0x24) */
5, /* (0x25) */
5, /* (0x26) */
5, /* (0x27) */
5, /* (0x28) */
5, /* (0x29) */
5, /* (0x2a) */
5, /* (0x2b) */
5, /* (0x2c) */
5, /* (0x2d) */
5, /* (0x2e) */
5, /* (0x2f) */
5, /* (0x30) */
5, /* (0x31) */
5, /* (0x32) */
5, /* (0x33) */
5, /* (0x34) */
5, /* (0x35) */
5, /* (0x36) */
5, /* (0x37) */
5, /* (0x38) */
5, /* (0x39) */
5, /* (0x3a) */
5, /* (0x3b) */
5, /* (0x3c) */
5, /* (0x3d) */
5, /* (0x3e) */
5, /* (0x3f) */
5, /* (0x40) */
5, /* (0x41) */
5, /* (0x42) */
5, /* (0x43) */
5, /* (0x44) */
5, /* (0x45) */
5, /* (0x46) */
5, /* (0x47) */
5, /* (0x48) */
5, /* (0x49) */
5, /* (0x4a) */
5, /* (0x4b) */
5, /* (0x4c) */
5, /* (0x4d) */
5, /* (0x4e) */
5, /* (0x4f) */
5, /* (0x50) */
5, /* (0x51) */
5, /* (0x52) */
5, /* (0x53) */
5, /* (0x54) */
5, /* (0x55) */
5, /* (0x56) */
5, /* (0x57) */
5, /* (0x58) */
5, /* (0x59) */
5, /* (0x5a) */
5, /* (0x5b) */
5, /* (0x5c) */
5, /* (0x5d) */
5, /* (0x5e) */
5, /* (0x5f) */
5, /* (0x60) */
5, /* (0x61) */
5, /* (0x62) */
5, /* (0x63) */
5, /* (0x64) */
5, /* (0x65) */
5, /* (0x66) */
5, /* (0x67) */
5, /* (0x68) */
5, /* (0x69) */
5, /* (0x6a) */
5, /* (0x6b) */
5, /* (0x6c) */
5, /* (0x6d) */
5, /* (0x6e) */
5, /* (0x6f) */
5, /* (0x70) */
5, /* (0x71) */
5, /* (0x72) */
5, /* (0x73) */
5, /* (0x74) */
5, /* (0x75) */
5, /* (0x76) */
5, /* (0x77) */
5, /* (0x78) */
5, /* (0x79) */
5, /* (0x7a) */
5, /* (0x7b) */
5, /* (0x7c) */
5, /* (0x7d) */
5, /* (0x7e) */
5, /* (0x00) */
5, /* (0x01) */
5, /* (0x02) */
5, /* (0x03) */
5, /* (0x04) */
5, /* (0x05) */
5, /* (0x06) */
5, /* (0x07) */
5, /* (0x08) */
5, /* (0x09) */
5, /* (0x0a) */
5, /* (0x0b) */
5, /* (0x0c) */
5, /* (0x0d) */
5, /* (0x0e) */
5, /* (0x0f) */
5, /* (0x10) */
5, /* (0x11) */
5, /* (0x12) */
5, /* (0x13) */
5, /* (0x14) */
5, /* (0x15) */
5, /* (0x16) */
5, /* (0x17) */
5, /* (0x18) */
5, /* (0x19) */
5, /* (0x1a) */
5, /* (0x1b) */
5, /* (0x1c) */
5, /* (0x1d) */
5, /* (0x1e) */
5, /* (0x1f) */
5, /* (0x20) */
5, /* (0x21) */
5, /* (0x22) */
5, /* (0x23) */
5, /* (0x24) */
5, /* (0x25) */
5, /* (0x26) */
5, /* (0x27) */
5, /* (0x28) */
5, /* (0x29) */
5, /* (0x2a) */
5, /* (0x2b) */
5, /* (0x2c) */
5, /* (0x2d) */
5, /* (0x2e) */
5, /* (0x2f) */
5, /* (0x30) */
5, /* (0x31) */
5, /* (0x32) */
5, /* (0x33) */
5, /* (0x34) */
5, /* (0x35) */
5, /* (0x36) */
5, /* (0x37) */
5, /* (0x38) */
5, /* (0x39) */
5, /* (0x3a) */
5, /* (0x3b) */
5, /* (0x3c) */
5, /* (0x3d) */
5, /* (0x3e) */
5, /* (0x3f) */
5, /* (0x40) */
5, /* (0x41) */
5, /* (0x42) */
5, /* (0x43) */
5, /* (0x44) */
5, /* (0x45) */
5, /* (0x46) */
5, /* (0x47) */
5, /* (0x48) */
5, /* (0x49) */
5, /* (0x4a) */
5, /* (0x4b) */
5, /* (0x4c) */
5, /* (0x4d) */
5, /* (0x4e) */
5, /* (0x4f) */
5, /* (0x50) */
5, /* (0x51) */
5, /* (0x52) */
5, /* (0x53) */
5, /* (0x54) */
5, /* (0x55) */
5, /* (0x56) */
5, /* (0x57) */
5, /* (0x58) */
5, /* (0x59) */
5, /* (0x5a) */
5, /* (0x5b) */
5, /* (0x5c) */
5, /* (0x5d) */
5, /* (0x5e) */
5, /* (0x5f) */
5, /* (0x60) */
5, /* (0x61) */
5, /* (0x62) */
5, /* (0x63) */
5, /* (0x64) */
5, /* (0x65) */
5, /* (0x66) */
5, /* (0x67) */
5, /* (0x68) */
5, /* (0x69) */
5, /* (0x6a) */
5, /* (0x6b) */
5, /* (0x6c) */
5, /* (0x6d) */
5, /* (0x6e) */
5, /* (0x6f) */
5, /* (0x70) */
5, /* (0x71) */
5, /* (0x72) */
5, /* (0x73) */
5, /* (0x74) */
5, /* (0x75) */
5, /* (0x76) */
5, /* (0x77) */
5, /* (0x78) */
5, /* (0x79) */
5, /* (0x7a) */
5, /* (0x7b) */
5, /* (0x7c) */
5, /* (0x7d) */
5, /* (0x7e) */
};
#endif
@ -2094,12 +2133,12 @@ uint8_t x5x7_map_char_table(uint8_t ch)
if ( ch > 0x7e )
{
/* limit to largest character */
ch = 0x7e - 32 + 7;
ch = 0x7e - 32 + 9;
}
else if ( ch >= 32 )
{
/* normal character */
ch = ch - 32 + 7;
ch = ch - 32 + 9;
}
else
{

242
Font8x8.c Normal file
View file

@ -0,0 +1,242 @@
#include <stdint.h>
const uint8_t x8x8_bits[][8]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* nul */
{0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00}, /* diamond */
{0x00,0x50,0xa0,0x50,0xa0,0x50,0xa0,0x00}, /* multiline marker */
{0x00,0x20,0x40,0xF8,0xF8,0x40,0x20,0x00}, /* left arrow */
{0x00,0x20,0x10,0xF8,0xF8,0x10,0x20,0x00}, /* right arrow */
{0x00,0x00,0xFE,0x6C,0x6C,0x6C,0x6C,0x00}, /* pi */
{0x00,0x00,0xCC,0xCC,0xCC,0x7C,0x0C,0x06}, /* micro */
{0x7C,0xC6,0xC6,0xC6,0x6C,0x6C,0xEE,0x00}, /* omega */
{0x70,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00}, /* degree */
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* 0x20 ' ' */
{0x60,0xF0,0xF0,0x60,0x60,0x00,0x60,0x00}, /* 0x21 '!' */
{0xD8,0xD8,0xD8,0x00,0x00,0x00,0x00,0x00}, /* 0x22 '"' */
{0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00}, /* 0x23 '#' */
{0x30,0x7C,0xC0,0x78,0x0C,0xF8,0x30,0x00}, /* 0x24 '$' */
{0x00,0xC6,0xCC,0x18,0x30,0x66,0xC6,0x00}, /* 0x25 '%' */
{0x38,0x6C,0x38,0x76,0xDC,0xCC,0x76,0x00}, /* 0x26 '&' */
{0x60,0x60,0xC0,0x00,0x00,0x00,0x00,0x00}, /* 0x27 ''' */
{0x30,0x60,0xC0,0xC0,0xC0,0x60,0x30,0x00}, /* 0x28 '(' */
{0xC0,0x60,0x30,0x30,0x30,0x60,0xC0,0x00}, /* 0x29 ')' */
{0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00}, /* 0x2A '*' */
{0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00}, /* 0x2B '+' */
{0x00,0x00,0x00,0x00,0x00,0xE0,0x60,0xC0}, /* 0x2C ',' */
{0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00}, /* 0x2D '-' */
{0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00}, /* 0x2E '.' */
{0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00}, /* 0x2F '/' */
{0x78,0xCC,0xDC,0xFC,0xEC,0xCC,0x78,0x00}, /* 0x30 '0' */
{0x30,0xF0,0x30,0x30,0x30,0x30,0xFC,0x00}, /* 0x31 '1' */
{0x78,0xCC,0x0C,0x38,0x60,0xCC,0xFC,0x00}, /* 0x32 '2' */
{0x78,0xCC,0x0C,0x38,0x0C,0xCC,0x78,0x00}, /* 0x33 '3' */
{0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x00}, /* 0x34 '4' */
{0xFC,0xC0,0xF8,0x0C,0x0C,0xCC,0x78,0x00}, /* 0x35 '5' */
{0x38,0x60,0xC0,0xF8,0xCC,0xCC,0x78,0x00}, /* 0x36 '6' */
{0xFC,0xCC,0x0C,0x18,0x30,0x60,0x60,0x00}, /* 0x37 '7' */
{0x78,0xCC,0xCC,0x78,0xCC,0xCC,0x78,0x00}, /* 0x38 '8' */
{0x78,0xCC,0xCC,0x7C,0x0C,0x18,0x70,0x00}, /* 0x39 '9' */
{0x00,0x00,0xC0,0xC0,0x00,0xC0,0xC0,0x00}, /* 0x3A ':' */
{0x00,0x00,0x60,0x60,0x00,0xE0,0x60,0xC0}, /* 0x3B ';' */
{0x18,0x30,0x60,0xC0,0x60,0x30,0x18,0x00}, /* 0x3C '<' */
{0x00,0x00,0xFC,0x00,0xFC,0x00,0x00,0x00}, /* 0x3D '=' */
{0xC0,0x60,0x30,0x18,0x30,0x60,0xC0,0x00}, /* 0x3E '>' */
{0x78,0xCC,0x0C,0x18,0x30,0x00,0x30,0x00}, /* 0x3F '?' */
{0x7C,0xC6,0xDE,0xDE,0xDE,0xC0,0x78,0x00}, /* 0x40 '@' */
{0x30,0x78,0xCC,0xCC,0xFC,0xCC,0xCC,0x00}, /* 0x41 'A' */
{0xFC,0x66,0x66,0x7C,0x66,0x66,0xFC,0x00}, /* 0x42 'B' */
{0x3C,0x66,0xC0,0xC0,0xC0,0x66,0x3C,0x00}, /* 0x43 'C' */
{0xFC,0x6C,0x66,0x66,0x66,0x6C,0xFC,0x00}, /* 0x44 'D' */
{0xFE,0x62,0x68,0x78,0x68,0x62,0xFE,0x00}, /* 0x45 'E' */
{0xFE,0x62,0x68,0x78,0x68,0x60,0xF0,0x00}, /* 0x46 'F' */
{0x3C,0x66,0xC0,0xC0,0xCE,0x66,0x3E,0x00}, /* 0x47 'G' */
{0xCC,0xCC,0xCC,0xFC,0xCC,0xCC,0xCC,0x00}, /* 0x48 'H' */
{0xF0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00}, /* 0x49 'I' */
{0x1E,0x0C,0x0C,0x0C,0xCC,0xCC,0x78,0x00}, /* 0x4A 'J' */
{0xE6,0x66,0x6C,0x78,0x6C,0x66,0xE6,0x00}, /* 0x4B 'K' */
{0xF0,0x60,0x60,0x60,0x62,0x66,0xFE,0x00}, /* 0x4C 'L' */
{0xC6,0xEE,0xFE,0xD6,0xC6,0xC6,0xC6,0x00}, /* 0x4D 'M' */
{0xC6,0xE6,0xF6,0xDE,0xCE,0xC6,0xC6,0x00}, /* 0x4E 'N' */
{0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x38,0x00}, /* 0x4F 'O' */
{0xFC,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00}, /* 0x50 'P' */
{0x78,0xCC,0xCC,0xCC,0xDC,0x78,0x1C,0x00}, /* 0x51 'Q' */
{0xFC,0x66,0x66,0x7C,0x78,0x6C,0xE6,0x00}, /* 0x52 'R' */
{0x78,0xCC,0xE0,0x38,0x1C,0xCC,0x78,0x00}, /* 0x53 'S' */
{0xFC,0xB4,0x30,0x30,0x30,0x30,0x78,0x00}, /* 0x54 'T' */
{0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xFC,0x00}, /* 0x55 'U' */
{0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x30,0x00}, /* 0x56 'V' */
{0xC6,0xC6,0xC6,0xD6,0xFE,0xEE,0xC6,0x00}, /* 0x57 'W' */
{0xC6,0xC6,0x6C,0x38,0x6C,0xC6,0xC6,0x00}, /* 0x58 'X' */
{0xCC,0xCC,0xCC,0x78,0x30,0x30,0x78,0x00}, /* 0x59 'Y' */
{0xFE,0xCC,0x98,0x30,0x62,0xC6,0xFE,0x00}, /* 0x5A 'Z' */
{0xF0,0xC0,0xC0,0xC0,0xC0,0xC0,0xF0,0x00}, /* 0x5B '[' */
{0xC0,0x60,0x30,0x18,0x0C,0x06,0x02,0x00}, /* 0x5C '\' */
{0xF0,0x30,0x30,0x30,0x30,0x30,0xF0,0x00}, /* 0x5D ']' */
{0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00}, /* 0x5E '^' */
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF}, /* 0x5F '_' */
{0xC0,0xC0,0x60,0x00,0x00,0x00,0x00,0x00}, /* 0x60 '`' */
{0x00,0x00,0x78,0x0C,0x7C,0xCC,0x76,0x00}, /* 0x61 'a' */
{0xE0,0x60,0x7C,0x66,0x66,0x66,0xBC,0x00}, /* 0x62 'b' */
{0x00,0x00,0x78,0xCC,0xC0,0xCC,0x78,0x00}, /* 0x63 'c' */
{0x1C,0x0C,0x0C,0x7C,0xCC,0xCC,0x76,0x00}, /* 0x64 'd' */
{0x00,0x00,0x78,0xCC,0xFC,0xC0,0x78,0x00}, /* 0x65 'e' */
{0x38,0x6C,0x60,0xF0,0x60,0x60,0xF0,0x00}, /* 0x66 'f' */
{0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0xF8}, /* 0x67 'g' */
{0xE0,0x60,0x6C,0x76,0x66,0x66,0xE6,0x00}, /* 0x68 'h' */
{0x60,0x00,0xE0,0x60,0x60,0x60,0xF0,0x00}, /* 0x69 'i' */
{0x18,0x00,0x78,0x18,0x18,0x18,0xD8,0x70}, /* 0x6A 'j' */
{0xE0,0x60,0x66,0x6C,0x78,0x6C,0xE6,0x00}, /* 0x6B 'k' */
{0xE0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00}, /* 0x6C 'l' */
{0x00,0x00,0xEC,0xFE,0xD6,0xC6,0xC6,0x00}, /* 0x6D 'm' */
{0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xCC,0x00}, /* 0x6E 'n' */
{0x00,0x00,0x78,0xCC,0xCC,0xCC,0x78,0x00}, /* 0x6F 'o' */
{0x00,0x00,0xDC,0x66,0x66,0x7C,0x60,0xF0}, /* 0x70 'p' */
{0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0x1E}, /* 0x71 'q' */
{0x00,0x00,0xD8,0x6C,0x6C,0x60,0xF0,0x00}, /* 0x72 'r' */
{0x00,0x00,0x7C,0xC0,0x78,0x0C,0xF8,0x00}, /* 0x73 's' */
{0x20,0x60,0xF8,0x60,0x60,0x68,0x30,0x00}, /* 0x74 't' */
{0x00,0x00,0xCC,0xCC,0xCC,0xCC,0x76,0x00}, /* 0x75 'u' */
{0x00,0x00,0xCC,0xCC,0xCC,0x78,0x30,0x00}, /* 0x76 'v' */
{0x00,0x00,0xC6,0xC6,0xD6,0xFE,0x6C,0x00}, /* 0x77 'w' */
{0x00,0x00,0xC6,0x6C,0x38,0x6C,0xC6,0x00}, /* 0x78 'x' */
{0x00,0x00,0xCC,0xCC,0xCC,0x7C,0x0C,0xF8}, /* 0x79 'y' */
{0x00,0x00,0xFC,0x98,0x30,0x64,0xFC,0x00}, /* 0x7A 'z' */
{0x1C,0x30,0x30,0xE0,0x30,0x30,0x1C,0x00}, /* 0x7B '{' */
{0xC0,0xC0,0xC0,0x00,0xC0,0xC0,0xC0,0x00}, /* 0x7C '|' */
{0xE0,0x30,0x30,0x1C,0x30,0x30,0xE0,0x00}, /* 0x7D '}' */
{0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00}, /* 0x7E '~' */
{0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00}, /* 0x7F '' */
};
const uint8_t x8x8_len[] = {
1, /* nul */
8, /* diamond */
5, /* multiline marker */
6, /* arrow left */
6, /* arrow right */
8, /* pi */
8, /* micro */
8, /* omega */
6, /* degree */
4, /* 0x20 ' ' */
5, /* 0x21 '!' */
6, /* 0x22 '"' */
8, /* 0x23 '#' */
7, /* 0x24 '$' */
8, /* 0x25 '%' */
8, /* 0x26 '&' */
4, /* 0x27 ''' */
5, /* 0x28 '(' */
5, /* 0x29 ')' */
9, /* 0x2A '*' */
7, /* 0x2B '+' */
4, /* 0x2C ',' */
7, /* 0x2D '-' */
3, /* 0x2E '.' */
8, /* 0x2F '/' */
7, /* 0x30 '0' */
7, /* 0x31 '1' */
7, /* 0x32 '2' */
7, /* 0x33 '3' */
8, /* 0x34 '4' */
7, /* 0x35 '5' */
7, /* 0x36 '6' */
7, /* 0x37 '7' */
7, /* 0x38 '8' */
7, /* 0x39 '9' */
3, /* 0x3A ':' */
4, /* 0x3B ';' */
6, /* 0x3C '<' */
7, /* 0x3D '=' */
6, /* 0x3E '>' */
7, /* 0x3F '?' */
8, /* 0x40 '@' */
7, /* 0x41 'A' */
8, /* 0x42 'B' */
8, /* 0x43 'C' */
8, /* 0x44 'D' */
8, /* 0x45 'E' */
8, /* 0x46 'F' */
8, /* 0x47 'G' */
7, /* 0x48 'H' */
5, /* 0x49 'I' */
8, /* 0x4A 'J' */
8, /* 0x4B 'K' */
8, /* 0x4C 'L' */
8, /* 0x4D 'M' */
8, /* 0x4E 'N' */
8, /* 0x4F 'O' */
8, /* 0x50 'P' */
7, /* 0x51 'Q' */
8, /* 0x52 'R' */
7, /* 0x53 'S' */
7, /* 0x54 'T' */
7, /* 0x55 'U' */
7, /* 0x56 'V' */
8, /* 0x57 'W' */
8, /* 0x58 'X' */
7, /* 0x59 'Y' */
8, /* 0x5A 'Z' */
5, /* 0x5B '[' */
8, /* 0x5C '\' */
5, /* 0x5D ']' */
8, /* 0x5E '^' */
9, /* 0x5F '_' */
4, /* 0x60 '`' */
8, /* 0x61 'a' */
8, /* 0x62 'b' */
7, /* 0x63 'c' */
8, /* 0x64 'd' */
7, /* 0x65 'e' */
7, /* 0x66 'f' */
8, /* 0x67 'g' */
8, /* 0x68 'h' */
5, /* 0x69 'i' */
6, /* 0x6A 'j' */
8, /* 0x6B 'k' */
5, /* 0x6C 'l' */
8, /* 0x6D 'm' */
7, /* 0x6E 'n' */
7, /* 0x6F 'o' */
8, /* 0x70 'p' */
8, /* 0x71 'q' */
7, /* 0x72 'r' */
7, /* 0x73 's' */
6, /* 0x74 't' */
8, /* 0x75 'u' */
7, /* 0x76 'v' */
8, /* 0x77 'w' */
8, /* 0x78 'x' */
7, /* 0x79 'y' */
7, /* 0x7A 'z' */
7, /* 0x7B '{' */
3, /* 0x7C '|' */
7, /* 0x7D '}' */
8, /* 0x7E '~' */
8, /* 0x7F '' */
};
uint8_t x8x8_map_char_table(uint8_t ch)
{
if ( ch > 0x7f )
{
/* limit to largest character */
ch = 0x7f - 32 + 9;
}
else if ( ch >= 32 )
{
/* normal character */
ch = ch - 32 + 9;
}
else
{
/* special character */
}
return ch;
}

View file

@ -120,7 +120,7 @@ CSRC = $(STARTUPSRC) \
$(STREAMSSRC) \
$(SHELLSRC) \
usbcfg.c \
main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x24.c Font5x7.c flash.c adc.c
main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x24.c Font5x7.c Font8x8.c flash.c adc.c
# $(TESTSRC) \

265
ili9341.c
View file

@ -21,12 +21,12 @@
#include "hal.h"
#include "nanovna.h"
#define RESET_ASSERT palClearPad(GPIOA, 15)
#define RESET_NEGATE palSetPad(GPIOA, 15)
#define CS_LOW palClearPad(GPIOB, 6)
#define CS_HIGH palSetPad(GPIOB, 6)
#define DC_CMD palClearPad(GPIOB, 7)
#define DC_DATA palSetPad(GPIOB, 7)
#define RESET_ASSERT palClearPad(GPIOA, 15)
#define RESET_NEGATE palSetPad(GPIOA, 15)
#define CS_LOW palClearPad(GPIOB, 6)
#define CS_HIGH palSetPad(GPIOB, 6)
#define DC_CMD palClearPad(GPIOB, 7)
#define DC_DATA palSetPad(GPIOB, 7)
uint16_t spi_buffer[1024];
@ -124,88 +124,88 @@ spi_init(void)
void
send_command(uint8_t cmd, int len, const uint8_t *data)
{
CS_LOW;
DC_CMD;
CS_LOW;
DC_CMD;
ssp_databit8();
ssp_senddata(cmd);
DC_DATA;
while (len-- > 0) {
ssp_senddata(cmd);
DC_DATA;
while (len-- > 0) {
ssp_senddata(*data++);
}
//CS_HIGH;
}
//CS_HIGH;
}
void
send_command16(uint8_t cmd, int data)
{
CS_LOW;
DC_CMD;
CS_LOW;
DC_CMD;
ssp_databit8();
ssp_senddata(cmd);
DC_DATA;
ssp_senddata(cmd);
DC_DATA;
ssp_databit16();
ssp_senddata16(data);
CS_HIGH;
ssp_senddata16(data);
CS_HIGH;
}
const uint8_t ili9341_init_seq[] = {
// cmd, len, data...,
// Power control B
0xCF, 3, 0x00, 0x83, 0x30,
// Power on sequence control
0xED, 4, 0x64, 0x03, 0x12, 0x81,
//0xED, 4, 0x55, 0x01, 0x23, 0x01,
// Driver timing control A
0xE8, 3, 0x85, 0x01, 0x79,
//0xE8, 3, 0x84, 0x11, 0x7a,
// Power control A
0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02,
// Pump ratio control
0xF7, 1, 0x20,
// Driver timing control B
0xEA, 2, 0x00, 0x00,
// POWER_CONTROL_1
0xC0, 1, 0x26,
// POWER_CONTROL_2
0xC1, 1, 0x11,
// VCOM_CONTROL_1
0xC5, 2, 0x35, 0x3E,
// VCOM_CONTROL_2
0xC7, 1, 0xBE,
// MEMORY_ACCESS_CONTROL
//0x36, 1, 0x48, // portlait
0x36, 1, 0x28, // landscape
// COLMOD_PIXEL_FORMAT_SET : 16 bit pixel
0x3A, 1, 0x55,
// Frame Rate
0xB1, 2, 0x00, 0x1B,
// Gamma Function Disable
0xF2, 1, 0x08,
// gamma set for curve 01/2/04/08
0x26, 1, 0x01,
// positive gamma correction
0xE0, 15, 0x1F, 0x1A, 0x18, 0x0A, 0x0F, 0x06, 0x45, 0x87, 0x32, 0x0A, 0x07, 0x02, 0x07, 0x05, 0x00,
// negativ gamma correction
0xE1, 15, 0x00, 0x25, 0x27, 0x05, 0x10, 0x09, 0x3A, 0x78, 0x4D, 0x05, 0x18, 0x0D, 0x38, 0x3A, 0x1F,
// cmd, len, data...,
// Power control B
0xCF, 3, 0x00, 0x83, 0x30,
// Power on sequence control
0xED, 4, 0x64, 0x03, 0x12, 0x81,
//0xED, 4, 0x55, 0x01, 0x23, 0x01,
// Driver timing control A
0xE8, 3, 0x85, 0x01, 0x79,
//0xE8, 3, 0x84, 0x11, 0x7a,
// Power control A
0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02,
// Pump ratio control
0xF7, 1, 0x20,
// Driver timing control B
0xEA, 2, 0x00, 0x00,
// POWER_CONTROL_1
0xC0, 1, 0x26,
// POWER_CONTROL_2
0xC1, 1, 0x11,
// VCOM_CONTROL_1
0xC5, 2, 0x35, 0x3E,
// VCOM_CONTROL_2
0xC7, 1, 0xBE,
// MEMORY_ACCESS_CONTROL
//0x36, 1, 0x48, // portlait
0x36, 1, 0x28, // landscape
// COLMOD_PIXEL_FORMAT_SET : 16 bit pixel
0x3A, 1, 0x55,
// Frame Rate
0xB1, 2, 0x00, 0x1B,
// Gamma Function Disable
0xF2, 1, 0x08,
// gamma set for curve 01/2/04/08
0x26, 1, 0x01,
// positive gamma correction
0xE0, 15, 0x1F, 0x1A, 0x18, 0x0A, 0x0F, 0x06, 0x45, 0x87, 0x32, 0x0A, 0x07, 0x02, 0x07, 0x05, 0x00,
// negativ gamma correction
0xE1, 15, 0x00, 0x25, 0x27, 0x05, 0x10, 0x09, 0x3A, 0x78, 0x4D, 0x05, 0x18, 0x0D, 0x38, 0x3A, 0x1F,
// Column Address Set
0x2A, 4, 0x00, 0x00, 0x01, 0x3f, // width 320
// Page Address Set
0x2B, 4, 0x00, 0x00, 0x00, 0xef, // height 240
// Column Address Set
0x2A, 4, 0x00, 0x00, 0x01, 0x3f, // width 320
// Page Address Set
0x2B, 4, 0x00, 0x00, 0x00, 0xef, // height 240
// entry mode
0xB7, 1, 0x06,
// display function control
0xB6, 4, 0x0A, 0x82, 0x27, 0x00,
// entry mode
0xB7, 1, 0x06,
// display function control
0xB6, 4, 0x0A, 0x82, 0x27, 0x00,
// control display
//0x53, 1, 0x0c,
// diaplay brightness
//0x51, 1, 0xff,
// control display
//0x53, 1, 0x0c,
// diaplay brightness
//0x51, 1, 0xff,
// sleep out
0x11, 0,
0 // sentinel
// sleep out
0x11, 0,
0 // sentinel
};
void
@ -235,10 +235,10 @@ ili9341_init(void)
void ili9341_pixel(int x, int y, int color)
{
uint8_t xx[4] = { x >> 8, x, (x+1) >> 8, (x+1) };
uint8_t yy[4] = { y >> 8, y, (y+1) >> 8, (y+1) };
uint8_t cc[2] = { color >> 8, color };
send_command(0x2A, 4, xx);
uint8_t xx[4] = { x >> 8, x, (x+1) >> 8, (x+1) };
uint8_t yy[4] = { y >> 8, y, (y+1) >> 8, (y+1) };
uint8_t cc[2] = { color >> 8, color };
send_command(0x2A, 4, xx);
send_command(0x2B, 4, yy);
send_command(0x2C, 2, cc);
//send_command16(0x2C, color);
@ -248,10 +248,10 @@ void ili9341_pixel(int x, int y, int color)
void ili9341_fill(int x, int y, int w, int h, int color)
{
uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
int len = w * h;
send_command(0x2A, 4, xx);
send_command(0x2A, 4, xx);
send_command(0x2B, 4, yy);
send_command(0x2C, 0, NULL);
while (len-- > 0)
@ -261,26 +261,26 @@ void ili9341_fill(int x, int y, int w, int h, int color)
#if 0
void ili9341_bulk(int x, int y, int w, int h)
{
uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint16_t *buf = spi_buffer;
uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint16_t *buf = spi_buffer;
int len = w * h;
send_command(0x2A, 4, xx);
send_command(0x2B, 4, yy);
send_command(0x2C, 0, NULL);
send_command(0x2A, 4, xx);
send_command(0x2B, 4, yy);
send_command(0x2C, 0, NULL);
while (len-- > 0)
ssp_senddata16(*buf++);
}
#else
void ili9341_bulk(int x, int y, int w, int h)
{
uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
int len = w * h;
send_command(0x2A, 4, xx);
send_command(0x2B, 4, yy);
send_command(0x2C, 0, NULL);
send_command(0x2A, 4, xx);
send_command(0x2B, 4, yy);
send_command(0x2C, 0, NULL);
dmaStreamSetMemory0(dmatx, spi_buffer);
dmaStreamSetTransactionSize(dmatx, len);
@ -407,6 +407,63 @@ ili9341_drawstring_size(const char *str, int x, int y, uint16_t fg, uint16_t bg,
}
}
unsigned char
ili9341_drawchar_8x8(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg)
{
uint16_t *buf = spi_buffer;
uint16_t bits;
int cline, r;
ch = x8x8_map_char_table(ch);
for(cline = 0; cline < 8; cline++)
{
bits = x8x8_bits[ch][cline];
for (r = 7; r >= 0; r--)
{
*buf++ = (0x80 & bits) ? fg : bg;
bits <<= 1;
}
//*buf++ = bg;
}
ili9341_bulk(x, y, 8, 8);
return x8x8_len[ch];
}
void
ili9341_drawstring_8x8(const char *str, int x, int y, uint16_t fg, uint16_t bg)
{
while (*str)
{
(void)ili9341_drawchar_8x8(*str, x, y, fg, bg);
x += 8;
str++;
}
}
void
ili9341_drawstring_8x8_var(const char *str, int x, int y, uint16_t fg, uint16_t bg)
{
unsigned char clength = 0;
while (*str)
{
clength = ili9341_drawchar_8x8(*str, x, y, fg, bg);
x += clength;
str++;
}
}
#define SWAP(x,y) do { int z=x; x = y; y = z; } while(0)
void
@ -452,20 +509,20 @@ const font_t NF20x24 = { 20, 24, 1, 24, (const uint32_t *)numfont20x24 };
void
ili9341_drawfont(uint8_t ch, const font_t *font, int x, int y, uint16_t fg, uint16_t bg)
{
uint16_t *buf = spi_buffer;
uint32_t bits;
const uint32_t *bitmap = &font->bitmap[font->slide * ch];
int c, r, j;
uint16_t *buf = spi_buffer;
uint32_t bits;
const uint32_t *bitmap = &font->bitmap[font->slide * ch];
int c, r, j;
for (c = 0; c < font->slide; c++) {
for (j = 0; j < font->scaley; j++) {
bits = bitmap[c];
for (r = 0; r < font->width; r++) {
*buf++ = (0x80000000UL & bits) ? fg : bg;
bits <<= 1;
}
}
}
for (c = 0; c < font->slide; c++) {
for (j = 0; j < font->scaley; j++) {
bits = bitmap[c];
for (r = 0; r < font->width; r++) {
*buf++ = (0x80000000UL & bits) ? fg : bg;
bits <<= 1;
}
}
}
ili9341_bulk(x, y, font->width, font->height);
}
@ -503,7 +560,7 @@ ili9341_test(int mode)
#endif
#if 1
case 3:
for (i = 0; i < 10; i++)
for (i = 0; i < 10; i++)
ili9341_drawfont(i, &NF20x24, i*20, 120, colormap[i%6], 0x0000);
break;
#endif

48
main.c
View file

@ -109,25 +109,25 @@ toggle_sweep(void)
}
float bessel0(float x) {
const float eps = 0.0001;
const float eps = 0.0001;
float ret = 0;
float term = 1;
float m = 0;
float ret = 0;
float term = 1;
float m = 0;
while (term > eps * ret) {
ret += term;
++m;
term *= (x*x) / (4*m*m);
}
while (term > eps * ret) {
ret += term;
++m;
term *= (x*x) / (4*m*m);
}
return ret;
return ret;
}
float kaiser_window(float k, float n, float beta) {
if (beta == 0.0) return 1.0;
float r = (2 * k) / (n - 1) - 1;
return bessel0(beta * sqrt(1 - r * r)) / bessel0(beta);
if (beta == 0.0) return 1.0;
float r = (2 * k) / (n - 1) - 1;
return bessel0(beta * sqrt(1 - r * r)) / bessel0(beta);
}
static
@ -1379,17 +1379,17 @@ const struct {
uint16_t refpos;
float scale_unit;
} trace_info[] = {
{ "LOGMAG", 7, 10 },
{ "PHASE", 4, 90 },
{ "DELAY", 4, 1 },
{ "SMITH", 0, 1 },
{ "POLAR", 0, 1 },
{ "LINEAR", 0, 0.125 },
{ "SWR", 0, 1 },
{ "REAL", 4, 0.25 },
{ "IMAG", 4, 0.25 },
{ "R", 0, 100 },
{ "X", 4, 100 }
{ "LGMG", 7, 10 },
{ "PHA", 4, 90 },
{ "DEL", 4, 1 },
{ "SMI", 0, 1 },
{ "PLR", 0, 1 },
{ "LIN", 0, 0.125 },
{ "SWR", 0, 1 },
{ "REAL", 4, 0.25 },
{ "IMAG", 4, 0.25 },
{ "R", 0, 100 },
{ "X", 4, 100 }
};
const char * const trc_channel_name[] = {

View file

@ -138,6 +138,8 @@ extern void tlv320aic3204_adc_filter_enable(int enable);
#define HEIGHT 233
#define CELLOFFSETX 5
#define CELLOFFSETX_8x8 8
#define AREA_WIDTH_NORMAL (WIDTH + CELLOFFSETX*2)
extern int area_width;
@ -147,17 +149,22 @@ extern int area_height;
// font
extern const uint8_t x5x7_bits [];
extern const uint8_t x5x7_bits[];
extern const uint8_t x8x8_bits[][8];
extern const uint8_t x8x8_len[];
extern const uint32_t numfont20x24[][24];
#define S_PI "\003"
#define S_MICRO "\004"
#define S_OHM "\005"
#define S_DEGREE "\006"
#define S_LARROW "\001"
#define S_RARROW "\002"
#define S_DIAMOND "\001"
#define S_MULTIL "\002"
#define S_PI "\005"
#define S_MICRO "\006"
#define S_OHM "\007"
#define S_DEGREE "\010"
#define S_LARROW "\003"
#define S_RARROW "\004"
extern uint8_t x5x7_map_char_table(uint8_t ch);
extern uint8_t x8x8_map_char_table(uint8_t ch);
@ -275,6 +282,9 @@ void ili9341_drawchar_5x7(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawstring_5x7(const char *str, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size);
void ili9341_drawstring_size(const char *str, int x, int y, uint16_t fg, uint16_t bg, uint8_t size);
unsigned char ili9341_drawchar_8x8(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawstring_8x8(const char *str, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawstring_8x8_var(const char *str, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawfont(uint8_t ch, const font_t *font, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_read_memory(int x, int y, int w, int h, int len, uint16_t* out);
void ili9341_read_memory_continue(int len, uint16_t* out);

137
plot.c
View file

@ -1369,29 +1369,133 @@ cell_drawstring_invert_5x7(int w, int h, char *str, int x, int y, uint16_t fg, i
unsigned char
cell_drawchar_8x8(int w, int h, uint8_t ch, int x, int y, uint16_t fg, uint8_t var, int invert)
{
uint8_t bits, charlen = 8;
int cline, r;
if (y <= -8 || y >= h || x <= -8 || x >= w)
return 0;
ch = x8x8_map_char_table(ch);
for (cline = 0; cline < 8; cline++)
{
if ((y + cline) < 0 || (y + cline) >= h)
continue;
bits = x8x8_bits[ch][cline];
if (invert)
bits = ~bits;
if ( var != FALSE )
{
charlen = x8x8_len[ch];
}
for (r = 0; r < charlen; r++)
{
if ( (x+r) >= 0 && (x+r) < w && (0x80 & bits) )
spi_buffer[(y+cline)*w + (x+r)] = fg;
bits <<= 1;
}
}
return x8x8_len[ch];
}
void
cell_drawstring_8x8(int w, int h, char *str, int x, int y, uint16_t fg)
{
while (*str)
{
cell_drawchar_8x8(w, h, *str, x, y, fg, FALSE, FALSE);
x += 8;
str++;
}
}
void
cell_drawstring_invert_8x8(int w, int h, char *str, int x, int y, uint16_t fg, int invert)
{
while (*str)
{
cell_drawchar_8x8(w, h, *str, x, y, fg, FALSE, invert);
x += 8;
str++;
}
}
void
cell_drawstring_8x8_var(int w, int h, char *str, int x, int y, uint16_t fg)
{
unsigned char clength = 0;
while (*str)
{
clength = cell_drawchar_8x8(w, h, *str, x, y, fg, TRUE, FALSE);
x += clength;
str++;
}
}
void
cell_drawstring_invert_8x8_var(int w, int h, char *str, int x, int y, uint16_t fg, int invert)
{
unsigned char clength = 0;
while (*str)
{
clength = cell_drawchar_8x8(w, h, *str, x, y, fg, TRUE, invert);
x += clength;
str++;
}
}
static void
cell_draw_marker_info(int m, int n, int w, int h)
{
char buf[24];
int t;
if (n != 0)
return;
if (active_marker < 0)
return;
int idx = markers[active_marker].index;
int j = 0;
for (t = 0; t < TRACES_MAX; t++) {
for (t = 0; t < TRACES_MAX; t++)
{
if (!trace[t].enabled)
continue;
int xpos = 1 + (j%2)*146;
int ypos = 1 + (j/2)*7;
xpos -= m * CELLWIDTH -CELLOFFSETX;
int ypos = 1 + (j/2)*8;
xpos -= m * CELLWIDTH - CELLOFFSETX;
ypos -= n * CELLHEIGHT;
chsnprintf(buf, sizeof buf, "CH%d", trace[t].channel);
chsnprintf(buf, sizeof buf, "CH%d:", trace[t].channel);
cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, config.trace_color[t], t == uistat.current_trace);
xpos += 20;
trace_get_info(t, buf, sizeof buf);
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
xpos += 64;
trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel][idx], frequencies[idx]);
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
@ -1400,26 +1504,31 @@ cell_draw_marker_info(int m, int n, int w, int h)
// draw marker frequency
int xpos = 192;
int ypos = 1 + (j/2)*7;
int ypos = 1 + (j/2)*8;
xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos -= n * CELLHEIGHT;
chsnprintf(buf, sizeof buf, "%d:", active_marker + 1);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
xpos += 16;
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) {
frequency_string(buf, sizeof buf, frequencies[idx]);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
} else {
chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9), distance_of_index(idx));
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
if ( (domain_mode & DOMAIN_MODE) == DOMAIN_FREQ )
{
frequency_string(buf, sizeof buf, frequencies[idx]);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
}
else
{
chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9), distance_of_index(idx));
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
}
// draw marker delta
if (previous_marker >= 0 && active_marker != previous_marker && markers[previous_marker].enabled) {
if ( previous_marker >= 0 && active_marker != previous_marker && markers[previous_marker].enabled )
{
int idx0 = markers[previous_marker].index;
xpos = 192;
xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos += 7;
ypos += 8;
chsnprintf(buf, sizeof buf, "\001%d:", previous_marker+1);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
xpos += 16;
@ -1428,6 +1537,8 @@ cell_draw_marker_info(int m, int n, int w, int h)
}
}
void
frequency_string(char *buf, size_t len, int32_t freq)
{

78
ui.c
View file

@ -404,6 +404,11 @@ show_version(void)
ili9341_drawstring_5x7("Architecture: " PORT_ARCHITECTURE_NAME " Core Variant: " PORT_CORE_VARIANT_NAME, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_5x7("Port Info: " PORT_INFO, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_5x7("Platform: " PLATFORM_NAME, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8("Hello world" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8_var("Hello world" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8_var("ABCDEFGHIJKL MNOPQRSTUVWXYZ" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8_var("abcdefghijkl mnopqrstuvwxyz" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8_var("0123456790" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
while (true) {
if (touch_check() == EVT_TOUCH_PRESSED)
@ -877,10 +882,10 @@ const menuitem_t menu_save[] = {
};
const menuitem_t menu_cal[] = {
{ MT_SUBMENU, "CALIBRATE", menu_calop },
{ MT_SUBMENU, S_RARROW" CALIBR", menu_calop },
{ MT_SUBMENU, "SAVE", menu_save },
{ MT_CALLBACK, "RESET", menu_cal2_cb },
{ MT_CALLBACK, "CORRECTION", menu_cal2_cb },
{ MT_CALLBACK, "Correct.", menu_cal2_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -899,8 +904,8 @@ const menuitem_t menu_format2[] = {
{ MT_CALLBACK, "LINEAR", menu_format2_cb },
{ MT_CALLBACK, "REAL", menu_format2_cb },
{ MT_CALLBACK, "IMAG", menu_format2_cb },
{ MT_CALLBACK, "RESISTANCE", menu_format2_cb },
{ MT_CALLBACK, "REACTANCE", menu_format2_cb },
{ MT_CALLBACK, "RESIST.", menu_format2_cb },
{ MT_CALLBACK, "REACT.", menu_format2_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -919,17 +924,17 @@ const menuitem_t menu_format[] = {
};
const menuitem_t menu_scale[] = {
{ MT_CALLBACK, "SCALE/DIV", menu_scale_cb },
{ MT_CALLBACK, "\2REFERENCE\0POSITION", menu_scale_cb },
{ MT_CALLBACK, "\2ELECTRICAL\0DELAY", menu_scale_cb },
{ MT_CALLBACK, "Scle/Div", menu_scale_cb },
{ MT_CALLBACK, "\2Rfrnce\0Position", menu_scale_cb },
{ MT_CALLBACK, "\2Electr.\0Delay", menu_scale_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
const menuitem_t menu_channel[] = {
{ MT_CALLBACK, "\2CH0\0REFLECT", menu_channel_cb },
{ MT_CALLBACK, "\2CH1\0THROUGH", menu_channel_cb },
{ MT_CALLBACK, "\2CH 0\0REFLECT", menu_channel_cb },
{ MT_CALLBACK, "\2CH 1\0THROUGH", menu_channel_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -943,12 +948,12 @@ const menuitem_t menu_transform_window[] = {
};
const menuitem_t menu_transform[] = {
{ MT_CALLBACK, "\2TRANSFORM\0ON", menu_transform_cb },
{ MT_CALLBACK, "\2LOW PASS\0IMPULSE", menu_transform_cb },
{ MT_CALLBACK, "\2LOW PASS\0STEP", menu_transform_cb },
{ MT_CALLBACK, "BANDPASS", menu_transform_cb },
{ MT_CALLBACK, "\2TRANSFO\0ON", menu_transform_cb },
{ MT_CALLBACK, "\2LOWPASS\0IMPULSE", menu_transform_cb },
{ MT_CALLBACK, "\2LOWPASS\0STEP", menu_transform_cb },
{ MT_CALLBACK, "BANDP.", menu_transform_cb },
{ MT_SUBMENU, "WINDOW", menu_transform_window },
{ MT_CALLBACK, "\2VELOCITY\0FACTOR", menu_transform_cb },
{ MT_CALLBACK, "\2Velocity\0FACTOR", menu_transform_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -958,7 +963,7 @@ const menuitem_t menu_display[] = {
{ MT_SUBMENU, "FORMAT", menu_format },
{ MT_SUBMENU, "SCALE", menu_scale },
{ MT_SUBMENU, "CHANNEL", menu_channel },
{ MT_SUBMENU, "TRANSFORM", menu_transform },
{ MT_SUBMENU, "TRNSFRM", menu_transform },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -995,27 +1000,27 @@ const menuitem_t menu_marker[] = {
};
const menuitem_t menu_recall[] = {
{ MT_CALLBACK, "RECALL 0", menu_recall_cb },
{ MT_CALLBACK, "RECALL 1", menu_recall_cb },
{ MT_CALLBACK, "RECALL 2", menu_recall_cb },
{ MT_CALLBACK, "RECALL 3", menu_recall_cb },
{ MT_CALLBACK, "RECALL 4", menu_recall_cb },
{ MT_CALLBACK, "RECALL0", menu_recall_cb },
{ MT_CALLBACK, "RECALL1", menu_recall_cb },
{ MT_CALLBACK, "RECALL2", menu_recall_cb },
{ MT_CALLBACK, "RECALL3", menu_recall_cb },
{ MT_CALLBACK, "RECALL4", menu_recall_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
const menuitem_t menu_dfu[] = {
{ MT_CALLBACK, "\2RESET AND\0ENTER DFU", menu_dfu_cb },
{ MT_CANCEL, S_LARROW"CANCEL", NULL },
{ MT_CALLBACK, "\2RESET+\0Ent DFU", menu_dfu_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
const menuitem_t menu_config[] = {
{ MT_CALLBACK, "TOUCH CAL", menu_config_cb },
{ MT_CALLBACK, "TOUCH TEST", menu_config_cb },
{ MT_CALLBACK, "\2TOUCH\0CAL", menu_config_cb },
{ MT_CALLBACK, "\2TOUCH\0TEST", menu_config_cb },
{ MT_CALLBACK, "SAVE", menu_config_cb },
{ MT_CALLBACK, "VERSION", menu_config_cb },
{ MT_SUBMENU, S_RARROW"DFU", menu_dfu },
{ MT_SUBMENU, " " S_RARROW " DFU", menu_dfu },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -1341,30 +1346,41 @@ void
draw_menu_buttons(const menuitem_t *menu)
{
int i = 0;
for (i = 0; i < 7; i++) {
for (i = 0; i < 7; i++)
{
const char *l1, *l2;
if (menu[i].type == MT_NONE)
break;
if (menu[i].type == MT_BLANK)
continue;
int y = 32*i;
uint16_t bg = config.menu_normal_color;
uint16_t fg = 0x0000;
// focus only in MENU mode but not in KEYPAD mode
if (ui_mode == UI_MENU && i == selection)
bg = config.menu_active_color;
ili9341_fill(320-60, y, 60, 30, bg);
menu_item_modify_attribute(menu, i, &fg, &bg);
if (menu_is_multiline(menu[i].label, &l1, &l2)) {
ili9341_drawstring_5x7(l1, 320-54, y+8, fg, bg);
ili9341_drawstring_5x7(l2, 320-54, y+15, fg, bg);
} else {
ili9341_drawstring_5x7(menu[i].label, 320-54, y+12, fg, bg);
if (menu_is_multiline(menu[i].label, &l1, &l2))
{
ili9341_drawstring_8x8_var(l1, 320-57, y+7, fg, bg);
ili9341_drawstring_8x8_var(l2, 320-57, y+16, fg, bg);
}
else
{
ili9341_drawstring_8x8_var(menu[i].label, 320-57, y+12, fg, bg);
}
}
}
void
menu_select_touch(int i)
{