1 #ifndef __LCD_H 2 #define __LCD_H 3 4 #include <rtthread.h> 5 #include <rtdevice.h> 6 #include <board.h> 7 #include "st7735.h" 8 #include <stdio.h> 9 10 #define WHITE 0xFFFF 11 #define BLACK 0x0000 12 #define BLUE 0x001F 13 #define BRED 0XF81F 14 #define GRED 0XFFE0 15 #define GBLUE 0X07FF 16 #define RED 0xF800 17 #define MAGENTA 0xF81F 18 #define GREEN 0x07E0 19 #define CYAN 0x7FFF 20 #define YELLOW 0xFFE0 21 #define BROWN 0XBC40 //棕色 22 #define BRRED 0XFC07 //棕红色 23 #define GRAY 0X8430 //灰色 24 #define DARKBLUE 0X01CF //深蓝色 25 #define LIGHTBLUE 0X7D7C //浅蓝色 26 #define GRAYBLUE 0X5458 //灰蓝色 27 28 // lcd spi 29 #define LCD_SPI_DEVICE_NAME "spi40" 30 #define LCD_PWM_DEV_NAME "pwm1" 31 #define LCD_PWM_DEV_CHANNEL (2) 32 #define LCD_PWM_DEV_TIME (10000)//pwm frequency:100K = 10000ns 33 #define MAX_BRIGHTNESS LCD_PWM_DEV_TIME 34 35 #define WR_RS_PIN GET_PIN(E, 13) 36 #define CS_PIN GET_PIN(E, 11) 37 38 //lcd display gpio 39 #define LCD_DISP_GPIO_NUM GET_PIN(E, 10) 40 41 // lcd brush color 42 #define BRUSH_POINT_COLOR WHITE 43 #define BRUSH_BACK_COLOR BLACK 44 45 extern ST7735_Object_t st7735_pObj; 46 extern uint32_t st7735_id; 47 48 void LCD_SetBrightness(uint32_t Brightness); 49 uint32_t LCD_GetBrightness(void); 50 void LCD_ShowChar(uint16_t x,uint16_t y,uint8_t num,uint8_t size,uint8_t mode); 51 void LCD_ShowString(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint8_t size,uint8_t *p); 52 void LCD_FillRGBRect(uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height); 53 54 55 #endif 56