STM32F429ZI Discovery board drivers
Dependents: 2a 2b 2c 2d1 ... more
ili9341.h
00001 /** 00002 ****************************************************************************** 00003 * @file ili9341.h 00004 * @author MCD Application Team 00005 * @version V1.0.2 00006 * @date 02-December-2014 00007 * @brief This file contains all the functions prototypes for the ili9341.c 00008 * driver. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> 00013 * 00014 * Redistribution and use in source and binary forms, with or without modification, 00015 * are permitted provided that the following conditions are met: 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 2. Redistributions in binary form must reproduce the above copyright notice, 00019 * this list of conditions and the following disclaimer in the documentation 00020 * and/or other materials provided with the distribution. 00021 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00033 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00034 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 ****************************************************************************** 00037 */ 00038 00039 /* Define to prevent recursive inclusion -------------------------------------*/ 00040 #ifndef __ILI9341_H 00041 #define __ILI9341_H 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00047 /* Includes ------------------------------------------------------------------*/ 00048 #include "../Common/lcd.h" 00049 00050 /** @addtogroup BSP 00051 * @{ 00052 */ 00053 00054 /** @addtogroup Components 00055 * @{ 00056 */ 00057 00058 /** @addtogroup ILI9341 00059 * @{ 00060 */ 00061 00062 /** @defgroup ILI9341_Exported_Types 00063 * @{ 00064 */ 00065 /** 00066 * @} 00067 */ 00068 00069 /** @defgroup ILI9341_Exported_Constants 00070 * @{ 00071 */ 00072 00073 /** 00074 * @brief ILI9341 chip IDs 00075 */ 00076 #define ILI9341_ID 0x9341 00077 00078 /** 00079 * @brief ILI9341 Size 00080 */ 00081 #define ILI9341_LCD_PIXEL_WIDTH ((uint16_t)240) 00082 #define ILI9341_LCD_PIXEL_HEIGHT ((uint16_t)320) 00083 00084 /** 00085 * @brief ILI9341 Timing 00086 */ 00087 /* Timing configuration (Typical configuration from ILI9341 datasheet) 00088 HSYNC=10 (9+1) 00089 HBP=20 (29-10+1) 00090 ActiveW=240 (269-20-10+1) 00091 HFP=10 (279-240-20-10+1) 00092 00093 VSYNC=2 (1+1) 00094 VBP=2 (3-2+1) 00095 ActiveH=320 (323-2-2+1) 00096 VFP=4 (327-320-2-2+1) 00097 */ 00098 #define ILI9341_HSYNC ((uint32_t)9) /* Horizontal synchronization */ 00099 #define ILI9341_HBP ((uint32_t)29) /* Horizontal back porch */ 00100 #define ILI9341_HFP ((uint32_t)2) /* Horizontal front porch */ 00101 #define ILI9341_VSYNC ((uint32_t)1) /* Vertical synchronization */ 00102 #define ILI9341_VBP ((uint32_t)3) /* Vertical back porch */ 00103 #define ILI9341_VFP ((uint32_t)2) /* Vertical front porch */ 00104 00105 /** 00106 * @brief ILI9341 Registers 00107 */ 00108 00109 /* Level 1 Commands */ 00110 #define LCD_SWRESET 0x01 /* Software Reset */ 00111 #define LCD_READ_DISPLAY_ID 0x04 /* Read display identification information */ 00112 #define LCD_RDDST 0x09 /* Read Display Status */ 00113 #define LCD_RDDPM 0x0A /* Read Display Power Mode */ 00114 #define LCD_RDDMADCTL 0x0B /* Read Display MADCTL */ 00115 #define LCD_RDDCOLMOD 0x0C /* Read Display Pixel Format */ 00116 #define LCD_RDDIM 0x0D /* Read Display Image Format */ 00117 #define LCD_RDDSM 0x0E /* Read Display Signal Mode */ 00118 #define LCD_RDDSDR 0x0F /* Read Display Self-Diagnostic Result */ 00119 #define LCD_SPLIN 0x10 /* Enter Sleep Mode */ 00120 #define LCD_SLEEP_OUT 0x11 /* Sleep out register */ 00121 #define LCD_PTLON 0x12 /* Partial Mode ON */ 00122 #define LCD_NORMAL_MODE_ON 0x13 /* Normal Display Mode ON */ 00123 #define LCD_DINVOFF 0x20 /* Display Inversion OFF */ 00124 #define LCD_DINVON 0x21 /* Display Inversion ON */ 00125 #define LCD_GAMMA 0x26 /* Gamma register */ 00126 #define LCD_DISPLAY_OFF 0x28 /* Display off register */ 00127 #define LCD_DISPLAY_ON 0x29 /* Display on register */ 00128 #define LCD_COLUMN_ADDR 0x2A /* Colomn address register */ 00129 #define LCD_PAGE_ADDR 0x2B /* Page address register */ 00130 #define LCD_GRAM 0x2C /* GRAM register */ 00131 #define LCD_RGBSET 0x2D /* Color SET */ 00132 #define LCD_RAMRD 0x2E /* Memory Read */ 00133 #define LCD_PLTAR 0x30 /* Partial Area */ 00134 #define LCD_VSCRDEF 0x33 /* Vertical Scrolling Definition */ 00135 #define LCD_TEOFF 0x34 /* Tearing Effect Line OFF */ 00136 #define LCD_TEON 0x35 /* Tearing Effect Line ON */ 00137 #define LCD_MAC 0x36 /* Memory Access Control register*/ 00138 #define LCD_VSCRSADD 0x37 /* Vertical Scrolling Start Address */ 00139 #define LCD_IDMOFF 0x38 /* Idle Mode OFF */ 00140 #define LCD_IDMON 0x39 /* Idle Mode ON */ 00141 #define LCD_PIXEL_FORMAT 0x3A /* Pixel Format register */ 00142 #define LCD_WRITE_MEM_CONTINUE 0x3C /* Write Memory Continue */ 00143 #define LCD_READ_MEM_CONTINUE 0x3E /* Read Memory Continue */ 00144 #define LCD_SET_TEAR_SCANLINE 0x44 /* Set Tear Scanline */ 00145 #define LCD_GET_SCANLINE 0x45 /* Get Scanline */ 00146 #define LCD_WDB 0x51 /* Write Brightness Display register */ 00147 #define LCD_RDDISBV 0x52 /* Read Display Brightness */ 00148 #define LCD_WCD 0x53 /* Write Control Display register*/ 00149 #define LCD_RDCTRLD 0x54 /* Read CTRL Display */ 00150 #define LCD_WRCABC 0x55 /* Write Content Adaptive Brightness Control */ 00151 #define LCD_RDCABC 0x56 /* Read Content Adaptive Brightness Control */ 00152 #define LCD_WRITE_CABC 0x5E /* Write CABC Minimum Brightness */ 00153 #define LCD_READ_CABC 0x5F /* Read CABC Minimum Brightness */ 00154 #define LCD_READ_ID1 0xDA /* Read ID1 */ 00155 #define LCD_READ_ID2 0xDB /* Read ID2 */ 00156 #define LCD_READ_ID3 0xDC /* Read ID3 */ 00157 00158 /* Level 2 Commands */ 00159 #define LCD_RGB_INTERFACE 0xB0 /* RGB Interface Signal Control */ 00160 #define LCD_FRMCTR1 0xB1 /* Frame Rate Control (In Normal Mode) */ 00161 #define LCD_FRMCTR2 0xB2 /* Frame Rate Control (In Idle Mode) */ 00162 #define LCD_FRMCTR3 0xB3 /* Frame Rate Control (In Partial Mode) */ 00163 #define LCD_INVTR 0xB4 /* Display Inversion Control */ 00164 #define LCD_BPC 0xB5 /* Blanking Porch Control register */ 00165 #define LCD_DFC 0xB6 /* Display Function Control register */ 00166 #define LCD_ETMOD 0xB7 /* Entry Mode Set */ 00167 #define LCD_BACKLIGHT1 0xB8 /* Backlight Control 1 */ 00168 #define LCD_BACKLIGHT2 0xB9 /* Backlight Control 2 */ 00169 #define LCD_BACKLIGHT3 0xBA /* Backlight Control 3 */ 00170 #define LCD_BACKLIGHT4 0xBB /* Backlight Control 4 */ 00171 #define LCD_BACKLIGHT5 0xBC /* Backlight Control 5 */ 00172 #define LCD_BACKLIGHT7 0xBE /* Backlight Control 7 */ 00173 #define LCD_BACKLIGHT8 0xBF /* Backlight Control 8 */ 00174 #define LCD_POWER1 0xC0 /* Power Control 1 register */ 00175 #define LCD_POWER2 0xC1 /* Power Control 2 register */ 00176 #define LCD_VCOM1 0xC5 /* VCOM Control 1 register */ 00177 #define LCD_VCOM2 0xC7 /* VCOM Control 2 register */ 00178 #define LCD_NVMWR 0xD0 /* NV Memory Write */ 00179 #define LCD_NVMPKEY 0xD1 /* NV Memory Protection Key */ 00180 #define LCD_RDNVM 0xD2 /* NV Memory Status Read */ 00181 #define LCD_READ_ID4 0xD3 /* Read ID4 */ 00182 #define LCD_PGAMMA 0xE0 /* Positive Gamma Correction register */ 00183 #define LCD_NGAMMA 0xE1 /* Negative Gamma Correction register */ 00184 #define LCD_DGAMCTRL1 0xE2 /* Digital Gamma Control 1 */ 00185 #define LCD_DGAMCTRL2 0xE3 /* Digital Gamma Control 2 */ 00186 #define LCD_INTERFACE 0xF6 /* Interface control register */ 00187 00188 /* Extend register commands */ 00189 #define LCD_POWERA 0xCB /* Power control A register */ 00190 #define LCD_POWERB 0xCF /* Power control B register */ 00191 #define LCD_DTCA 0xE8 /* Driver timing control A */ 00192 #define LCD_DTCB 0xEA /* Driver timing control B */ 00193 #define LCD_POWER_SEQ 0xED /* Power on sequence register */ 00194 #define LCD_3GAMMA_EN 0xF2 /* 3 Gamma enable register */ 00195 #define LCD_PRC 0xF7 /* Pump ratio control register */ 00196 00197 /* Size of read registers */ 00198 #define LCD_READ_ID4_SIZE 3 /* Size of Read ID4 */ 00199 00200 /** 00201 * @} 00202 */ 00203 00204 /** @defgroup ILI9341_Exported_Functions 00205 * @{ 00206 */ 00207 void ili9341_Init(void); 00208 uint16_t ili9341_ReadID(void); 00209 void ili9341_WriteReg(uint8_t LCD_Reg); 00210 void ili9341_WriteData(uint16_t RegValue); 00211 uint32_t ili9341_ReadData(uint16_t RegValue, uint8_t ReadSize); 00212 void ili9341_DisplayOn(void); 00213 void ili9341_DisplayOff(void); 00214 uint16_t ili9341_GetLcdPixelWidth(void); 00215 uint16_t ili9341_GetLcdPixelHeight(void); 00216 00217 /* LCD driver structure */ 00218 extern LCD_DrvTypeDef ili9341_drv; 00219 00220 /* LCD IO functions */ 00221 void LCD_IO_Init(void); 00222 void LCD_IO_WriteData(uint16_t RegValue); 00223 void LCD_IO_WriteReg(uint8_t Reg); 00224 uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize); 00225 void LCD_Delay (uint32_t delay); 00226 00227 #ifdef __cplusplus 00228 } 00229 #endif 00230 00231 #endif /* __ILI9341_H */ 00232 00233 /** 00234 * @} 00235 */ 00236 00237 /** 00238 * @} 00239 */ 00240 00241 /** 00242 * @} 00243 */ 00244 00245 /** 00246 * @} 00247 */ 00248 00249 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 16:29:22 by 1.7.2