diff --git a/firmware/src/main.c b/firmware/src/main.c index 4375607..08a9f30 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -3,6 +3,7 @@ #include #include #include +#include #define SPI_PORT PORTB #define SPI_DDR DDRB @@ -16,82 +17,122 @@ #define ENC_A (PINB & (1 << PB6)) #define ENC_B (PINB & (1 << PB7)) +#define SYM_ENTRY(SYM) { SYM, sizeof(SYM) / 2 } + static uint8_t EEMEM eeprom_contrast = 8; static uint8_t EEMEM eeprom_backlight = 1; -static const uint8_t sacred_chao[200] = { 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8, 0xF0, 0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x80, 0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x03, 0xC3, 0xE3, 0x73, 0x37, 0x17, 0x07, 0x0F, 0x1E, 0x3C, 0xF0, 0x80, - 0xFF, 0xFF, 0xFF, 0xE7, 0xC3, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0x30, 0x00, 0x00, 0xFF, - 0x01, 0x0F, 0x3F, 0x4F, 0x9F, 0x3F, 0x3E, 0x3C, 0x7C, 0x7C, 0x7C, 0x7C, 0x3E, 0x3E, 0x3E, 0x1F, 0x1F, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x81, 0x40, 0x30, 0x0E, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x08, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x08, 0x08, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 }; +static const __flash uint8_t sacred_chao[] = { 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8, 0xF0, 0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x80, 0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x03, 0xC3, 0xE3, 0x73, 0x37, 0x17, 0x07, 0x0F, 0x1E, 0x3C, 0xF0, 0x80, + 0xFF, 0xFF, 0xFF, 0xE7, 0xC3, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0x30, 0x00, 0x00, 0xFF, + 0x01, 0x0F, 0x3F, 0x4F, 0x9F, 0x3F, 0x3E, 0x3C, 0x7C, 0x7C, 0x7C, 0x7C, 0x3E, 0x3E, 0x3E, 0x1F, 0x1F, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x81, 0x40, 0x30, 0x0E, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x08, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x08, 0x08, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 }; -static const uint8_t onders_org[96] = { 0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0x60, 0xF8, 0x00, 0x00, 0xE0, 0xA0, 0xE0, 0x00, 0x00, 0xE0, 0x20, 0x60, 0x00, 0x00, 0xE0, 0xA0, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0x20, 0x60, 0x00, 0x00, 0xE0, 0x60, 0xE0, - 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x02, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x0A, 0x0F}; +static const __flash uint8_t onders_org[] = { 0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0x60, 0xF8, 0x00, 0x00, 0xE0, 0xA0, 0xE0, 0x00, 0x00, 0xE0, 0x20, 0x60, 0x00, 0x00, 0xE0, 0xA0, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0x20, 0x60, 0x00, 0x00, 0xE0, 0x60, 0xE0, + 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x02, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x0A, 0x0F}; + +static const __flash uint8_t sym_0[] = { 0xF8, 0xFC, 0x0C, 0xFC, 0xF8, + 0x1F, 0x3F, 0x30, 0x3F, 0x1F }; +static const __flash uint8_t sym_1[] = { 0x30, 0x30, 0xFC, 0xFC, 0x00, + 0x30, 0x30, 0x3F, 0x3F, 0x30 }; +static const __flash uint8_t sym_2[] = { 0x18, 0x1C, 0x8C, 0xFC, 0xF8, + 0x38, 0x3E, 0x3F, 0x33, 0x30 }; +static const __flash uint8_t sym_3[] = { 0x18, 0x9C, 0x8C, 0xFC, 0x78, + 0x18, 0x39, 0x31, 0x3F, 0x1E }; +static const __flash uint8_t sym_4[] = { 0x80, 0xE0, 0x78, 0xFC, 0xFC, + 0x07, 0x07, 0x06, 0x3F, 0x3F }; +static const __flash uint8_t sym_5[] = { 0xFC, 0xFC, 0x8C, 0x8C, 0x0C, + 0x1C, 0x3D, 0x31, 0x3F, 0x1F }; +static const __flash uint8_t sym_6[] = { 0xF8, 0xFC, 0x8C, 0xBC, 0x38, + 0x1F, 0x3F, 0x31, 0x3F, 0x1F }; +static const __flash uint8_t sym_7[] = { 0x0C, 0x0C, 0xEC, 0xFC, 0x1C, + 0x00, 0x3E, 0x3F, 0x01, 0x00 }; +static const __flash uint8_t sym_8[] = { 0x78, 0xFC, 0x8C, 0xFC, 0x78, + 0x1E, 0x3F, 0x31, 0x3F, 0x1E }; +static const __flash uint8_t sym_9[] = { 0xF8, 0xFC, 0x8C, 0xFC, 0xF8, + 0x1C, 0x3D, 0x31, 0x3F, 0x1F }; + +static const __flash uint8_t sym_colon[] = { 0x30, 0x30, + 0x0C, 0x0C }; + +static const __flash uint8_t sym_a[] = { 0xC0, 0xF0, 0x3C, 0x3C, 0xF0, 0xC0, + 0x3F, 0x3F, 0x06, 0x06, 0x3F, 0x3F }; +static const __flash uint8_t sym_b[] = { 0xFC, 0xFC, 0x8C, 0x8C, 0xFC, 0x78, + 0x3F, 0x3F, 0x31, 0x31, 0x3F, 0x1E }; +static const __flash uint8_t sym_c[] = { 0xF8, 0xFC, 0x0C, 0x1C, 0x18, + 0x1F, 0x3F, 0x30, 0x38, 0x18 }; +static const __flash uint8_t sym_e[] = { 0xFC, 0xFC, 0x8C, 0x8C, 0x0C, + 0x3F, 0x3F, 0x31, 0x31, 0x30 }; +static const __flash uint8_t sym_g[] = { 0xF8, 0xFC, 0x0C, 0x0C, 0x3C, 0x38, + 0x1F, 0x3F, 0x30, 0x33, 0x3F, 0x1F }; +static const __flash uint8_t sym_h[] = { 0xFC, 0xFC, 0x80, 0x80, 0xFC, 0xFC, + 0x3F, 0x3F, 0x01, 0x01, 0x3F, 0x3F }; +static const __flash uint8_t sym_i[] = { 0x0C, 0xFC, 0xFC, 0x0C, + 0x30, 0x3F, 0x3F, 0x30 }; +static const __flash uint8_t sym_k[] = { 0xFC, 0xFC, 0xC0, 0xF0, 0x7C, 0x1C, + 0x3F, 0x3F, 0x03, 0x0F, 0x3E, 0x38 }; +static const __flash uint8_t sym_l[] = { 0xFC, 0xFC, 0x00, 0x00, 0x00, + 0x3F, 0x3F, 0x30, 0x30, 0x30 }; +static const __flash uint8_t sym_n[] = { 0xFC, 0xFC, 0xF0, 0xC0, 0x00, 0xFC, 0xFC, + 0x3F, 0x3F, 0x00, 0x03, 0x0F, 0x3F, 0x3F }; +static const __flash uint8_t sym_o[] = { 0xF8, 0xFC, 0x0C, 0x0C, 0xFC, 0xF8, + 0x1F, 0x3F, 0x30, 0x30, 0x3F, 0x1F }; +static const __flash uint8_t sym_p[] = { 0xFC, 0xFC, 0x8C, 0x8C, 0xFC, 0xF8, + 0x3F, 0x3F, 0x01, 0x01, 0x01, 0x00 }; +static const __flash uint8_t sym_r[] = { 0xFC, 0xFC, 0x8C, 0x8C, 0xFC, 0xF8, + 0x3F, 0x3F, 0x01, 0x03, 0x3F, 0x3E }; +static const __flash uint8_t sym_s[] = { 0xF8, 0xFC, 0x8C, 0x8C, 0x9C, 0x18, + 0x18, 0x39, 0x31, 0x31, 0x3F, 0x1F }; +static const __flash uint8_t sym_t[] = { 0x0C, 0x0C, 0xFC, 0xFC, 0x0C, 0x0C, + 0x00, 0x00, 0x3F, 0x3F, 0x00, 0x00 }; +static const __flash uint8_t sym_u[] = { 0xFC, 0xFC, 0x00, 0x00, 0xFC, 0xFC, + 0x3F, 0x3F, 0x30, 0x30, 0x3F, 0x3F }; + +static const __flash uint8_t sym_none[] = { 0x00 }; struct symbol { - uint8_t length; - uint8_t symbol[]; + const __flash uint8_t* data; + const uint8_t length; }; -static const struct symbol sym_a = { 6, { 0xC0, 0xF0, 0x3C, 0x3C, 0xF0, 0xC0, - 0x3F, 0x3F, 0x06, 0x06, 0x3F, 0x3F } }; -static const struct symbol sym_b = { 6, { 0xFC, 0xFC, 0x8C, 0x8C, 0xFC, 0x78, - 0x3F, 0x3F, 0x31, 0x31, 0x3F, 0x1E } }; -static const struct symbol sym_c = { 5, { 0xF8, 0xFC, 0x0C, 0x1C, 0x18, - 0x1F, 0x3F, 0x30, 0x38, 0x18 } }; -static const struct symbol sym_e = { 5, { 0xFC, 0xFC, 0x8C, 0x8C, 0x0C, - 0x3F, 0x3F, 0x31, 0x31, 0x30 } }; -static const struct symbol sym_g = { 6, { 0xF8, 0xFC, 0x0C, 0x0C, 0x3C, 0x38, - 0x1F, 0x3F, 0x30, 0x33, 0x3F, 0x1F } }; -static const struct symbol sym_h = { 6, { 0xFC, 0xFC, 0x80, 0x80, 0xFC, 0xFC, - 0x3F, 0x3F, 0x01, 0x01, 0x3F, 0x3F } }; -static const struct symbol sym_i = { 4, { 0x0C, 0xFC, 0xFC, 0x0C, - 0x30, 0x3F, 0x3F, 0x30 } }; -static const struct symbol sym_k = { 6, { 0xFC, 0xFC, 0xC0, 0xF0, 0x7C, 0x1C, - 0x3F, 0x3F, 0x03, 0x0F, 0x3E, 0x38 } }; -static const struct symbol sym_l = { 5, { 0xFC, 0xFC, 0x00, 0x00, 0x00, - 0x3F, 0x3F, 0x30, 0x30, 0x30 } }; -static const struct symbol sym_n = { 7, { 0xFC, 0xFC, 0xF0, 0xC0, 0x00, 0xFC, 0xFC, - 0x3F, 0x3F, 0x00, 0x03, 0x0F, 0x3F, 0x3F } }; -static const struct symbol sym_o = { 6, { 0xF8, 0xFC, 0x0C, 0x0C, 0xFC, 0xF8, - 0x1F, 0x3F, 0x30, 0x30, 0x3F, 0x1F } }; -static const struct symbol sym_p = { 6, { 0xFC, 0xFC, 0x8C, 0x8C, 0xFC, 0xF8, - 0x3F, 0x3F, 0x01, 0x01, 0x01, 0x00 } }; -static const struct symbol sym_r = { 6, { 0xFC, 0xFC, 0x8C, 0x8C, 0xFC, 0xF8, - 0x3F, 0x3F, 0x01, 0x03, 0x3F, 0x3E } }; -static const struct symbol sym_s = { 6, { 0xF8, 0xFC, 0x8C, 0x8C, 0x9C, 0x18, - 0x18, 0x39, 0x31, 0x31, 0x3F, 0x1F } }; -static const struct symbol sym_t = { 6, { 0x0C, 0x0C, 0xFC, 0xFC, 0x0C, 0x0C, - 0x00, 0x00, 0x3F, 0x3F, 0x00, 0x00 } }; -static const struct symbol sym_u = { 6, { 0xFC, 0xFC, 0x00, 0x00, 0xFC, 0xFC, - 0x3F, 0x3F, 0x30, 0x30, 0x3F, 0x3F } }; - -static const struct symbol sym_0 = { 5, { 0xF8, 0xFC, 0x0C, 0xFC, 0xF8, - 0x1F, 0x3F, 0x30, 0x3F, 0x1F } }; -static const struct symbol sym_1 = { 5, { 0x30, 0x30, 0xFC, 0xFC, 0x00, - 0x30, 0x30, 0x3F, 0x3F, 0x30 } }; -static const struct symbol sym_2 = { 5, { 0x18, 0x1C, 0x8C, 0xFC, 0xF8, - 0x38, 0x3E, 0x3F, 0x33, 0x30 } }; -static const struct symbol sym_3 = { 5, { 0x18, 0x9C, 0x8C, 0xFC, 0x78, - 0x18, 0x39, 0x31, 0x3F, 0x1E } }; -static const struct symbol sym_4 = { 5, { 0x80, 0xE0, 0x78, 0xFC, 0xFC, - 0x07, 0x07, 0x06, 0x3F, 0x3F } }; -static const struct symbol sym_5 = { 5, { 0xFC, 0xFC, 0x8C, 0x8C, 0x0C, - 0x1C, 0x3D, 0x31, 0x3F, 0x1F } }; -static const struct symbol sym_6 = { 5, { 0xF8, 0xFC, 0x8C, 0xBC, 0x38, - 0x1F, 0x3F, 0x31, 0x3F, 0x1F } }; -static const struct symbol sym_7 = { 5, { 0x0C, 0x0C, 0xEC, 0xFC, 0x1C, - 0x00, 0x3E, 0x3F, 0x01, 0x00 } }; -static const struct symbol sym_8 = { 5, { 0x78, 0xFC, 0x8C, 0xFC, 0x78, - 0x1E, 0x3F, 0x31, 0x3F, 0x1E } }; -static const struct symbol sym_9 = { 5, { 0xF8, 0xFC, 0x8C, 0xFC, 0xF8, - 0x1C, 0x3D, 0x31, 0x3F, 0x1F } }; - -static const struct symbol sym_colon = { 2, { 0x30, 0x30, - 0x0C, 0x0C } }; - -static const struct symbol sym_setup = { 19, { 0xF8, 0x98, 0xB8, 0x00, 0xF8, 0x98, 0x18, 0x00, 0x18, 0xF8, 0x18, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x98, 0xF8, - 0x1D, 0x19, 0x1F, 0x00, 0x1F, 0x19, 0x18, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x00, 0x1F, 0x01, 0x01 } }; +static const struct symbol symbol_table[] = { SYM_ENTRY(sym_0), + SYM_ENTRY(sym_1), + SYM_ENTRY(sym_2), + SYM_ENTRY(sym_3), + SYM_ENTRY(sym_4), + SYM_ENTRY(sym_5), + SYM_ENTRY(sym_6), + SYM_ENTRY(sym_7), + SYM_ENTRY(sym_8), + SYM_ENTRY(sym_9), + SYM_ENTRY(sym_colon), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_a), + SYM_ENTRY(sym_b), + SYM_ENTRY(sym_c), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_e), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_g), + SYM_ENTRY(sym_h), + SYM_ENTRY(sym_i), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_k), + SYM_ENTRY(sym_l), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_n), + SYM_ENTRY(sym_o), + SYM_ENTRY(sym_p), + SYM_ENTRY(sym_none), + SYM_ENTRY(sym_r), + SYM_ENTRY(sym_s), + SYM_ENTRY(sym_t), + SYM_ENTRY(sym_u) }; enum input { cw, ccw, click, hold }; @@ -182,50 +223,34 @@ static void lcd_write_kerning(const uint8_t length, lcd_write(0x00); } -static void lcd_write_symbol_page(const struct symbol* sym, +static void lcd_write_symbol_page(const struct symbol* symbol, const uint8_t page, const bool invert) { - for (uint8_t i = 0; i < sym->length; i++) + for (uint8_t i = 0; i < symbol->length; i++) if (invert) - lcd_write(~sym->symbol[page * sym->length + i]); + lcd_write(~symbol->data[page * symbol->length + i]); else - lcd_write(sym->symbol[page * sym->length + i]); + lcd_write(symbol->data[page * symbol->length + i]); } static void lcd_write_digit_page(const uint8_t digit, const uint8_t page, const bool invert) { - switch (digit) { - case 0: - lcd_write_symbol_page(&sym_0, page, invert); - break; - case 1: - lcd_write_symbol_page(&sym_1, page, invert); - break; - case 2: - lcd_write_symbol_page(&sym_2, page, invert); - break; - case 3: - lcd_write_symbol_page(&sym_3, page, invert); - break; - case 4: - lcd_write_symbol_page(&sym_4, page, invert); - break; - case 5: - lcd_write_symbol_page(&sym_5, page, invert); - break; - case 6: - lcd_write_symbol_page(&sym_6, page, invert); - break; - case 7: - lcd_write_symbol_page(&sym_7, page, invert); - break; - case 8: - lcd_write_symbol_page(&sym_8, page, invert); - break; - case 9: - lcd_write_symbol_page(&sym_9, page, invert); - break; + lcd_write_symbol_page(&symbol_table[digit], page, invert); +} + +static void lcd_write_character_page(const char character, + const uint8_t page, + const bool invert) { + lcd_write_symbol_page(&symbol_table[character - 48], page, invert); +} + +static void lcd_write_string_page(const char* string, + const uint8_t page, + const bool invert) { + for (uint8_t i = 0; i < strlen(string); i++) { + lcd_write_kerning(2, invert); + lcd_write_character_page(string[i], page, invert); } } @@ -308,12 +333,7 @@ static void lcd_home(void) { lcd_write(0xB0 + i); SPI_PORT |= (1 << LCD_CD); - lcd_write_kerning(2, ch1_selected); - lcd_write_symbol_page(&sym_c, i, ch1_selected); - lcd_write_kerning(2, ch1_selected); - lcd_write_symbol_page(&sym_h, i, ch1_selected); - lcd_write_kerning(2, ch1_selected); - lcd_write_symbol_page(&sym_1, i, ch1_selected); + lcd_write_string_page("CH1\0", i, ch1_selected); lcd_write_kerning(2, ch1_selected); SPI_PORT &= ~(1 << LCD_CD); @@ -322,12 +342,7 @@ static void lcd_home(void) { lcd_write(0xB2 + i); SPI_PORT |= (1 << LCD_CD); - lcd_write_kerning(2, ch2_selected); - lcd_write_symbol_page(&sym_c, i, ch2_selected); - lcd_write_kerning(2, ch2_selected); - lcd_write_symbol_page(&sym_h, i, ch2_selected); - lcd_write_kerning(2, ch2_selected); - lcd_write_symbol_page(&sym_2, i, ch2_selected); + lcd_write_string_page("CH2\0", i, ch2_selected); lcd_write_kerning(2, ch2_selected); SPI_PORT &= ~(1 << LCD_CD); @@ -336,23 +351,17 @@ static void lcd_home(void) { lcd_write(0xB4 + i); SPI_PORT |= (1 << LCD_CD); - lcd_write_kerning(2, ch3_selected); - lcd_write_symbol_page(&sym_c, i, ch3_selected); - lcd_write_kerning(2, ch3_selected); - lcd_write_symbol_page(&sym_h, i, ch3_selected); - lcd_write_kerning(2, ch3_selected); - lcd_write_symbol_page(&sym_3, i, ch3_selected); + lcd_write_string_page("CH3\0", i, ch3_selected); lcd_write_kerning(2, ch3_selected); SPI_PORT &= ~(1 << LCD_CD); - lcd_write(0x00); - lcd_write(0x10); + lcd_write(0x01); + lcd_write(0x12); lcd_write(0xB6 + i); SPI_PORT |= (1 << LCD_CD); + lcd_write_string_page("SETUP\0", i, setup_selected); lcd_write_kerning(2, setup_selected); - lcd_write_symbol_page(&sym_setup, i, setup_selected); - lcd_write_kerning(3, setup_selected); } } @@ -390,16 +399,8 @@ static void lcd_setup(void) { lcd_write(0xB0 + i); SPI_PORT |= (1 << LCD_CD); - lcd_write_kerning(32, true); - lcd_write_symbol_page(&sym_s, i, true); - lcd_write_kerning(2, true); - lcd_write_symbol_page(&sym_e, i, true); - lcd_write_kerning(2, true); - lcd_write_symbol_page(&sym_t, i, true); - lcd_write_kerning(2, true); - lcd_write_symbol_page(&sym_u, i, true); - lcd_write_kerning(2, true); - lcd_write_symbol_page(&sym_p, i, true); + lcd_write_kerning(30, true); + lcd_write_string_page("SETUP\0", i, true); lcd_write_kerning(33, true); } @@ -410,24 +411,7 @@ static void lcd_setup(void) { lcd_write(0xB2 + i); SPI_PORT |= (1 << LCD_CD); - lcd_write_kerning(2, contrast_selected); - lcd_write_symbol_page(&sym_c, i, contrast_selected); - lcd_write_kerning(2, contrast_selected); - lcd_write_symbol_page(&sym_o, i, contrast_selected); - lcd_write_kerning(2, contrast_selected); - lcd_write_symbol_page(&sym_n, i, contrast_selected); - lcd_write_kerning(2, contrast_selected); - lcd_write_symbol_page(&sym_t, i, contrast_selected); - lcd_write_kerning(2, contrast_selected); - lcd_write_symbol_page(&sym_r, i, contrast_selected); - lcd_write_kerning(2, contrast_selected); - lcd_write_symbol_page(&sym_a, i, contrast_selected); - lcd_write_kerning(2, contrast_selected); - lcd_write_symbol_page(&sym_s, i, contrast_selected); - lcd_write_kerning(2, contrast_selected); - lcd_write_symbol_page(&sym_t, i, contrast_selected); - lcd_write_kerning(2, contrast_selected); - lcd_write_symbol_page(&sym_colon, i, contrast_selected); + lcd_write_string_page("CONTRAST:\0", i, contrast_selected); lcd_write_kerning(2, contrast_selected); lcd_write_kerning(16, false); lcd_write_integer_page(value_contrast, 2, i, change_contrast_selected); @@ -441,26 +425,7 @@ static void lcd_setup(void) { lcd_write(0xB4 + i); SPI_PORT |= (1 << LCD_CD); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_b, i, backlight_selected); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_a, i, backlight_selected); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_c, i, backlight_selected); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_k, i, backlight_selected); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_l, i, backlight_selected); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_i, i, backlight_selected); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_g, i, backlight_selected); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_h, i, backlight_selected); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_t, i, backlight_selected); - lcd_write_kerning(2, backlight_selected); - lcd_write_symbol_page(&sym_colon, i, backlight_selected); + lcd_write_string_page("BACKLIGHT:\0", i, backlight_selected); lcd_write_kerning(2, backlight_selected); lcd_write_kerning(5, false); lcd_write_integer_page(value_backlight, 3, i, change_backlight_selected); @@ -474,14 +439,7 @@ static void lcd_setup(void) { lcd_write(0xB6 + i); SPI_PORT |= (1 << LCD_CD); - lcd_write_kerning(2, back_selected); - lcd_write_symbol_page(&sym_b, i, back_selected); - lcd_write_kerning(2, back_selected); - lcd_write_symbol_page(&sym_a, i, back_selected); - lcd_write_kerning(2, back_selected); - lcd_write_symbol_page(&sym_c, i, back_selected); - lcd_write_kerning(2, back_selected); - lcd_write_symbol_page(&sym_k, i, back_selected); + lcd_write_string_page("BACK:\0", i, back_selected); lcd_write_kerning(2, back_selected); } }