1 /* 2 * Copyright (c) 2006-2025, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2025-05-23 godmial Refactor to conform to RT-Thread coding style. 9 */ 10 11 #ifndef __DRV_LCD_H__ 12 #define __DRV_LCD_H__ 13 14 #include <stdint.h> 15 #include <string.h> 16 #include <stdio.h> 17 #ifdef BSP_USING_SDRAM 18 #include <sdram_port.h> 19 #endif /* BSP_USING_SDRAM */ 20 21 /******************************************************************************* 22 * Definitions 23 ******************************************************************************/ 24 25 /* LCD resolution and pixel format */ 26 #define LCD_WIDTH 800 27 #define LCD_HEIGHT 480 28 #define LCD_FB_BYTE_PER_PIXEL 1 29 30 /* Timing parameters for horizontal synchronization */ 31 #define HORIZONTAL_SYNCHRONOUS_PULSE 10 32 #define HORIZONTAL_BACK_PORCH 150 33 #define ACTIVE_WIDTH 800 34 #define HORIZONTAL_FRONT_PORCH 15 35 36 /* Timing parameters for vertical synchronization */ 37 #define VERTICAL_SYNCHRONOUS_PULSE 10 38 #define VERTICAL_BACK_PORCH 140 39 #define ACTIVE_HEIGHT 480 40 #define VERTICAL_FRONT_PORCH 40 41 42 /* Framebuffer address in SDRAM */ 43 #define LCD_FRAME_BUF_ADDR 0xC0000000 /* SDRAM address for LCD frame buffer */ 44 45 /* Pen color definitions (RGB565) */ 46 #define WHITE 0xFFFF /* White */ 47 #define BLACK 0x0000 /* Black */ 48 #define BLUE 0x001F /* Blue */ 49 #define BRED 0xF81F /* Blue-Red */ 50 #define GRED 0xFFE0 /* Green-Red */ 51 #define GBLUE 0x07FF /* Green-Blue */ 52 #define RED 0xF800 /* Red */ 53 #define MAGENTA 0xF81F /* Magenta */ 54 #define GREEN 0x07E0 /* Green */ 55 #define CYAN 0x7FFF /* Cyan */ 56 #define YELLOW 0xFFE0 /* Yellow */ 57 #define BROWN 0xBC40 /* Brown */ 58 #define BRRED 0xFC07 /* Brownish red */ 59 #define GRAY 0x8430 /* Gray */ 60 61 /* GUI color definitions */ 62 #define DARKBLUE 0x01CF /* Dark blue */ 63 #define LIGHTBLUE 0x7D7C /* Light blue */ 64 #define GRAYBLUE 0x5458 /* Grayish blue */ 65 #define LIGHTGREEN 0x841F /* Light green */ 66 #define LGRAY 0xC618 /* Light gray (panel background) */ 67 #define LGRAYBLUE 0xA651 /* Light gray-blue (layer color) */ 68 #define LBBLUE 0x2B12 /* Light brown-blue (selected item reverse color) */ 69 70 /* Frame buffer declaration based on compiler */ 71 #if defined(__CC_ARM) || defined(__ARMCC_VERSION) 72 /* Keil MDK Compiler */ 73 extern uint16_t ltdc_lcd_framebuf0[800][480] __attribute__((at(LCD_FRAME_BUF_ADDR))); 74 #elif defined(__GNUC__) 75 /* GCC Compiler (used by RT-Thread) */ 76 extern uint16_t ltdc_lcd_framebuf0[10][10]; /* Dummy for GCC compilation */ 77 #endif 78 79 /******************************************************************************* 80 * API 81 ******************************************************************************/ 82 83 #ifdef __cplusplus 84 extern "C" { 85 #endif 86 87 /** 88 * @brief Configure the LCD display controller. 89 * 90 * @note This function initializes display timing and output settings. 91 */ 92 void lcd_disp_config(void); 93 94 #ifdef __cplusplus 95 } 96 #endif 97 98 #endif /* __DRV_LCD_H__ */ 99