diff --git a/Font5x7.c b/Font5x7.c deleted file mode 100644 index ee4f40bd..00000000 --- a/Font5x7.c +++ /dev/null @@ -1,2565 +0,0 @@ -/* Generated by convbdf on Tue Oct 3 00:24:24 MDT 2000. */ -/* Font information: - name: "-Misc-Fixed-Medium-R-Normal--7-70-75-75-C-50-ISO8859-1" - pixel size: 7 - ascent: 6 - descent: 1 -*/ - -#include - -/* Font character bitmap data. */ -const uint8_t x5x7_bits [] = -{ - - /* Character (0x00): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |**** | - |**** | - |**** | - |**** | - |**** | - |**** | - | | - +----------------+ */ - 0xf0, - 0xf0, - 0xf0, - 0xf0, - 0xf0, - 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 (0x03): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |*** | - |* * | - |* * | - | *** | - | * | - | * | - +----------------+ */ - 0xa0, - 0xe0, - 0xa0, - 0xa0, - 0x70, - 0x20, - 0x20, - - /* Character (0x04): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | ** | - | * * | - | * * | - |* * | - |**** | - | | - +----------------+ */ - 0x10, - 0x30, - 0x50, - 0x50, - 0x90, - 0xF0, - 0x00, - - /* Character (0x05): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |** | - |* | - |** | - | ** | - | * * | - | ** | - | * * | - +----------------+ */ - 0xc0, - 0x80, - 0xc0, - 0x60, - 0x50, - 0x60, - 0x50, - - /* Character (0x06): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* | - |* | - |** | - | ** | - | * | - | ** | - | * | - +----------------+ */ - 0x80, - 0x80, - 0xc0, - 0x30, - 0x20, - 0x30, - 0x20, - - /* Character (0x07): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * * | - | * | - | | - | | - | | - | | - +----------------+ */ - 0x20, - 0x50, - 0x20, - 0x00, - 0x00, - 0x00, - 0x00, - - /* Character (0x08): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | *** | - | * | - | | - | *** | - | | - | | - +----------------+ */ - 0x20, - 0x70, - 0x20, - 0x00, - 0x70, - 0x00, - 0x00, - - /* Character (0x09): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |** * | - |* ** | - |* * | - | * | - | * | - | ** | - +----------------+ */ - 0x90, - 0xd0, - 0xb0, - 0x90, - 0x20, - 0x20, - 0x30, - - /* Character (0x0a): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |* * | - |* * | - | * | - | *** | - | * | - | * | - +----------------+ */ - 0xa0, - 0xa0, - 0xa0, - 0x40, - 0x70, - 0x20, - 0x20, - - /* Character (0x0b): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - |*** | - | | - | | - | | - +----------------+ */ - 0x20, - 0x20, - 0x20, - 0xe0, - 0x00, - 0x00, - 0x00, - - /* Character (0x0c): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - |*** | - | * | - | * | - | * | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0xe0, - 0x20, - 0x20, - 0x20, - - /* Character (0x0d): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - | *** | - | * | - | * | - | * | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0x38, - 0x20, - 0x20, - 0x20, - - /* Character (0x0e): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - | *** | - | | - | | - | | - +----------------+ */ - 0x20, - 0x20, - 0x20, - 0x38, - 0x00, - 0x00, - 0x00, - - /* Character (0x0f): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - |***** | - | * | - | * | - | * | - +----------------+ */ - 0x20, - 0x20, - 0x20, - 0xf8, - 0x20, - 0x20, - 0x20, - - /* Character (0x10): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - |***** | - | | - | | - | | - | | - | | - +----------------+ */ - 0x00, - 0xf8, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - - /* Character (0x11): - bbw=6, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |***** | - | | - | | - | | - | | - +----------------+ */ - 0x00, - 0x00, - 0xf8, - 0x00, - 0x00, - 0x00, - 0x00, - - /* Character (0x12): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - |***** | - | | - | | - | | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0xf8, - 0x00, - 0x00, - 0x00, - - /* Character (0x13): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - | | - |***** | - | | - | | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0x00, - 0xf8, - 0x00, - 0x00, - - /* Character (0x14): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - | | - | | - |***** | - | | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xf8, - 0x00, - - /* Character (0x15): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - | *** | - | * | - | * | - | * | - +----------------+ */ - 0x20, - 0x20, - 0x20, - 0x38, - 0x20, - 0x20, - 0x20, - - /* Character (0x16): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - |*** | - | * | - | * | - | * | - +----------------+ */ - 0x20, - 0x20, - 0x20, - 0xe0, - 0x20, - 0x20, - 0x20, - - /* Character (0x17): - bbw=6, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - |***** | - | | - | | - | | - +----------------+ */ - 0x20, - 0x20, - 0x20, - 0xf8, - 0x00, - 0x00, - 0x00, - - /* Character (0x18): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - |***** | - | * | - | * | - | * | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0xf8, - 0x20, - 0x20, - 0x20, - - /* Character (0x19): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - | * | - | * | - | * | - | * | - +----------------+ */ - 0x20, - 0x20, - 0x20, - 0x20, - 0x20, - 0x20, - 0x20, - - /* Character (0x1a): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - |**** | - | * | - | * | - | | - | | - +----------------+ */ - 0x20, - 0x40, - 0xF8, - 0x40, - 0x20, - 0x00, - 0x00, - - /* Character (0x1b): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - |***** | - | * | - | * | - | | - | | - +----------------+ */ - 0x20, - 0x10, - 0xF8, - 0x10, - 0x20, - 0x00, - 0x00, - - /* Character (0x1c): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |***** | - | * * | - | * * | - |* ** | - | | - +----------------+ */ - 0x00, - 0x00, - 0xf8, - 0x50, - 0x50, - 0x98, - 0x00, - - /* Character (0x1d): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |* * | - |* * | - |* * | - |*** | - |* | - +----------------+ */ - 0x00, - 0x00, - 0x90, - 0x90, - 0x90, - 0xe0, - 0x80, - - /* Character (0x1e): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | *** | - |* * | - |* * | - | * * | - |** ** | - | | - +----------------+ */ - 0x00, - 0x70, - 0x88, - 0x88, - 0x50, - 0xb8, - 0x00, - - /* Character (0x1f): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - |* * | - | ** | - | | - | | - | | - +----------------+ */ - 0x60, - 0x90, - 0x90, - 0x60, - 0x00, - 0x00, - 0x00, - - /* Character (0x20): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - | | - | | - | | - | | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - - /* Character (0x21): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - | * | - | | - | * | - | | - +----------------+ */ - 0x20, - 0x20, - 0x20, - 0x20, - 0x00, - 0x20, - 0x00, - - /* Character (0x22): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * * | - | * * | - | * * | - | | - | | - | | - | | - +----------------+ */ - 0x50, - 0x50, - 0x50, - 0x00, - 0x00, - 0x00, - 0x00, - - /* Character (0x23): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | * * | - |***** | - | * * | - |***** | - | * * | - | | - +----------------+ */ - 0x00, - 0x50, - 0xf8, - 0x50, - 0xf8, - 0x50, - 0x00, - - /* Character (0x24): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | *** | - |* * | - | *** | - | * * | - | *** | - | | - +----------------+ */ - 0x00, - 0x70, - 0xa0, - 0x70, - 0x28, - 0x70, - 0x00, - - /* Character (0x25): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* | - |* * | - | * | - | * | - |* * | - | * | - | | - +----------------+ */ - 0x80, - 0x90, - 0x20, - 0x40, - 0x90, - 0x10, - 0x00, - - /* Character (0x26): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | * | - |* * | - | * | - |* * | - | * * | - | | - +----------------+ */ - 0x00, - 0x40, - 0xa0, - 0x40, - 0xa0, - 0x50, - 0x00, - - /* Character (0x27): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - | * | - |* | - | | - | | - | | - | | - +----------------+ */ - 0x60, - 0x40, - 0x80, - 0x00, - 0x00, - 0x00, - 0x00, - - /* Character (0x28): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - | * | - | * | - | * | - | | - +----------------+ */ - 0x20, - 0x40, - 0x40, - 0x40, - 0x40, - 0x20, - 0x00, - - /* Character (0x29): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - | * | - | * | - | * | - | | - +----------------+ */ - 0x40, - 0x20, - 0x20, - 0x20, - 0x20, - 0x40, - 0x00, - - /* Character (0x2a): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - |* * | - | * | - |*** | - | * | - |* * | - | | - +----------------+ */ - 0x00, - 0xa0, - 0x40, - 0xe0, - 0x40, - 0xa0, - 0x00, - - /* Character (0x2b): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | * | - | * | - |***** | - | * | - | * | - | | - +----------------+ */ - 0x00, - 0x20, - 0x20, - 0xf8, - 0x20, - 0x20, - 0x00, - - /* Character (0x2c): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - | | - | ** | - | * | - |* | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x60, - 0x40, - 0x80, - - /* Character (0x2d): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - |**** | - | | - | | - | | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0xf0, - 0x00, - 0x00, - 0x00, - - /* Character (0x2e): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - | | - | ** | - | ** | - | | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x60, - 0x60, - 0x00, - - /* Character (0x2f): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | * | - | * | - | * | - |* | - | | - | | - +----------------+ */ - 0x00, - 0x10, - 0x20, - 0x40, - 0x80, - 0x00, - 0x00, - - /* Character (0x30): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - |* ** | - |** * | - |* * | - | ** | - | | - +----------------+ */ - 0x60, - 0x90, - 0xb0, - 0xd0, - 0x90, - 0x60, - 0x00, - - /* Character (0x31): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - |** | - | * | - | * | - | * | - |*** | - | | - +----------------+ */ - 0x40, - 0xc0, - 0x40, - 0x40, - 0x40, - 0xe0, - 0x00, - - /* Character (0x32): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - | * | - | * | - | * | - |**** | - | | - +----------------+ */ - 0x60, - 0x90, - 0x10, - 0x20, - 0x40, - 0xf0, - 0x00, - - /* Character (0x33): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |**** | - | * | - | ** | - | * | - |* * | - | ** | - | | - +----------------+ */ - 0xf0, - 0x10, - 0x60, - 0x10, - 0x90, - 0x60, - 0x00, - - /* Character (0x34): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | ** | - |* * | - |**** | - | * | - | * | - | | - +----------------+ */ - 0x20, - 0x60, - 0xa0, - 0xf0, - 0x20, - 0x20, - 0x00, - - /* Character (0x35): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |**** | - |* | - |*** | - | * | - |* * | - | ** | - | | - +----------------+ */ - 0xf0, - 0x80, - 0xe0, - 0x10, - 0x90, - 0x60, - 0x00, - - /* Character (0x36): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* | - |*** | - |* * | - |* * | - | ** | - | | - +----------------+ */ - 0x60, - 0x80, - 0xe0, - 0x90, - 0x90, - 0x60, - 0x00, - - /* Character (0x37): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |**** | - | * | - | * | - | * | - | * | - | * | - | | - +----------------+ */ - 0xf0, - 0x10, - 0x20, - 0x20, - 0x40, - 0x40, - 0x00, - - /* Character (0x38): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - | ** | - |* * | - |* * | - | ** | - | | - +----------------+ */ - 0x60, - 0x90, - 0x60, - 0x90, - 0x90, - 0x60, - 0x00, - - /* Character (0x39): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - |* * | - | *** | - | * | - | ** | - | | - +----------------+ */ - 0x60, - 0x90, - 0x90, - 0x70, - 0x10, - 0x60, - 0x00, - - /* Character (0x3a): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | ** | - | ** | - | | - | ** | - | ** | - | | - +----------------+ */ - 0x00, - 0x60, - 0x60, - 0x00, - 0x60, - 0x60, - 0x00, - - /* Character (0x3b): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | ** | - | ** | - | | - | ** | - | * | - |* | - +----------------+ */ - 0x00, - 0x60, - 0x60, - 0x00, - 0x60, - 0x40, - 0x80, - - /* Character (0x3c): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | * | - | * | - |* | - | * | - | * | - | | - +----------------+ */ - 0x00, - 0x20, - 0x40, - 0x80, - 0x40, - 0x20, - 0x00, - - /* Character (0x3d): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |**** | - | | - |**** | - | | - | | - +----------------+ */ - 0x00, - 0x00, - 0xf0, - 0x00, - 0xf0, - 0x00, - 0x00, - - /* Character (0x3e): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - |* | - | * | - | * | - | * | - |* | - | | - +----------------+ */ - 0x00, - 0x80, - 0x40, - 0x20, - 0x40, - 0x80, - 0x00, - - /* Character (0x3f): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - |* * | - | * | - | * | - | | - | * | - | | - +----------------+ */ - 0x40, - 0xa0, - 0x20, - 0x40, - 0x00, - 0x40, - 0x00, - - /* Character (0x40): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - |* ** | - |* ** | - |* | - | ** | - | | - +----------------+ */ - 0x60, - 0x90, - 0xb0, - 0xb0, - 0x80, - 0x60, - 0x00, - - /* Character (0x41): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - |* * | - |**** | - |* * | - |* * | - | | - +----------------+ */ - 0x60, - 0x90, - 0x90, - 0xf0, - 0x90, - 0x90, - 0x00, - - /* Character (0x42): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |*** | - |* * | - |*** | - |* * | - |* * | - |*** | - | | - +----------------+ */ - 0xe0, - 0x90, - 0xe0, - 0x90, - 0x90, - 0xe0, - 0x00, - - /* Character (0x43): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - |* | - |* | - |* * | - | ** | - | | - +----------------+ */ - 0x60, - 0x90, - 0x80, - 0x80, - 0x90, - 0x60, - 0x00, - - /* Character (0x44): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |*** | - |* * | - |* * | - |* * | - |* * | - |*** | - | | - +----------------+ */ - 0xe0, - 0x90, - 0x90, - 0x90, - 0x90, - 0xe0, - 0x00, - - /* Character (0x45): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |**** | - |* | - |*** | - |* | - |* | - |**** | - | | - +----------------+ */ - 0xf0, - 0x80, - 0xe0, - 0x80, - 0x80, - 0xf0, - 0x00, - - /* Character (0x46): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |**** | - |* | - |*** | - |* | - |* | - |* | - | | - +----------------+ */ - 0xf0, - 0x80, - 0xe0, - 0x80, - 0x80, - 0x80, - 0x00, - - /* Character (0x47): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - |* | - |* ** | - |* * | - | *** | - | | - +----------------+ */ - 0x60, - 0x90, - 0x80, - 0xb0, - 0x90, - 0x70, - 0x00, - - /* Character (0x48): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |* * | - |**** | - |* * | - |* * | - |* * | - | | - +----------------+ */ - 0x90, - 0x90, - 0xf0, - 0x90, - 0x90, - 0x90, - 0x00, - - /* Character (0x49): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |*** | - | * | - | * | - | * | - | * | - |*** | - | | - +----------------+ */ - 0xe0, - 0x40, - 0x40, - 0x40, - 0x40, - 0xe0, - 0x00, - - /* Character (0x4a): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - | * | - |* * | - | ** | - | | - +----------------+ */ - 0x10, - 0x10, - 0x10, - 0x10, - 0x90, - 0x60, - 0x00, - - /* Character (0x4b): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |* * | - |** | - |** | - |* * | - |* * | - | | - +----------------+ */ - 0x90, - 0xa0, - 0xc0, - 0xc0, - 0xa0, - 0x90, - 0x00, - - /* Character (0x4c): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* | - |* | - |* | - |* | - |* | - |**** | - | | - +----------------+ */ - 0x80, - 0x80, - 0x80, - 0x80, - 0x80, - 0xf0, - 0x00, - - /* Character (0x4d): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |**** | - |**** | - |* * | - |* * | - |* * | - | | - +----------------+ */ - 0x90, - 0xf0, - 0xf0, - 0x90, - 0x90, - 0x90, - 0x00, - - /* Character (0x4e): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |** * | - |** * | - |* ** | - |* ** | - |* * | - | | - +----------------+ */ - 0x90, - 0xd0, - 0xd0, - 0xb0, - 0xb0, - 0x90, - 0x00, - - /* Character (0x4f): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - |* * | - |* * | - |* * | - | ** | - | | - +----------------+ */ - 0x60, - 0x90, - 0x90, - 0x90, - 0x90, - 0x60, - 0x00, - - /* Character (0x50): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |*** | - |* * | - |* * | - |*** | - |* | - |* | - | | - +----------------+ */ - 0xe0, - 0x90, - 0x90, - 0xe0, - 0x80, - 0x80, - 0x00, - - /* Character (0x51): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - |* * | - |* * | - |** * | - | ** | - | * | - +----------------+ */ - 0x60, - 0x90, - 0x90, - 0x90, - 0xd0, - 0x60, - 0x10, - - /* Character (0x52): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |*** | - |* * | - |* * | - |*** | - |* * | - |* * | - | | - +----------------+ */ - 0xe0, - 0x90, - 0x90, - 0xe0, - 0xa0, - 0x90, - 0x00, - - /* Character (0x53): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | ** | - |* * | - | * | - | * | - |* * | - | ** | - | | - +----------------+ */ - 0x60, - 0x90, - 0x40, - 0x20, - 0x90, - 0x60, - 0x00, - - /* Character (0x54): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |*** | - | * | - | * | - | * | - | * | - | * | - | | - +----------------+ */ - 0xe0, - 0x40, - 0x40, - 0x40, - 0x40, - 0x40, - 0x00, - - /* Character (0x55): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |* * | - |* * | - |* * | - |* * | - | ** | - | | - +----------------+ */ - 0x90, - 0x90, - 0x90, - 0x90, - 0x90, - 0x60, - 0x00, - - /* Character (0x56): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |* * | - |* * | - |* * | - | ** | - | ** | - | | - +----------------+ */ - 0x90, - 0x90, - 0x90, - 0x90, - 0x60, - 0x60, - 0x00, - - /* Character (0x57): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |* * | - |* * | - |**** | - |**** | - |* * | - | | - +----------------+ */ - 0x90, - 0x90, - 0x90, - 0xf0, - 0xf0, - 0x90, - 0x00, - - /* Character (0x58): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |* * | - | ** | - | ** | - |* * | - |* * | - | | - +----------------+ */ - 0x90, - 0x90, - 0x60, - 0x60, - 0x90, - 0x90, - 0x00, - - /* Character (0x59): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* * | - |* * | - |* * | - | * | - | * | - | * | - | | - +----------------+ */ - 0xa0, - 0xa0, - 0xa0, - 0x40, - 0x40, - 0x40, - 0x00, - - /* Character (0x5a): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |**** | - | * | - | * | - | * | - |* | - |**** | - | | - +----------------+ */ - 0xf0, - 0x10, - 0x20, - 0x40, - 0x80, - 0xf0, - 0x00, - - /* Character (0x5b): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |*** | - |* | - |* | - |* | - |* | - |*** | - | | - +----------------+ */ - 0xe0, - 0x80, - 0x80, - 0x80, - 0x80, - 0xe0, - 0x00, - - /* Character (0x5c): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - |* | - | * | - | * | - | * | - | | - | | - +----------------+ */ - 0x00, - 0x80, - 0x40, - 0x20, - 0x10, - 0x00, - 0x00, - - /* Character (0x5d): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |*** | - | * | - | * | - | * | - | * | - |*** | - | | - +----------------+ */ - 0xe0, - 0x20, - 0x20, - 0x20, - 0x20, - 0xe0, - 0x00, - - /* Character (0x5e): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - |* * | - | | - | | - | | - | | - | | - +----------------+ */ - 0x40, - 0xa0, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - - /* Character (0x5f): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | | - | | - | | - |**** | - | | - +----------------+ */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xf0, - 0x00, - - /* Character (0x60): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |** | - | * | - | * | - | | - | | - | | - | | - +----------------+ */ - 0xc0, - 0x40, - 0x20, - 0x00, - 0x00, - 0x00, - 0x00, - - /* Character (0x61): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | *** | - |* * | - |* ** | - | * * | - | | - +----------------+ */ - 0x00, - 0x00, - 0x70, - 0x90, - 0xb0, - 0x50, - 0x00, - - /* Character (0x62): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* | - |* | - |*** | - |* * | - |* * | - |*** | - | | - +----------------+ */ - 0x80, - 0x80, - 0xe0, - 0x90, - 0x90, - 0xe0, - 0x00, - - /* Character (0x63): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | ** | - |* | - |* | - | ** | - | | - +----------------+ */ - 0x00, - 0x00, - 0x60, - 0x80, - 0x80, - 0x60, - 0x00, - - /* Character (0x64): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | *** | - |* * | - |* * | - | *** | - | | - +----------------+ */ - 0x10, - 0x10, - 0x70, - 0x90, - 0x90, - 0x70, - 0x00, - - /* Character (0x65): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | ** | - |* ** | - |** | - | ** | - | | - +----------------+ */ - 0x00, - 0x00, - 0x60, - 0xb0, - 0xc0, - 0x60, - 0x00, - - /* Character (0x66): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * * | - | * | - |*** | - | * | - | * | - | | - +----------------+ */ - 0x20, - 0x50, - 0x40, - 0xe0, - 0x40, - 0x40, - 0x00, - - /* Character (0x67): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | *** | - |* * | - | ** | - |* | - | *** | - +----------------+ */ - 0x00, - 0x00, - 0x70, - 0x90, - 0x60, - 0x80, - 0x70, - - /* Character (0x68): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* | - |* | - |*** | - |* * | - |* * | - |* * | - | | - +----------------+ */ - 0x80, - 0x80, - 0xe0, - 0x90, - 0x90, - 0x90, - 0x00, - - /* Character (0x69): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | | - |** | - | * | - | * | - |*** | - | | - +----------------+ */ - 0x40, - 0x00, - 0xc0, - 0x40, - 0x40, - 0xe0, - 0x00, - - /* Character (0x6a): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | | - | * | - | * | - | * | - |* * | - | * | - +----------------+ */ - 0x20, - 0x00, - 0x20, - 0x20, - 0x20, - 0xa0, - 0x40, - - /* Character (0x6b): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* | - |* | - |* * | - |** | - |* * | - |* * | - | | - +----------------+ */ - 0x80, - 0x80, - 0xa0, - 0xc0, - 0xa0, - 0x90, - 0x00, - - /* Character (0x6c): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |** | - | * | - | * | - | * | - | * | - |*** | - | | - +----------------+ */ - 0xc0, - 0x40, - 0x40, - 0x40, - 0x40, - 0xe0, - 0x00, - - /* Character (0x6d): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |* * | - |**** | - |* * | - |* * | - | | - +----------------+ */ - 0x00, - 0x00, - 0xa0, - 0xf0, - 0x90, - 0x90, - 0x00, - - /* Character (0x6e): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |*** | - |* * | - |* * | - |* * | - | | - +----------------+ */ - 0x00, - 0x00, - 0xe0, - 0x90, - 0x90, - 0x90, - 0x00, - - /* Character (0x6f): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | ** | - |* * | - |* * | - | ** | - | | - +----------------+ */ - 0x00, - 0x00, - 0x60, - 0x90, - 0x90, - 0x60, - 0x00, - - /* Character (0x70): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |*** | - |* * | - |* * | - |*** | - |* | - +----------------+ */ - 0x00, - 0x00, - 0xe0, - 0x90, - 0x90, - 0xe0, - 0x80, - - /* Character (0x71): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | *** | - |* * | - |* * | - | *** | - | * | - +----------------+ */ - 0x00, - 0x00, - 0x70, - 0x90, - 0x90, - 0x70, - 0x10, - - /* Character (0x72): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |*** | - |* * | - |* | - |* | - | | - +----------------+ */ - 0x00, - 0x00, - 0xe0, - 0x90, - 0x80, - 0x80, - 0x00, - - /* Character (0x73): - bbw=6, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - | *** | - |** | - | ** | - |*** | - | | - +----------------+ */ - 0x00, - 0x00, - 0x70, - 0xc0, - 0x30, - 0xe0, - 0x00, - - /* Character (0x74): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - |*** | - | * | - | * | - | ** | - | | - +----------------+ */ - 0x40, - 0x40, - 0xe0, - 0x40, - 0x40, - 0x30, - 0x00, - - /* Character (0x75): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |* * | - |* * | - |* * | - | *** | - | | - +----------------+ */ - 0x00, - 0x00, - 0x90, - 0x90, - 0x90, - 0x70, - 0x00, - - /* Character (0x76): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |* * | - |* * | - |* * | - | * | - | | - +----------------+ */ - 0x00, - 0x00, - 0xa0, - 0xa0, - 0xa0, - 0x40, - 0x00, - - /* Character (0x77): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |* * | - |* * | - |**** | - |**** | - | | - +----------------+ */ - 0x00, - 0x00, - 0x90, - 0x90, - 0xf0, - 0xf0, - 0x00, - - /* Character (0x78): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |* * | - | ** | - | ** | - |* * | - | | - +----------------+ */ - 0x00, - 0x00, - 0x90, - 0x60, - 0x60, - 0x90, - 0x00, - - /* Character (0x79): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |* * | - |* * | - | * * | - | * | - | * | - +----------------+ */ - 0x00, - 0x00, - 0x90, - 0x90, - 0x50, - 0x20, - 0x40, - - /* Character (0x7a): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | | - | | - |**** | - | * | - | * | - |**** | - | | - +----------------+ */ - 0x00, - 0x00, - 0xf0, - 0x20, - 0x40, - 0xf0, - 0x00, - - /* Character (0x7b): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - |** | - | * | - | * | - | * | - | | - +----------------+ */ - 0x20, - 0x40, - 0xc0, - 0x40, - 0x40, - 0x20, - 0x00, - - /* Character (0x7c): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * | - | * | - | * | - | * | - | * | - | * | - | | - +----------------+ */ - 0x40, - 0x40, - 0x40, - 0x40, - 0x40, - 0x40, - 0x00, - - /* Character (0x7d): - bbw=6, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - |* | - | * | - | ** | - | * | - | * | - |* | - | | - +----------------+ */ - 0x80, - 0x40, - 0x60, - 0x40, - 0x40, - 0x80, - 0x00, - - /* Character (0x7e): - bbw=5, bbh=7, bbx=0, bby=-1, width=5 - +----------------+ - | * * | - |* * | - | | - | | - | | - | | - | | - +----------------+ */ - 0x50, - 0xa0, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; - -#if 0 -/* 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) */ -}; -#endif - -/* Font information structure */ -//const FONT_T font_x5x7 = {7, 0x00, 0x7E, x5x7_bits, x5x7_width}; - diff --git a/Font8x8.c b/Font8x8.c new file mode 100644 index 00000000..e193ad90 --- /dev/null +++ b/Font8x8.c @@ -0,0 +1,196 @@ +#include + +const uint8_t x8x8_bits[][8]={ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* nul */ + {0x00,0x20,0x50,0x50,0x88,0x88,0xFC,0x00}, /* delta */ + {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,0xCC,0xCC,0xCC,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 '' */ +}; + + + +static const uint8_t x8x8_len[] = { + 1 /* nul */ | 6<<4, /* delta */ + 5 /* multil. */ | 6<<4, /* left */ + 6 /* right */ | 8<<4, /* pi */ + 8 /* micro */ | 8<<4, /* omega */ + 6 /* degree */ | 4<<4, /* 0x20 ' ' */ + 5 /* 0x21 '!' */ | 6<<4, /* 0x22 '"' */ + 8 /* 0x23 '#' */ | 7<<4, /* 0x24 '$' */ + 8 /* 0x25 '%' */ | 8<<4, /* 0x26 '&' */ + 4 /* 0x27 ''' */ | 5<<4, /* 0x28 '(' */ + 5 /* 0x29 ')' */ | 9<<4, /* 0x2A '*' */ + 7 /* 0x2B '+' */ | 4<<4, /* 0x2C ',' */ + 7 /* 0x2D '-' */ | 3<<4, /* 0x2E '.' */ + 8 /* 0x2F '/' */ | 7<<4, /* 0x30 '0' */ + 7 /* 0x31 '1' */ | 7<<4, /* 0x32 '2' */ + 7 /* 0x33 '3' */ | 8<<4, /* 0x34 '4' */ + 7 /* 0x35 '5' */ | 7<<4, /* 0x36 '6' */ + 7 /* 0x37 '7' */ | 7<<4, /* 0x38 '8' */ + 7 /* 0x39 '9' */ | 3<<4, /* 0x3A ':' */ + 4 /* 0x3B ';' */ | 6<<4, /* 0x3C '<' */ + 7 /* 0x3D '=' */ | 6<<4, /* 0x3E '>' */ + 7 /* 0x3F '?' */ | 8<<4, /* 0x40 '@' */ + 7 /* 0x41 'A' */ | 8<<4, /* 0x42 'B' */ + 8 /* 0x43 'C' */ | 8<<4, /* 0x44 'D' */ + 8 /* 0x45 'E' */ | 8<<4, /* 0x46 'F' */ + 8 /* 0x47 'G' */ | 7<<4, /* 0x48 'H' */ + 5 /* 0x49 'I' */ | 8<<4, /* 0x4A 'J' */ + 8 /* 0x4B 'K' */ | 8<<4, /* 0x4C 'L' */ + 8 /* 0x4D 'M' */ | 8<<4, /* 0x4E 'N' */ + 8 /* 0x4F 'O' */ | 8<<4, /* 0x50 'P' */ + 7 /* 0x51 'Q' */ | 8<<4, /* 0x52 'R' */ + 7 /* 0x53 'S' */ | 7<<4, /* 0x54 'T' */ + 7 /* 0x55 'U' */ | 7<<4, /* 0x56 'V' */ + 8 /* 0x57 'W' */ | 8<<4, /* 0x58 'X' */ + 7 /* 0x59 'Y' */ | 8<<4, /* 0x5A 'Z' */ + 5 /* 0x5B '[' */ | 8<<4, /* 0x5C '\' */ + 5 /* 0x5D ']' */ | 8<<4, /* 0x5E '^' */ + 9 /* 0x5F '_' */ | 4<<4, /* 0x60 '`' */ + 8 /* 0x61 'a' */ | 8<<4, /* 0x62 'b' */ + 7 /* 0x63 'c' */ | 8<<4, /* 0x64 'd' */ + 7 /* 0x65 'e' */ | 7<<4, /* 0x66 'f' */ + 8 /* 0x67 'g' */ | 8<<4, /* 0x68 'h' */ + 5 /* 0x69 'i' */ | 6<<4, /* 0x6A 'j' */ + 8 /* 0x6B 'k' */ | 5<<4, /* 0x6C 'l' */ + 8 /* 0x6D 'm' */ | 7<<4, /* 0x6E 'n' */ + 7 /* 0x6F 'o' */ | 8<<4, /* 0x70 'p' */ + 8 /* 0x71 'q' */ | 7<<4, /* 0x72 'r' */ + 7 /* 0x73 's' */ | 6<<4, /* 0x74 't' */ + 8 /* 0x75 'u' */ | 7<<4, /* 0x76 'v' */ + 8 /* 0x77 'w' */ | 8<<4, /* 0x78 'x' */ + 7 /* 0x79 'y' */ | 7<<4, /* 0x7A 'z' */ + 7 /* 0x7B '{' */ | 3<<4, /* 0x7C '|' */ + 7 /* 0x7D '}' */ | 8<<4, /* 0x7E '~' */ + 8 /* 0x7F '' */ | 0<<4 +}; + + + +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; +} + + + +uint8_t x8x8_get_len(uint8_t ch) +{ + return (x8x8_len[ch/2] >> 4*(ch%2) ) & 0x0f; +} diff --git a/Makefile b/Makefile index 73ebbd9f..71aba594 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ CSRC = $(STARTUPSRC) \ $(STREAMSSRC) \ $(SHELLSRC) \ usbcfg.c \ - main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x22.c Font5x7.c flash.c adc.c + main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x22.c Font8x8.c flash.c adc.c # $(TESTSRC) \ @@ -228,6 +228,13 @@ include $(RULESPATH)/rules.mk flash: build/ch.bin dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/ch.bin +release: build/ch.hex build/ch.bin build/ch.dmp + dfu-tool convert dfuse ./build/ch.hex ./build/ch.dfu + dfu-tool set-product ./build/ch.dfu df11 + dfu-tool set-vendor ./build/ch.dfu 0483 + cd build; md5sum ch.* > md5.txt; sha256sum ch.* > sha256.txt + zip -j -r build/nanovna_$(VERSION).zip build/ch* build/sha256.txt build/md5.txt + dfu: -@printf "reset dfu\r" >/dev/cu.usbmodem401 diff --git a/README.md b/README.md index c0c1d80c..a488a6a0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ NanoVNA - Very tiny handheld Vector Network Analyzer [release]: https://github.com/ttrftech/NanoVNA/releases
- +

