#pragma once #include #include /* Logical landscape; the driver maps it onto the native 240x320 GRAM. */ #define LCD_WIDTH 320 #define LCD_HEIGHT 240 #define RGB565(r, g, b) ((uint16_t)((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | ((b) >> 3))) #define LCD_BLACK 0x0000 #define LCD_WHITE 0xFFFF #define LCD_RED 0xF800 #define LCD_GREEN 0x07E0 #define LCD_BLUE 0x001F #define LCD_YELLOW 0xFFE0 #define LCD_CYAN 0x07FF #define LCD_MAGENTA 0xF81F #define LCD_GRAY 0x8410 #define LCD_DKGRAY 0x4208 /* UI palette (dark mixer look) */ #define UI_BG RGB565(10, 14, 20) #define UI_PANEL RGB565(22, 30, 42) #define UI_SEL RGB565(28, 48, 72) #define UI_ACCENT RGB565(0, 200, 210) #define UI_ACCENT2 RGB565(255, 170, 40) #define UI_MUTED RGB565(120, 130, 145) #define UI_BAR_BG RGB565(40, 52, 68) #define UI_BAR_HI RGB565(80, 230, 170) #define UI_TEXT RGB565(235, 240, 245) void lcd_init(void); uint32_t lcd_read_id(void); void lcd_selftest(void); void lcd_set_backlight(uint8_t percent); void lcd_fill(uint16_t color); void lcd_fill_rect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); /* * Blit row-major RGB565 (SPI byte order already). With MADCTL_MV the panel * consumes the window column-by-column — this converts order on the wire. * src_stride_bytes: bytes per source row (0 = tightly packed w*2). */ void lcd_blit(int16_t x, int16_t y, int16_t w, int16_t h, const uint8_t *px, int32_t src_stride_bytes); void lcd_draw_char(int16_t x, int16_t y, char c, uint16_t fg, uint16_t bg, uint8_t scale); void lcd_draw_string(int16_t x, int16_t y, const char *s, uint16_t fg, uint16_t bg, uint8_t scale);