1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2021-10-14 spaceman first version 9 */ 10 11 #include <board.h> 12 13 // #define XSIZE_PHYS 800 14 // #define YSIZE_PHYS 480 15 // extern __align(256) rt_uint32_t LTDC_Buf[XSIZE_PHYS*YSIZE_PHYS]; 16 #define LCD_SPI_CS(a) \ 17 if (a) \ 18 GPIOB->BSRR = GPIO_Pin_11; \ 19 else \ 20 GPIOB->BRR = GPIO_Pin_11; 21 #define SPI_DCLK(a) \ 22 if (a) \ 23 GPIOB->BSRR = GPIO_Pin_9; \ 24 else \ 25 GPIOB->BRR = GPIO_Pin_9; 26 #define SPI_SDA(a) \ 27 if (a) \ 28 GPIOB->BSRR = GPIO_Pin_0; \ 29 else \ 30 GPIOB->BRR = GPIO_Pin_0; 31 32 #define LCD_RST(a) \ 33 if (a) \ 34 GPIOD->BSRR = GPIO_Pin_6; \ 35 else \ 36 GPIOD->BRR = GPIO_Pin_6; 37 #define Set_Rst GPIOD->BSRR = GPIO_Pin_6 38 #define Clr_Rst GPIOD->BRR = GPIO_Pin_6 39 #define Lcd_Light_ON GPIOD->BSRR = GPIO_Pin_8 //PD8为高电平 背光打开 40 #define Lcd_Light_OFF GPIOD->BRR = GPIO_Pin_8 //PD8为低电平 背光关闭 41 42 //************* 24位色(1600万色)定义 *************// 43 #define White 0xFFFFFF 44 #define Black 0x000000 45 #define Blue 0xFF0000 46 #define Blue2 0xFF3F3F 47 #define Red 0x0000FF 48 #define Magenta 0xFF00FF 49 #define Green 0x00FF00 50 #define Cyan 0xFFFF00 51 #define Yellow 0x00FFFF 52 53 //************* 16位色定义 *************// 54 //#define White 0xFFFF 55 //#define Black 0x0000 56 //#define Blue 0x001F 57 //#define Blue2 0x051F 58 //#define Red 0xF800 59 //#define Magenta 0xF81F 60 //#define Green 0x07E0 61 //#define Cyan 0x7FFF 62 //#define Yellow 0xFFE0 63 64 65 66 void LCD_Initial(rt_uint32_t LTDC_Buf1, rt_uint32_t LTDC_Buf2); //LCD初始化函数 67 // volatile void LCD_delay(volatile int time); 68 // void WriteComm(unsigned char CMD); 69 // void WriteData(rt_uint32_t dat); 70 // void LCD_WR_REG(rt_uint16_t Index,rt_uint16_t CongfigTemp); 71 // void Lcd_ColorBox(rt_uint16_t xStart,rt_uint16_t yStart,rt_uint16_t xLong,rt_uint16_t yLong,rt_uint32_t Color); 72 //void SPILCD_DrawLine(unsigned short x1,unsigned short y1,unsigned short x2,unsigned short y2,unsigned short color); 73 //void SPILCD_ShowChar(unsigned short x,unsigned short y,unsigned char num, unsigned int fColor, unsigned int bColor,unsigned char flag) ; 74 // void LCD_PutString(unsigned short x, unsigned short y, char *s, unsigned int fColor, unsigned int bColor,unsigned char flag); 75 // void LCD_Fill_Pic(rt_uint16_t x, rt_uint16_t y,rt_uint16_t pic_H, rt_uint16_t pic_V, rt_uint32_t* pic); 76