#ifndef __DRV_ST7789_H__ #define __DRV_ST7789_H__ #include "kt.h" #define LCD_SPI_CFG 2 #define LCD_RST_PIN IO_PORTB_07 #define LCD_CS_PIN IO_PORTB_08 #define LCD_CLK_PIN IO_PORTB_09 #define LCD_DATA_PIN IO_PORTB_10 #define LCD_DC_PIN IO_PORTB_11 #define LCD_TE_PIN IO_PORTA_12 #define LCD_BL_PIN IO_PORTC_02 #define USE_HORIZONTAL 1 #define LCD_COLUMN_OFFSET 0 #define LCD_LINE_OFFSET 0 #if USE_HORIZONTAL == 0 #define LCD_W 240 #define LCD_H 320 #else /* 1/2/3 对应 MADCTL 行列交换,逻辑尺寸为 320x240 */ #define LCD_W 320 #define LCD_H 240 #endif #define WHITE 0xFFFF #define BLACK 0x0000 #define BLUE 0x001F #define BRED 0XF81F #define GRED 0XFFE0 #define GBLUE 0X07FF #define RED 0xF800 #define MAGENTA 0xF81F #define GREEN 0x07E0 #define CYAN 0x7FFF #define YELLOW 0xFFE0 #define BROWN 0XBC40 #define BRRED 0XFC07 #define GRAY 0X8430 #define DARKBLUE 0X01CF #define LIGHTBLUE 0X7D7C #define GRAYBLUE 0X5458 #define LIGHTGREEN 0X841F #define LGRAY 0XC618 #define LGRAYBLUE 0XA651 #define LBBLUE 0X2B12 void lcd_fill_frame_lv(int x1, int y1, int x2, int y2, u16 *color); void lcd_st7789_init(void); #endif