+ +

# About @@ -17,7 +19,10 @@ standalone with lcd display, portable device with battery. This project aim to provide an RF gadget but useful instrument for enthusiast. -This repository contains source of NanoVNA firmware. +This repository contains source of NanoVNA firmware with a more readable font than the original. + +## Binary releases +From time to time there are binary releases so you donĀ“t have to compile the firmware by yourself. See https://github.com/reald/NanoVNA/releases ## Prepare ARM Cross Tools @@ -44,7 +49,7 @@ Download arm cross tools from [here](https://developer.arm.com/tools-and-softwar Fetch source and submodule. - $ git clone https://github.com/ttrftech/NanoVNA.git + $ git clone https://github.com/reald/NanoVNA.git $ cd NanoVNA $ git submodule update --init --recursive @@ -114,3 +119,4 @@ Hardware design material is disclosed to prevent bad quality clone. Please let m * [@hugen79](https://github.com/hugen79) * [@cho45](https://github.com/cho45) +* DL9CAT diff --git a/STM32F072xB.ld b/STM32F072xB.ld index 577e87fc..72765bb5 100644 --- a/STM32F072xB.ld +++ b/STM32F072xB.ld @@ -19,14 +19,14 @@ */ MEMORY { - flash0 : org = 0x08000000, len = 96k + flash0 : org = 0x08000000, len = 102k flash1 : org = 0x00000000, len = 0 flash2 : org = 0x00000000, len = 0 flash3 : org = 0x00000000, len = 0 flash4 : org = 0x00000000, len = 0 flash5 : org = 0x00000000, len = 0 flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x08018000, len = 32k + flash7 : org = 0x08019800, len = 26k ram0 : org = 0x20000000, len = 16k ram1 : org = 0x00000000, len = 0 ram2 : org = 0x00000000, len = 0 diff --git a/doc/nanovna_infoscreen.jpg b/doc/nanovna_infoscreen.jpg new file mode 100644 index 00000000..1f57617e Binary files /dev/null and b/doc/nanovna_infoscreen.jpg differ diff --git a/doc/nanovna_screen.jpg b/doc/nanovna_screen.jpg new file mode 100644 index 00000000..9abe973f Binary files /dev/null and b/doc/nanovna_screen.jpg differ diff --git a/flash.c b/flash.c index 01f58f10..8006c339 100644 --- a/flash.c +++ b/flash.c @@ -79,7 +79,11 @@ checksum(const void *start, size_t len) #define FLASH_PAGESIZE 0x800 +#if SAVEAREA_MAX==5 const uint32_t save_config_area = 0x08018000; +#else +const uint32_t save_config_area = 0x08019800; +#endif int config_save(void) @@ -97,7 +101,7 @@ config_save(void) /* erase flash pages */ flash_erase_page((uint32_t)dst); - /* write to flahs */ + /* write to flash */ while(count-- > 0) { flash_program_half_word((uint32_t)dst, *src++); dst++; @@ -122,10 +126,14 @@ config_recall(void) return 0; } -#define SAVEAREA_MAX 5 + const uint32_t saveareas[] = - { 0x08018800, 0x0801a000, 0x0801b800, 0x0801d000, 0x0801e800 }; +{ +#if SAVEAREA_MAX==5 + 0x08018800, +#endif + 0x0801a000, 0x0801b800, 0x0801d000, 0x0801e800 }; int16_t lastsaveid = 0; @@ -210,7 +218,11 @@ caldata_ref(int id) return src; } +#if SAVEAREA_MAX==5 const uint32_t save_config_prop_area_size = 0x8000; +#else +const uint32_t save_config_prop_area_size = 0x6800; +#endif void clear_all_config_prop_data(void) diff --git a/ili9341.c b/ili9341.c index 99b4627b..97f41963 100644 --- a/ili9341.c +++ b/ili9341.c @@ -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, - - // 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, - - // control display - //0x53, 1, 0x0c, - // diaplay brightness - //0x51, 1, 0xff, - - // sleep out - 0x11, 0, - 0 // sentinel + // 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 + + // entry mode + 0xB7, 1, 0x06, + // display function control + 0xB6, 4, 0x0A, 0x82, 0x27, 0x00, + + // control display + //0x53, 1, 0x0c, + // diaplay brightness + //0x51, 1, 0xff, + + // 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); @@ -334,69 +334,67 @@ ili9341_read_memory_continue(int len, uint16_t* out) ili9341_read_memory_raw(0x3E, len, out); } -void -ili9341_drawchar_5x7(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg) -{ - uint16_t *buf = spi_buffer; - uint8_t bits; - int c, r; - for(c = 0; c < 7; c++) { - bits = x5x7_bits[(ch * 7) + c]; - for (r = 0; r < 5; r++) { - *buf++ = (0x80 & bits) ? fg : bg; - bits <<= 1; - } - } - ili9341_bulk(x, y, 5, 7); -} -void -ili9341_drawstring_5x7(const char *str, int x, int y, uint16_t fg, uint16_t bg) -{ - while (*str) { - ili9341_drawchar_5x7(*str, x, y, fg, bg); - x += 5; - str++; - } -} -void -ili9341_drawstring_5x7_inv(const char *str, int x, int y, uint16_t fg, uint16_t bg, bool invert) -{ - if (invert) - ili9341_drawstring_5x7(str, x, y, bg, fg); - else - ili9341_drawstring_5x7(str, x, y, fg, bg); -} - -void -ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size) +unsigned char +ili9341_drawchar(uint8_t ch, int x, int y, const uint16_t fg, const uint16_t bg, const uint8_t size, const uint8_t var, const uint8_t invert) { uint16_t *buf = spi_buffer; + uint16_t charwidthpx = 8 * size; + + uint16_t cline; + uint32_t ccol; /* 32bit datatype saves flash?!? */ uint8_t bits; - int c, r; - for(c = 0; c < 7*size; c++) { - bits = x5x7_bits[(ch * 7) + (c / size)]; - for (r = 0; r < 5*size; r++) { + + ch = x8x8_map_char_table(ch); + + if ( var != FALSE ) + { + charwidthpx = x8x8_get_len(ch) * size; + } + + for (cline = 0; cline < 8*size; cline++) + { + bits = x8x8_bits[ch][cline/size]; + + if (invert != FALSE) + bits = ~bits; + + for (ccol = 0; ccol < charwidthpx; ccol++) + { *buf++ = (0x80 & bits) ? fg : bg; - if (r % size == (size-1)) { + if ( (uint8_t)(ccol % size) == (size-1)) + { bits <<= 1; } } } - ili9341_bulk(x, y, 5*size, 7*size); + ili9341_bulk(x, y, charwidthpx, 8*size); + + return charwidthpx; } -void -ili9341_drawstring_size(const char *str, int x, int y, uint16_t fg, uint16_t bg, uint8_t size) + + +unsigned int +ili9341_drawstring(const char *str, int x, int y, const uint16_t fg, const uint16_t bg, const uint8_t size, const uint8_t var, const uint8_t invert) { - while (*str) { - ili9341_drawchar_size(*str, x, y, fg, bg, size); - x += 5 * size; + unsigned char clengthpx = 0; + unsigned int strwidthpx = 0; + + while (*str) + { + clengthpx = ili9341_drawchar(*str, x, y, fg, bg, size, var, invert); + x += clengthpx; + strwidthpx += clengthpx; str++; } + + return strwidthpx; } + + #define SWAP(x,y) do { int z=x; x = y; y = z; } while(0) void @@ -440,30 +438,34 @@ const font_t NF20x22 = { 20, 22, 1, 3*22, (const uint8_t *)numfont20x22 }; 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; - const uint8_t *bitmap = &font->bitmap[font->slide * ch]; - int c, r; + uint16_t *buf = spi_buffer; + const uint8_t *bitmap = &font->bitmap[font->slide * ch]; + int c, r; - for (c = 0; c < font->height; c++) { + for (c = 0; c < font->height; c++) + { uint8_t bits = *bitmap++; uint8_t m = 0x80; - for (r = 0; r < font->width; r++) { + for (r = 0; r < font->width; r++) + { *buf++ = (bits & m) ? fg : bg; m >>= 1; - if (m == 0) { + if (m == 0) + { bits = *bitmap++; m = 0x80; } } } - ili9341_bulk(x, y, font->width, font->height); + + ili9341_bulk(x, y, font->width, font->height); } #if 0 const uint16_t colormap[] = { - RGB565(255,0,0), RGB565(0,255,0), RGB565(0,0,255), - RGB565(255,255,0), RGB565(0,255,255), RGB565(255,0,255) + RGB_565(0,0,255), RGB_565(255,0,0), RGB_565(0,255,0), + RGB_565(255,0,255), RGB_565(255,255,0), RGB_565(0,255,255) }; void @@ -476,7 +478,7 @@ ili9341_test(int mode) #if 1 ili9341_fill(0, 0, 320, 240, 0); for (y = 0; y < 240; y++) { - ili9341_fill(0, y, 320, 1, RGB565(y, (y + 120) % 256, 240-y)); + ili9341_fill(0, y, 320, 1, RGB_565((y + 120) % 256, 240-y, y)); } break; case 1: @@ -494,7 +496,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, &NF20x22, i*20, 120, colormap[i%6], 0x0000); break; #endif diff --git a/main.c b/main.c index 6d52c881..2a000182 100644 --- a/main.c +++ b/main.c @@ -37,8 +37,8 @@ static void apply_error_term_at(int i); static void apply_edelay_at(int i); static void cal_interpolate(int s); -void update_frequencies(void); -void set_frequencies(uint32_t start, uint32_t stop, int16_t points); +static void update_frequencies(void); +static void set_frequencies(uint32_t start, uint32_t stop, int16_t points); bool sweep(bool break_on_operation); @@ -56,7 +56,7 @@ int8_t sweep_once = FALSE; int8_t cal_auto_interpolate = TRUE; uint16_t redraw_request = 0; // contains REDRAW_XXX flags int16_t vbat = 0; - +bool biginfo_enabled = FALSE; static THD_WORKING_AREA(waThread1, 640); static THD_FUNCTION(Thread1, arg) @@ -118,25 +118,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 @@ -550,7 +550,6 @@ static void cmd_capture(BaseSequentialStream *chp, int argc, char *argv[]) } len -= PART; } - //*/ chMtxUnlock(&mutex); } @@ -608,10 +607,10 @@ config_t config = { .grid_color = 0x1084, .menu_normal_color = 0xffff, .menu_active_color = 0x7777, - .trace_color = { RGB565(0,255,255), RGB565(255,0,40), RGB565(0,0,255), RGB565(50,255,0) }, -// .touch_cal = { 693, 605, 124, 171 }, // 2.4 inch LCD panel - .touch_cal = { 338, 522, 153, 192 }, // 2.8 inch LCD panel + .trace_color = { RGB_565(255,255,0), RGB_565(0,40,255), RGB_565(0,255,0), RGB_565(255,200,20) }, + .touch_cal = { 411, 592, 151, 189 }, //{ 620, 600, 160, 190 }, .default_loadcal = 0, + .biginfo_enabled = FALSE, .harmonic_freq_threshold = 300000000, .checksum = 0 }; @@ -765,8 +764,9 @@ update_marker_index(void) } } -void -set_frequencies(uint32_t start, uint32_t stop, int16_t points) + + +static void set_frequencies(uint32_t start, uint32_t stop, int16_t points) { int i; float span = stop - start; @@ -779,8 +779,9 @@ set_frequencies(uint32_t start, uint32_t stop, int16_t points) frequencies[i] = 0; } -void -update_frequencies(void) + + +static void update_frequencies(void) { uint32_t start, stop; if (frequency1 > 0) { @@ -1441,17 +1442,17 @@ const struct { uint16_t refpos; float scale_unit; } trace_info[] = { - { "LOGMAG", 7, 10 }, - { "PHASE", 4, 90 }, - { "DELAY", 4, 1e-9 }, - { "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 } + { "LMG", 7, 10 }, + { "PHA", 4, 90 }, + { "DEL", 4, 1e-9 }, + { "SM", 0, 1 }, + { "POL", 0, 1 }, + { "LIN", 0, 0.125 }, + { "SWR", 0, 1 }, + { "REAL", 4, 0.25 }, + { "IMAG", 4, 0.25 }, + { "RES", 0, 100 }, + { "REA", 4, 100 } }; const char * const trc_channel_name[] = { @@ -2081,6 +2082,9 @@ int main(void) */ dacStart(&DACD2, &dac1cfg1); + /* restore big info screen status */ + biginfo_enabled = config.biginfo_enabled; + /* initial frequencies */ update_frequencies(); diff --git a/md5.txt b/md5.txt new file mode 100644 index 00000000..e69de29b diff --git a/nanovna.h b/nanovna.h index 70282284..431dd68b 100644 --- a/nanovna.h +++ b/nanovna.h @@ -141,16 +141,23 @@ extern int area_height; // font -extern const uint8_t x5x7_bits []; +extern const uint8_t x8x8_bits[][8]; +extern uint8_t x8x8_get_len(uint8_t ch); +extern uint8_t x8x8_map_char_table(uint8_t ch); + extern const uint8_t numfont20x22[][22 * 3]; -#define S_DELTA "\004" -#define S_PI "\034" -#define S_MICRO "\035" -#define S_OHM "\036" -#define S_DEGREE "\037" -#define S_LARROW "\032" -#define S_RARROW "\033" +#define S_DELTA "\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" +#define C_DELTA '\001' + + // trace @@ -188,6 +195,7 @@ typedef struct { uint16_t trace_color[TRACES_MAX]; int16_t touch_cal[4]; int8_t default_loadcal; + bool biginfo_enabled; uint32_t harmonic_freq_threshold; int32_t checksum; } config_t; @@ -230,7 +238,7 @@ void redraw_frame(void); void request_to_draw_cells_behind_menu(void); void request_to_draw_cells_behind_numeric_input(void); void redraw_marker(int marker, int update_info); -void trace_get_info(int t, char *buf, int len); +uint16_t trace_get_info(int t, char *buf, uint16_t len); void plot_into_index(float measured[2][101][2]); void force_set_markmap(void); void draw_frequencies(void); @@ -258,14 +266,14 @@ extern int16_t vbat; /* * ili9341.c */ -#define RGB565(b,r,g) ( (((b)<<8)&0xfc00) | (((r)<<2)&0x03e0) | (((g)>>3)&0x001f) ) +#define RGB_565(r, g, b) ( (((b)<<8)&0xfc00) | (((r)<<2)&0x03e0) | (((g)>>3)&0x001f) ) typedef struct { - uint16_t width; - uint16_t height; - uint16_t scaley; - uint16_t slide; - const uint8_t *bitmap; + uint16_t width; + uint16_t height; + uint16_t scaley; + uint16_t slide; + const uint8_t *bitmap; } font_t; extern const font_t NF20x22; @@ -276,11 +284,12 @@ void ili9341_init(void); void ili9341_test(int mode); void ili9341_bulk(int x, int y, int w, int h); void ili9341_fill(int x, int y, int w, int h, int color); -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_drawstring_5x7_inv(const char *str, int x, int y, uint16_t fg, uint16_t bg, bool inv); -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(uint8_t ch, int x, int y, const uint16_t fg, const uint16_t bg, const uint8_t size, const uint8_t var, const uint8_t invert); +unsigned int ili9341_drawstring(const char *str, int x, int y, const uint16_t fg, const uint16_t bg, const uint8_t size, const uint8_t var, const uint8_t invert); +#define ili9341_drawstring_size(str, x, y, fg, bg, size) ili9341_drawstring(str, x, y, fg, bg, size, TRUE, FALSE) +#define ili9341_drawstring_8x8(str, x, y, fg, bg) ili9341_drawstring(str, x, y, fg, bg, 1, FALSE, FALSE) +#define ili9341_drawstring_8x8_var(str, x, y, fg, bg) ili9341_drawstring(str, x, y, fg, bg, 1, TRUE, FALSE) 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); @@ -289,7 +298,7 @@ void ili9341_read_memory_continue(int len, uint16_t* out); /* * flash.c */ -#define SAVEAREA_MAX 5 +#define SAVEAREA_MAX 4 typedef struct { int32_t magic; @@ -311,7 +320,7 @@ typedef struct { int32_t checksum; } properties_t; -#define CONFIG_MAGIC 0x434f4e45 /* 'CONF' */ +#define CONFIG_MAGIC 0x434f4e46 /* 'CONF' */ extern int16_t lastsaveid; extern properties_t *active_props; @@ -319,6 +328,8 @@ extern properties_t current_props; extern int8_t previous_marker; +extern bool biginfo_enabled; + #define frequency0 current_props._frequency0 #define frequency1 current_props._frequency1 #define sweep_points current_props._sweep_points @@ -404,11 +415,12 @@ int16_t adc_vbat_read(ADC_TypeDef *adc); // convert vbat [mV] to battery indicator static inline uint8_t vbat2bati(int16_t vbat) { - if (vbat < 3200) return 0; - if (vbat < 3450) return 25; - if (vbat < 3700) return 50; - if (vbat < 4100) return 75; - return 100; + if (vbat < 3200) return 0; + if (vbat < 3450) return 25; + if (vbat < 3700) return 50; + if (vbat < 4100) return 75; + + return 100; } /*EOF*/ diff --git a/plot.c b/plot.c index 69c9ee66..5f25550f 100644 --- a/plot.c +++ b/plot.c @@ -12,6 +12,16 @@ void frequency_string(char *buf, size_t len, int32_t freq); void frequency_string_short(char *buf, size_t len, int32_t freq, char prefix); void markmap_all_markers(void); +uint16_t cell_drawchar(int w, int h, uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size, uint8_t var, uint8_t invert); +uint16_t cell_drawstring(int w, int h, const char *str, int x, int y, uint16_t fg, uint16_t bg, uint8_t size, int8_t var, uint8_t invert); +#define cell_drawstring_8x8(w, h, str, x, y, fg, invert) cell_drawstring(w, h, str, x, y, fg, 0x0000, 1, FALSE, invert) +#define cell_drawstring_8x8_var(w, h, str, x, y, fg, invert) cell_drawstring(w, h, str, x, y, fg, 0x0000, 1, TRUE, invert) +#define cell_drawstring_size(w, h, str, x, y, fg, bg, size) cell_drawstring(w, h, str, x, y, fg, bg, size, TRUE, FALSE) +#define ili9341_drawchar_size(ch, x, y, fg, bg, size) ili9341_drawchar(ch, x, y, fg, bg, size, TRUE, FALSE) +#define ili9341_drawchar_8x8(ch, x, y, fg, bg) ili9341_drawchar(ch, x, y, fg, bg, 1, TRUE, FALSE) + +void request_to_draw_cells_behind_biginfo(void); + //#define GRID_COLOR 0x0863 //uint16_t grid_color = 0x1084; @@ -608,7 +618,7 @@ string_value_with_prefix(char *buf, int len, float val, char unit) } if (val < 10) { - n += chsnprintf(&buf[n], len, "%.2f", val); + n += chsnprintf(&buf[n], len, "%.1f", val); } else if (val < 100) { n += chsnprintf(&buf[n], len, "%.1f", val); } else { @@ -706,11 +716,11 @@ trace_get_value_string(int t, char *buf, int len, float array[101][2], int i) if (v == -INFINITY) chsnprintf(buf, len, "-INF dB"); else - chsnprintf(buf, len, "%.2fdB", v); + chsnprintf(buf, len, "%.1fdB", v); break; case TRC_PHASE: v = phase(coeff); - chsnprintf(buf, len, "%.2f" S_DEGREE, v); + chsnprintf(buf, len, "%.1f" S_DEGREE, v); break; case TRC_DELAY: v = groupdelay_from_array(i, array); @@ -718,7 +728,7 @@ trace_get_value_string(int t, char *buf, int len, float array[101][2], int i) break; case TRC_LINEAR: v = linear(coeff); - chsnprintf(buf, len, "%.2f", v); + chsnprintf(buf, len, "%.1f", v); break; case TRC_SWR: v = swr(coeff); @@ -741,7 +751,7 @@ trace_get_value_string(int t, char *buf, int len, float array[101][2], int i) break; //case TRC_ADMIT: case TRC_POLAR: - chsnprintf(buf, len, "%.2f %.2fj", coeff[0], coeff[1]); + chsnprintf(buf, len, "%.1f %.1fj", coeff[0], coeff[1]); break; } } @@ -798,30 +808,36 @@ trace_get_value_string_delta(int t, char *buf, int len, float array[101][2], int } } -void -trace_get_info(int t, char *buf, int len) +uint16_t +trace_get_info(int t, char *buf, uint16_t len) { const char *type = get_trace_typename(t); - int n; - switch (trace[t].type) { + uint16_t n = 0; + + switch ( trace[t].type ) + { case TRC_LOGMAG: - chsnprintf(buf, len, "%s %ddB/", type, (int)get_trace_scale(t)); + n = chsnprintf(buf, len, "%s %ddB/", type, (int)get_trace_scale(t)); break; case TRC_PHASE: - chsnprintf(buf, len, "%s %d" S_DEGREE "/", type, (int)get_trace_scale(t)); + n = chsnprintf(buf, len, "%s %d" S_DEGREE "/", type, (int)get_trace_scale(t)); break; case TRC_SMITH: //case TRC_ADMIT: case TRC_POLAR: - chsnprintf(buf, len, "%s %.1fFS", type, get_trace_scale(t)); + n = chsnprintf(buf, len, "%s %.1fFS", type, get_trace_scale(t)); break; default: n = chsnprintf(buf, len, "%s ", type); - string_value_with_prefix(buf+n, len-n, get_trace_scale(t), '/'); + n += string_value_with_prefix(buf+n, len-n, get_trace_scale(t), '/'); break; } + + return n; } + + static float time_of_index(int idx) { return 1.0 / (float)(frequencies[1] - frequencies[0]) / (float)FFT_SIZE * idx; } @@ -851,6 +867,7 @@ static inline void markmap_upperarea(void) { markmap[current_mappage][0] |= 0xffff; + markmap[current_mappage][1] |= 0xffff; } static inline void @@ -1128,27 +1145,44 @@ cell_draw_refpos(int m, int n, int w, int h) } } + + void draw_marker(int w, int h, int x, int y, int c, int ch) { int i, j; - for (j = 10; j >= 0; j--) { + + ch = x8x8_map_char_table(ch); + + for ( j = 12; j >= 0; j-- ) + { int j0 = j / 2; - for (i = -j0; i <= j0; i++) { + for ( i = -j0; i <= j0; i++ ) + { int x0 = x + i; int y0 = y - j; int cc = c; - if (j <= 9 && j > 2 && i >= -1 && i <= 3) { - uint16_t bits = x5x7_bits[(ch * 7) + (9-j)]; - if (bits & (0x80>>(i+1))) + + if ( (4 < j) && (j <= 11) && (-4 <= i) && (i <= 3) ) + { + uint8_t bits = x8x8_bits[ch][11-j]; + + if ( bits & (0x80>>(i+3)) ) + { cc = 0; + } } + if (y0 >= 0 && y0 < h && x0 >= 0 && x0 < w) + { spi_buffer[y0*w+x0] = cc; + } } } } + + void marker_position(int m, int t, int *x, int *y) { @@ -1268,27 +1302,38 @@ search_nearest_index(int x, int y, int t) return min_i; } + + void cell_draw_markers(int m, int n, int w, int h) { int x0 = m * CELLWIDTH; int y0 = n * CELLHEIGHT; int t, i; - for (i = 0; i < MARKERS_MAX; i++) { + + for (i = 0; i < MARKERS_MAX; i++) + { if (!markers[i].enabled) continue; - for (t = 0; t < TRACES_MAX; t++) { + + for (t = 0; t < TRACES_MAX; t++) + { if (!trace[t].enabled) continue; + uint32_t index = trace_index[t][markers[i].index]; int x = CELL_X(index) - x0; int y = CELL_Y(index) - y0; + if (x > -6 && x < w+6 && y >= 0 && y < h+12) draw_marker(w, h, x, y, config.trace_color[t], '1' + i); + } } } + + void markmap_marker(int marker) { @@ -1343,16 +1388,20 @@ draw_cell(int m, int n) int i0, i1; int i; int t; + char buf[24]; if (x0off + w > area_width) w = area_width - x0off; + if (y0 + h > area_height) h = area_height - y0; + if (w <= 0 || h <= 0) return; uint16_t grid_mode = 0; - for (t = 0; t < TRACES_MAX; t++) { + for (t = 0; t < TRACES_MAX; t++) + { if (!trace[t].enabled) continue; @@ -1368,24 +1417,37 @@ draw_cell(int m, int n) PULSE; /* draw grid */ - if (grid_mode & GRID_RECTANGULAR) { - for (x = 0; x < w; x++) { + if (grid_mode & GRID_RECTANGULAR) + { + for (x = 0; x < w; x++) + { uint16_t c = rectangular_grid_x(x+x0off); for (y = 0; y < h; y++) spi_buffer[y * w + x] = c; } - for (y = 0; y < h; y++) { + + for (y = 0; y < h; y++) + { uint16_t c = rectangular_grid_y(y+y0); for (x = 0; x < w; x++) + { if (x+x0off >= 0 && x+x0off <= WIDTH) spi_buffer[y * w + x] |= c; + } } - } else { + } + else + { memset(spi_buffer, 0, sizeof spi_buffer); } - if (grid_mode & (GRID_SMITH|GRID_ADMIT|GRID_POLAR)) { - for (y = 0; y < h; y++) { - for (x = 0; x < w; x++) { + + if (grid_mode & (GRID_SMITH|GRID_ADMIT|GRID_POLAR)) + { + + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { uint16_t c = 0; if (grid_mode & GRID_SMITH) c = smith_grid(x+x0off, y+y0); @@ -1400,20 +1462,52 @@ draw_cell(int m, int n) } PULSE; + /* draw large ch0 infos */ + if ( (biginfo_enabled != FALSE) && (active_marker >= 0) ) + { + float *coeff = measured[0][ markers[active_marker].index ]; + float v; + int cxpos = 2, cypos = 50; + + cxpos -= m * CELLWIDTH - CELLOFFSETX; + cypos -= n * CELLHEIGHT; + + v = swr(coeff); + + chsnprintf(buf, sizeof(buf), "CH0 Marker %d:", active_marker + 1); + cell_drawstring_size(w, h, buf, cxpos, cypos+=30, 0x0000, 0xffff, 3); + + chsnprintf(buf, sizeof(buf), "SWR 1:%.2f", v); + cell_drawstring_size(w, h, buf, cxpos, cypos+=30, 0xffff, 0x000, 3); + + frequency_string(buf, sizeof(buf), frequencies[ markers[active_marker].index ]); + cell_drawstring_size(w, h, buf, cxpos, cypos+=30, 0xffff, 0x0000, 3); + + format_smith_value(buf, sizeof(buf), coeff, frequencies[ markers[active_marker].index ]); + cell_drawstring_size(w, h, buf, cxpos, cypos+=30, 0xffff, 0x0000, 3); + + request_to_draw_cells_behind_biginfo(); + + } + + #if 1 /* draw rectanglar plot */ - for (t = 0; t < TRACES_MAX; t++) { + for (t = 0; t < TRACES_MAX; t++) + { if (!trace[t].enabled) continue; if (trace[t].type == TRC_SMITH || trace[t].type == TRC_POLAR) continue; - if (search_index_range_x(x0, trace_index[t], &i0, &i1)) { + if (search_index_range_x(x0, trace_index[t], &i0, &i1)) + { if (i0 > 0) i0--; if (i1 < 101-1) i1++; - for (i = i0; i < i1; i++) { + for (i = i0; i < i1; i++) + { int x1 = CELL_X(trace_index[t][i]); int x2 = CELL_X(trace_index[t][i+1]); int y1 = CELL_Y(trace_index[t][i]); @@ -1426,14 +1520,16 @@ draw_cell(int m, int n) #endif #if 1 /* draw polar plot */ - for (t = 0; t < TRACES_MAX; t++) { + for (t = 0; t < TRACES_MAX; t++) + { int c = config.trace_color[t]; if (!trace[t].enabled) continue; if (trace[t].type != TRC_SMITH && trace[t].type != TRC_POLAR) continue; - for (i = 1; i < sweep_points; i++) { + for (i = 1; i < sweep_points; i++) + { //uint32_t index = trace_index[t][i]; //uint32_t pindex = trace_index[t][i-1]; //if (!CELL_P(index, x0, y0) && !CELL_P(pindex, x0, y0)) @@ -1498,8 +1594,10 @@ redraw_marker(int marker, int update_info) // mark cells on marker info if (update_info) + { markmap[current_mappage][0] = 0xffff; - + markmap[current_mappage][1] = 0xffff; + } draw_all_cells(TRUE); } @@ -1524,172 +1622,253 @@ request_to_draw_cells_behind_numeric_input(void) } + void -cell_drawchar_5x7(int w, int h, uint8_t ch, int x, int y, uint16_t fg, int invert) +request_to_draw_cells_behind_biginfo(void) +{ + int n, m; + for (m = 0; m <= 9; m++) + for (n = 2; n < 7; n++) + mark_map(m, n); + redraw_request |= REDRAW_CELLS; +} + + + +uint16_t +cell_drawchar(int w, int h, uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size, uint8_t var, uint8_t invert) { uint8_t bits; - int c, r; - if (y <= -7 || y >= h || x <= -5 || x >= w) - return; - for(c = 0; c < 7; c++) { - if ((y + c) < 0 || (y + c) >= h) + uint16_t charwidthpx = 8 * size; + uint8_t cline, ccol; + + ch = x8x8_map_char_table(ch); + + if ( var != FALSE ) + { + charwidthpx = x8x8_get_len(ch) * size; + } + + if ( y <= -(8*size) || y >= h || x <= -(charwidthpx) || x >= w ) + return charwidthpx; + + for (cline = 0; cline < (8*size); cline++) + { + if ((y + cline) < 0 || (y + cline) >= h) continue; - bits = x5x7_bits[(ch * 7) + c]; + + bits = x8x8_bits[ch][cline/size]; + if (invert) bits = ~bits; - for (r = 0; r < 5; r++) { - if ((x+r) >= 0 && (x+r) < w && (0x80 & bits)) - spi_buffer[(y+c)*w + (x+r)] = fg; - bits <<= 1; + + for (ccol = 0; ccol < charwidthpx; ccol++) + { + if ( (x+ccol) >= 0 && (x+ccol) < w ) + spi_buffer[(y+cline)*w + (x+ccol)] = (0x80 & bits) ? fg : bg; + + if (ccol % size == (size-1)) + bits <<= 1; } } -} -void -cell_drawstring_5x7(int w, int h, char *str, int x, int y, uint16_t fg) -{ - while (*str) { - cell_drawchar_5x7(w, h, *str, x, y, fg, FALSE); - x += 5; - str++; - } + return charwidthpx; } -void -cell_drawstring_invert_5x7(int w, int h, char *str, int x, int y, uint16_t fg, int invert) + + +uint16_t +cell_drawstring(int w, int h, const char *str, int x, int y, uint16_t fg, uint16_t bg, uint8_t size, int8_t var, uint8_t invert) { - while (*str) { - cell_drawchar_5x7(w, h, *str, x, y, fg, invert); - x += 5; + unsigned char clength = 0; + uint16_t strwidthpx = 0; + + while (*str) + { + clength = cell_drawchar(w, h, *str, x, y, fg, bg, size, var, invert); + + x += clength; + strwidthpx += clength; str++; } + + return strwidthpx; + } + + static void cell_draw_marker_info(int m, int n, int w, int h) { char buf[24]; int t; - if (n != 0) + uint16_t strwidthpx = 0; + +#define MARKER_Y_DELTA 10 + + if (n > 1) return; + if (active_marker < 0) return; + int idx = markers[active_marker].index; int j = 0; - if (active_marker != -1 && previous_marker != -1 && uistat.current_trace != -1) { + + if (active_marker != -1 && previous_marker != -1 && uistat.current_trace != -1) + { int t = uistat.current_trace; int mk; - for (mk = 0; mk < MARKERS_MAX; mk++) { + for (mk = 0; mk < MARKERS_MAX; mk++) + { if (!markers[mk].enabled) continue; - int xpos = 1 + (j%2)*146; - int ypos = 1 + (j/2)*7; + int xpos = 1 + (j%2) * 160; + int ypos = 1 + (j/2) * MARKER_Y_DELTA; xpos -= m * CELLWIDTH -CELLOFFSETX; ypos -= n * CELLHEIGHT; - strcpy(buf, "MK1"); - buf[2] += mk; - cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, config.trace_color[t], mk == active_marker); - xpos += 20; + strcpy(buf, "M1"); + buf[1] += mk; + strwidthpx = cell_drawstring(w, h, buf, xpos, ypos, config.trace_color[t], 0x0000, 1, TRUE, mk == active_marker); + + xpos += strwidthpx + 4; //trace_get_info(t, buf, sizeof buf); int32_t freq = frequencies[markers[mk].index]; - if (uistat.marker_delta && mk != active_marker) { + if (uistat.marker_delta && mk != active_marker) + { freq -= frequencies[markers[active_marker].index]; - frequency_string_short(buf, sizeof buf, freq, S_DELTA[0]); - } else { + frequency_string_short(buf, sizeof buf, freq, C_DELTA); + } + else + { frequency_string_short(buf, sizeof buf, freq, 0); } - cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]); - xpos += 64; + strwidthpx = cell_drawstring(w, h, buf, xpos, ypos, config.trace_color[t], 0x0000, 1, TRUE, FALSE); + + xpos += strwidthpx + 4; + if (uistat.marker_delta && mk != active_marker) trace_get_value_string_delta(t, buf, sizeof buf, measured[trace[t].channel], markers[mk].index, markers[active_marker].index); else trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel], markers[mk].index); - cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff); + + cell_drawstring(w, h, buf, xpos, ypos, 0xffff, 0x0000, 1, TRUE, FALSE); + j++; } // draw marker delta - if (!uistat.marker_delta && previous_marker >= 0 && active_marker != previous_marker && markers[previous_marker].enabled) { + if (!uistat.marker_delta && previous_marker >= 0 && active_marker != previous_marker && markers[previous_marker].enabled) + { int idx0 = markers[previous_marker].index; - int xpos = 192; - int ypos = 1 + (j/2)*7; - xpos -= m * CELLWIDTH -CELLOFFSETX; + + int xpos = 160; + int ypos = 1 + (j/2) * MARKER_Y_DELTA; + xpos -= m * CELLWIDTH - CELLOFFSETX; ypos -= n * CELLHEIGHT; - strcpy(buf, S_DELTA "1:"); - buf[1] += previous_marker; - cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff); - xpos += 19; - if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) { + + chsnprintf(buf, sizeof buf, "%c%d:", C_DELTA, previous_marker+1); + strwidthpx = cell_drawstring_8x8(w, h, buf, xpos, ypos, 0xffff, FALSE); + xpos += strwidthpx + 4; + + if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) + { frequency_string(buf, sizeof buf, frequencies[idx] - frequencies[idx0]); - } else { + } + else + { //chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9 - time_of_index(idx0) * 1e9), // distance_of_index(idx) - distance_of_index(idx0)); int n = string_value_with_prefix(buf, sizeof buf, time_of_index(idx) - time_of_index(idx0), 's'); buf[n++] = ' '; string_value_with_prefix(&buf[n], sizeof buf - n, distance_of_index(idx) - distance_of_index(idx0), 'm'); } - cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff); + cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE); } - } else { - for (t = 0; t < TRACES_MAX; t++) { + + } + else + { + 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 xpos = 1 + (j%2) * 160; + int ypos = 1 + (j/2) * MARKER_Y_DELTA; + xpos -= m * CELLWIDTH - CELLOFFSETX; ypos -= n * CELLHEIGHT; - strcpy(buf, "CH0"); - buf[2] += 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; + + chsnprintf(buf, sizeof buf, "C%d:", trace[t].channel); + strwidthpx = cell_drawstring_8x8_var(w, h, buf, xpos, ypos, config.trace_color[t], t == uistat.current_trace); + xpos += strwidthpx + 4; + 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); - cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff); + strwidthpx = cell_drawstring_8x8_var(w, h, buf, xpos, ypos, config.trace_color[t], t == uistat.current_trace); + xpos += strwidthpx + 4; + + trace_get_value_string(t, buf, (sizeof(buf)), measured[trace[t].channel], idx); + cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE); + j++; + } + + + // draw marker frequency - int xpos = 192; - int ypos = 1 + (j/2)*7; - xpos -= m * CELLWIDTH -CELLOFFSETX; + int xpos = 160; + int ypos = 1 + (j/2) * MARKER_Y_DELTA; + xpos -= m * CELLWIDTH - CELLOFFSETX; ypos -= n * CELLHEIGHT; - strcpy(buf, "1:"); - buf[0] += active_marker; - xpos += 5; - cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, 0xffff, uistat.lever_mode == LM_MARKER); - xpos += 14; - if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) { + + chsnprintf(buf, sizeof buf, "%d:", active_marker + 1); + + strwidthpx = cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, uistat.lever_mode == LM_MARKER); + xpos += strwidthpx + 4; + + if ( (domain_mode & DOMAIN_MODE) == DOMAIN_FREQ ) + { frequency_string(buf, sizeof buf, frequencies[idx]); - } else { + } + else + { //chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9), distance_of_index(idx)); int n = string_value_with_prefix(buf, sizeof buf, time_of_index(idx), 's'); buf[n++] = ' '; string_value_with_prefix(&buf[n], sizeof buf-n, distance_of_index(idx), 'm'); } - cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff); + cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE); + } - if (electrical_delay != 0) { + + if (electrical_delay != 0) + { // draw electrical delay - int xpos = 21; - int ypos = 1 + ((j+1)/2)*7; - xpos -= m * CELLWIDTH -CELLOFFSETX; + int xpos = 1; + int ypos = 1 + ((j+1)/2) * MARKER_Y_DELTA; + uint16_t slen = 0; + + xpos -= m * CELLWIDTH - CELLOFFSETX; ypos -= n * CELLHEIGHT; - chsnprintf(buf, sizeof buf, "Edelay"); - cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff); - xpos += 7 * 5; - int n = string_value_with_prefix(buf, sizeof buf, electrical_delay * 1e-12, 's'); - cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff); - xpos += n * 5 + 5; + chsnprintf(buf, sizeof buf, "Edelay "); + slen = cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE); + xpos += slen; + string_value_with_prefix(buf, sizeof buf, electrical_delay * 1e-12, 's'); + slen = cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE); + xpos += slen + 8; float light_speed_ps = 299792458e-12; //(m/ps) string_value_with_prefix(buf, sizeof buf, electrical_delay * light_speed_ps * velocity_factor / 100.0, 'm'); - cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff); + cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE); } + } + + void frequency_string(char *buf, size_t len, int32_t freq) { @@ -1705,13 +1884,15 @@ frequency_string(char *buf, size_t len, int32_t freq) (int)(freq / 1000), (int)(freq % 1000)); } else { - chsnprintf(buf, len, "%d.%03d %03d MHz", + chsnprintf(buf, len, "%d.%03d%03d MHz", (int)(freq / 1000000), (int)((freq / 1000) % 1000), (int)(freq % 1000)); } } + + void frequency_string_short(char *b, size_t len, int32_t freq, char prefix) { @@ -1732,109 +1913,138 @@ frequency_string_short(char *b, size_t len, int32_t freq, char prefix) (int)(freq / 1000), (int)(freq % 1000)); } else { - chsnprintf(buf, len, "%d.%06d", + chsnprintf(buf, len, "%d.%03d", (int)(freq / 1000000), (int)(freq % 1000000)); - strcpy(b+9, "MHz"); + strcpy(b+7, "MHz"); } } void draw_frequencies(void) { - char buf[24]; - if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) { - if (frequency1 > 0) { - int start = frequency0; - int stop = frequency1; - strcpy(buf, "START "); - frequency_string(buf+6, 24-6, start); - strcat(buf, " "); - ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000); - strcpy(buf, "STOP "); - frequency_string(buf+5, 24-5, stop); - strcat(buf, " "); - ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000); - } else if (frequency1 < 0) { - int fcenter = frequency0; - int fspan = -frequency1; - int x = OFFSETX; - strcpy(buf, "CENTER"); - ili9341_drawstring_5x7_inv(buf, x, 233, 0xffff, 0x0000, uistat.lever_mode == LM_CENTER); - x += 5 * 6; - strcpy(buf, " "); - frequency_string(buf+1, 24-1, fcenter); - strcat(buf, " "); - ili9341_drawstring_5x7(buf, x, 233, 0xffff, 0x0000); - x = 205; - strcpy(buf, "SPAN"); - ili9341_drawstring_5x7_inv(buf, x, 233, 0xffff, 0x0000, uistat.lever_mode == LM_SPAN); - x += 5 * 4; - strcpy(buf, " "); - frequency_string(buf+1, 24-1, fspan); - strcat(buf, " "); - ili9341_drawstring_5x7(buf, x, 233, 0xffff, 0x0000); - } else { - int fcenter = frequency0; - chsnprintf(buf, 24, "CW %d.%03d %03d MHz ", - (int)(fcenter / 1000000), - (int)((fcenter / 1000) % 1000), - (int)(fcenter % 1000)); - ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000); - chsnprintf(buf, 24, " "); - ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000); - } - } else { - strcpy(buf, "START 0s "); - ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000); + char buf[36]; + if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) + { + if (frequency1 > 0) + { + int start = frequency0; + int stop = frequency1; + + strcpy(buf, "START "); + frequency_string(buf+6, 24-6, start); + strcat(buf, " "); + ili9341_drawstring_8x8_var(buf, OFFSETX, 233, 0xffff, 0x0000); strcpy(buf, "STOP "); - chsnprintf(buf+5, 24-5, "%d ns", (uint16_t)(time_of_index(101) * 1e9)); - strcat(buf, " "); - ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000); + frequency_string(buf+5, 24-5, stop); + strcat(buf, " "); + ili9341_drawstring_8x8_var(buf, 165, 233, 0xffff, 0x0000); + } + else if (frequency1 < 0) + { + int fcenter = frequency0; + int fspan = -frequency1; + int x = OFFSETX; + unsigned int strlenpx = 0; + + strcpy(buf, "CENT"); + strlenpx = ili9341_drawstring(buf, x, 233, 0xffff, 0x0000, 1, TRUE, uistat.lever_mode == LM_CENTER); + x += strlenpx; + strcpy(buf, " "); + frequency_string(buf+1, 24-1, fcenter); + strcat(buf, " "); + ili9341_drawstring_8x8_var(buf, x, 233, 0xffff, 0x0000); + + x = 165; + strcpy(buf, "SPAN"); + strlenpx = ili9341_drawstring(buf, x, 233, 0xffff, 0x0000, 1, TRUE, uistat.lever_mode == LM_SPAN); + x += strlenpx; + strcpy(buf, " "); + frequency_string(buf+1, 24-1, fspan); + strcat(buf, " "); + ili9341_drawstring_8x8_var(buf, x, 233, 0xffff, 0x0000); + } + else + { + int fcenter = frequency0; + chsnprintf(buf, 24, "CW %d.%03d%03d MHz ", + (int)(fcenter / 1000000), + (int)((fcenter / 1000) % 1000), + (int)(fcenter % 1000)); + ili9341_drawstring_8x8_var(buf, OFFSETX, 233, 0xffff, 0x0000); + chsnprintf(buf, 24, " "); + ili9341_drawstring_8x8_var(buf, 165, 233, 0xffff, 0x0000); + } + } + else + { + strcpy(buf, "START 0s "); + ili9341_drawstring_8x8_var(buf, OFFSETX, 233, 0xffff, 0x0000); + + strcpy(buf, "STOP "); + chsnprintf(buf+5, 24-5, "%d ns", (uint16_t)(time_of_index(101) * 1e9)); + strcat(buf, " "); + ili9341_drawstring_8x8_var(buf, 165, 233, 0xffff, 0x0000); } } + + void draw_cal_status(void) { int x = 0; int y = 100; -#define YSTEP 7 - ili9341_fill(0, y, 10, 6*YSTEP, 0x0000); - if (cal_status & CALSTAT_APPLY) { - char c[3] = "C0"; - c[1] += lastsaveid; +#define YSTEP 12 + ili9341_fill(0, y, 10, 8*YSTEP, 0x0000); + if (cal_status & CALSTAT_APPLY) + { + char ch = 'C'; + char ch2 = '0' + lastsaveid; + if (cal_status & CALSTAT_INTERPOLATED) - c[0] = 'c'; + ch = 'c'; else if (active_props == ¤t_props) - c[1] = '*'; - ili9341_drawstring_5x7(c, x, y, 0xffff, 0x0000); + ch2 = '*'; + + ili9341_drawchar_8x8(ch, x, y, 0xffff, 0x0000); + y += 8; + ili9341_drawchar_8x8(ch2, x, y, 0xffff, 0x0000); y += YSTEP; } - if (cal_status & CALSTAT_ED) { - ili9341_drawstring_5x7("D", x, y, 0xffff, 0x0000); + + if (cal_status & CALSTAT_ED) + { + ili9341_drawstring_8x8("D", x, y, 0xffff, 0x0000); y += YSTEP; } - if (cal_status & CALSTAT_ER) { - ili9341_drawstring_5x7("R", x, y, 0xffff, 0x0000); + if (cal_status & CALSTAT_ER) + { + ili9341_drawstring_8x8("R", x, y, 0xffff, 0x0000); y += YSTEP; } - if (cal_status & CALSTAT_ES) { - ili9341_drawstring_5x7("S", x, y, 0xffff, 0x0000); + if (cal_status & CALSTAT_ES) + { + ili9341_drawstring_8x8("S", x, y, 0xffff, 0x0000); y += YSTEP; } - if (cal_status & CALSTAT_ET) { - ili9341_drawstring_5x7("T", x, y, 0xffff, 0x0000); + if (cal_status & CALSTAT_ET) + { + ili9341_drawstring_8x8("T", x, y, 0xffff, 0x0000); y += YSTEP; } - if (cal_status & CALSTAT_EX) { - ili9341_drawstring_5x7("X", x, y, 0xffff, 0x0000); + if (cal_status & CALSTAT_EX) + { + ili9341_drawstring_8x8("X", x, y, 0xffff, 0x0000); y += YSTEP; } + } + + void draw_battery_status(void) { @@ -1843,7 +2053,7 @@ draw_battery_status(void) int i, c; uint16_t *buf = spi_buffer; uint8_t vbati = vbat2bati(vbat); - uint16_t col = vbati == 0 ? RGB565(0, 255, 0) : RGB565(0, 0, 240); + uint16_t col = vbati == 0 ? RGB_565(255, 0, 0) : RGB_565(0, 240, 0); memset(spi_buffer, 0, w * h * 2); // battery head diff --git a/ui.c b/ui.c index 378125b0..4a659e89 100644 --- a/ui.c +++ b/ui.c @@ -35,23 +35,23 @@ uistat_t uistat = { }; -#define NO_EVENT 0 -#define EVT_BUTTON_SINGLE_CLICK 0x01 -#define EVT_BUTTON_DOUBLE_CLICK 0x02 -#define EVT_BUTTON_DOWN_LONG 0x04 -#define EVT_UP 0x10 -#define EVT_DOWN 0x20 -#define EVT_REPEAT 0x40 - -#define BUTTON_DOWN_LONG_TICKS 5000 /* 1sec */ -#define BUTTON_DOUBLE_TICKS 5000 /* 500ms */ -#define BUTTON_REPEAT_TICKS 1000 /* 100ms */ -#define BUTTON_DEBOUNCE_TICKS 200 +#define NO_EVENT 0 +#define EVT_BUTTON_SINGLE_CLICK 0x01 +#define EVT_BUTTON_DOUBLE_CLICK 0x02 +#define EVT_BUTTON_DOWN_LONG 0x04 +#define EVT_UP 0x10 +#define EVT_DOWN 0x20 +#define EVT_REPEAT 0x40 + +#define BUTTON_DOWN_LONG_TICKS 5000 /* 1sec */ +#define BUTTON_DOUBLE_TICKS 5000 /* 500ms */ +#define BUTTON_REPEAT_TICKS 1000 /* 100ms */ +#define BUTTON_DEBOUNCE_TICKS 200 /* lever switch assignment */ -#define BIT_UP1 3 -#define BIT_PUSH 2 -#define BIT_DOWN1 1 +#define BIT_UP1 3 +#define BIT_PUSH 2 +#define BIT_DOWN1 1 #define READ_PORT() palReadPort(GPIOA) #define BUTTON_MASK 0b1111 @@ -122,11 +122,11 @@ static void menu_push_submenu(const menuitem_t *submenu); static int btn_check(void) { - int cur_button = READ_PORT() & BUTTON_MASK; - int changed = last_button ^ cur_button; - int status = 0; + int cur_button = READ_PORT() & BUTTON_MASK; + int changed = last_button ^ cur_button; + int status = 0; uint32_t ticks = chVTGetSystemTime(); - if (changed & (1<= BUTTON_DEBOUNCE_TICKS) { if (cur_button & (1<