STM32F429ZI Discovery board drivers

Dependents:   2a 2b 2c 2d1 ... more

Committer:
Jerome Coutant
Date:
Wed Feb 28 13:17:14 2018 +0100
Revision:
2:53d9067a4feb
Parent:
1:2371382139dd
STM32Cube_FW_F4_V1.19.0 BSP_DISCO_F429ZI

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jerome Coutant 1:2371382139dd 1 /**
Jerome Coutant 1:2371382139dd 2 ******************************************************************************
Jerome Coutant 1:2371382139dd 3 * @file ili9341.h
Jerome Coutant 1:2371382139dd 4 * @author MCD Application Team
Jerome Coutant 1:2371382139dd 5 * @version V1.0.2
Jerome Coutant 1:2371382139dd 6 * @date 02-December-2014
Jerome Coutant 1:2371382139dd 7 * @brief This file contains all the functions prototypes for the ili9341.c
Jerome Coutant 1:2371382139dd 8 * driver.
Jerome Coutant 1:2371382139dd 9 ******************************************************************************
Jerome Coutant 1:2371382139dd 10 * @attention
Jerome Coutant 1:2371382139dd 11 *
Jerome Coutant 1:2371382139dd 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Jerome Coutant 1:2371382139dd 13 *
Jerome Coutant 1:2371382139dd 14 * Redistribution and use in source and binary forms, with or without modification,
Jerome Coutant 1:2371382139dd 15 * are permitted provided that the following conditions are met:
Jerome Coutant 1:2371382139dd 16 * 1. Redistributions of source code must retain the above copyright notice,
Jerome Coutant 1:2371382139dd 17 * this list of conditions and the following disclaimer.
Jerome Coutant 1:2371382139dd 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Jerome Coutant 1:2371382139dd 19 * this list of conditions and the following disclaimer in the documentation
Jerome Coutant 1:2371382139dd 20 * and/or other materials provided with the distribution.
Jerome Coutant 1:2371382139dd 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Jerome Coutant 1:2371382139dd 22 * may be used to endorse or promote products derived from this software
Jerome Coutant 1:2371382139dd 23 * without specific prior written permission.
Jerome Coutant 1:2371382139dd 24 *
Jerome Coutant 1:2371382139dd 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Jerome Coutant 1:2371382139dd 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Jerome Coutant 1:2371382139dd 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Jerome Coutant 1:2371382139dd 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Jerome Coutant 1:2371382139dd 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Jerome Coutant 1:2371382139dd 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Jerome Coutant 1:2371382139dd 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Jerome Coutant 1:2371382139dd 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Jerome Coutant 1:2371382139dd 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Jerome Coutant 1:2371382139dd 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Jerome Coutant 1:2371382139dd 35 *
Jerome Coutant 1:2371382139dd 36 ******************************************************************************
Jerome Coutant 1:2371382139dd 37 */
Jerome Coutant 1:2371382139dd 38
Jerome Coutant 1:2371382139dd 39 /* Define to prevent recursive inclusion -------------------------------------*/
Jerome Coutant 1:2371382139dd 40 #ifndef __ILI9341_H
Jerome Coutant 1:2371382139dd 41 #define __ILI9341_H
Jerome Coutant 1:2371382139dd 42
Jerome Coutant 1:2371382139dd 43 #ifdef __cplusplus
Jerome Coutant 1:2371382139dd 44 extern "C" {
Jerome Coutant 1:2371382139dd 45 #endif
Jerome Coutant 1:2371382139dd 46
Jerome Coutant 1:2371382139dd 47 /* Includes ------------------------------------------------------------------*/
Jerome Coutant 1:2371382139dd 48 #include "../Common/lcd.h"
Jerome Coutant 1:2371382139dd 49
Jerome Coutant 1:2371382139dd 50 /** @addtogroup BSP
Jerome Coutant 1:2371382139dd 51 * @{
Jerome Coutant 1:2371382139dd 52 */
Jerome Coutant 1:2371382139dd 53
Jerome Coutant 1:2371382139dd 54 /** @addtogroup Components
Jerome Coutant 1:2371382139dd 55 * @{
Jerome Coutant 1:2371382139dd 56 */
Jerome Coutant 1:2371382139dd 57
Jerome Coutant 1:2371382139dd 58 /** @addtogroup ILI9341
Jerome Coutant 1:2371382139dd 59 * @{
Jerome Coutant 1:2371382139dd 60 */
Jerome Coutant 1:2371382139dd 61
Jerome Coutant 1:2371382139dd 62 /** @defgroup ILI9341_Exported_Types
Jerome Coutant 1:2371382139dd 63 * @{
Jerome Coutant 1:2371382139dd 64 */
Jerome Coutant 1:2371382139dd 65 /**
Jerome Coutant 1:2371382139dd 66 * @}
Jerome Coutant 1:2371382139dd 67 */
Jerome Coutant 1:2371382139dd 68
Jerome Coutant 1:2371382139dd 69 /** @defgroup ILI9341_Exported_Constants
Jerome Coutant 1:2371382139dd 70 * @{
Jerome Coutant 1:2371382139dd 71 */
Jerome Coutant 1:2371382139dd 72
Jerome Coutant 1:2371382139dd 73 /**
Jerome Coutant 1:2371382139dd 74 * @brief ILI9341 chip IDs
Jerome Coutant 1:2371382139dd 75 */
Jerome Coutant 1:2371382139dd 76 #define ILI9341_ID 0x9341
Jerome Coutant 1:2371382139dd 77
Jerome Coutant 1:2371382139dd 78 /**
Jerome Coutant 1:2371382139dd 79 * @brief ILI9341 Size
Jerome Coutant 1:2371382139dd 80 */
Jerome Coutant 1:2371382139dd 81 #define ILI9341_LCD_PIXEL_WIDTH ((uint16_t)240)
Jerome Coutant 1:2371382139dd 82 #define ILI9341_LCD_PIXEL_HEIGHT ((uint16_t)320)
Jerome Coutant 1:2371382139dd 83
Jerome Coutant 1:2371382139dd 84 /**
Jerome Coutant 1:2371382139dd 85 * @brief ILI9341 Timing
Jerome Coutant 1:2371382139dd 86 */
Jerome Coutant 1:2371382139dd 87 /* Timing configuration (Typical configuration from ILI9341 datasheet)
Jerome Coutant 1:2371382139dd 88 HSYNC=10 (9+1)
Jerome Coutant 1:2371382139dd 89 HBP=20 (29-10+1)
Jerome Coutant 1:2371382139dd 90 ActiveW=240 (269-20-10+1)
Jerome Coutant 1:2371382139dd 91 HFP=10 (279-240-20-10+1)
Jerome Coutant 1:2371382139dd 92
Jerome Coutant 1:2371382139dd 93 VSYNC=2 (1+1)
Jerome Coutant 1:2371382139dd 94 VBP=2 (3-2+1)
Jerome Coutant 1:2371382139dd 95 ActiveH=320 (323-2-2+1)
Jerome Coutant 1:2371382139dd 96 VFP=4 (327-320-2-2+1)
Jerome Coutant 1:2371382139dd 97 */
Jerome Coutant 1:2371382139dd 98 #define ILI9341_HSYNC ((uint32_t)9) /* Horizontal synchronization */
Jerome Coutant 1:2371382139dd 99 #define ILI9341_HBP ((uint32_t)29) /* Horizontal back porch */
Jerome Coutant 1:2371382139dd 100 #define ILI9341_HFP ((uint32_t)2) /* Horizontal front porch */
Jerome Coutant 1:2371382139dd 101 #define ILI9341_VSYNC ((uint32_t)1) /* Vertical synchronization */
Jerome Coutant 1:2371382139dd 102 #define ILI9341_VBP ((uint32_t)3) /* Vertical back porch */
Jerome Coutant 1:2371382139dd 103 #define ILI9341_VFP ((uint32_t)2) /* Vertical front porch */
Jerome Coutant 1:2371382139dd 104
Jerome Coutant 1:2371382139dd 105 /**
Jerome Coutant 1:2371382139dd 106 * @brief ILI9341 Registers
Jerome Coutant 1:2371382139dd 107 */
Jerome Coutant 1:2371382139dd 108
Jerome Coutant 1:2371382139dd 109 /* Level 1 Commands */
Jerome Coutant 1:2371382139dd 110 #define LCD_SWRESET 0x01 /* Software Reset */
Jerome Coutant 1:2371382139dd 111 #define LCD_READ_DISPLAY_ID 0x04 /* Read display identification information */
Jerome Coutant 1:2371382139dd 112 #define LCD_RDDST 0x09 /* Read Display Status */
Jerome Coutant 1:2371382139dd 113 #define LCD_RDDPM 0x0A /* Read Display Power Mode */
Jerome Coutant 1:2371382139dd 114 #define LCD_RDDMADCTL 0x0B /* Read Display MADCTL */
Jerome Coutant 1:2371382139dd 115 #define LCD_RDDCOLMOD 0x0C /* Read Display Pixel Format */
Jerome Coutant 1:2371382139dd 116 #define LCD_RDDIM 0x0D /* Read Display Image Format */
Jerome Coutant 1:2371382139dd 117 #define LCD_RDDSM 0x0E /* Read Display Signal Mode */
Jerome Coutant 1:2371382139dd 118 #define LCD_RDDSDR 0x0F /* Read Display Self-Diagnostic Result */
Jerome Coutant 1:2371382139dd 119 #define LCD_SPLIN 0x10 /* Enter Sleep Mode */
Jerome Coutant 1:2371382139dd 120 #define LCD_SLEEP_OUT 0x11 /* Sleep out register */
Jerome Coutant 1:2371382139dd 121 #define LCD_PTLON 0x12 /* Partial Mode ON */
Jerome Coutant 1:2371382139dd 122 #define LCD_NORMAL_MODE_ON 0x13 /* Normal Display Mode ON */
Jerome Coutant 1:2371382139dd 123 #define LCD_DINVOFF 0x20 /* Display Inversion OFF */
Jerome Coutant 1:2371382139dd 124 #define LCD_DINVON 0x21 /* Display Inversion ON */
Jerome Coutant 1:2371382139dd 125 #define LCD_GAMMA 0x26 /* Gamma register */
Jerome Coutant 1:2371382139dd 126 #define LCD_DISPLAY_OFF 0x28 /* Display off register */
Jerome Coutant 1:2371382139dd 127 #define LCD_DISPLAY_ON 0x29 /* Display on register */
Jerome Coutant 1:2371382139dd 128 #define LCD_COLUMN_ADDR 0x2A /* Colomn address register */
Jerome Coutant 1:2371382139dd 129 #define LCD_PAGE_ADDR 0x2B /* Page address register */
Jerome Coutant 1:2371382139dd 130 #define LCD_GRAM 0x2C /* GRAM register */
Jerome Coutant 1:2371382139dd 131 #define LCD_RGBSET 0x2D /* Color SET */
Jerome Coutant 1:2371382139dd 132 #define LCD_RAMRD 0x2E /* Memory Read */
Jerome Coutant 1:2371382139dd 133 #define LCD_PLTAR 0x30 /* Partial Area */
Jerome Coutant 1:2371382139dd 134 #define LCD_VSCRDEF 0x33 /* Vertical Scrolling Definition */
Jerome Coutant 1:2371382139dd 135 #define LCD_TEOFF 0x34 /* Tearing Effect Line OFF */
Jerome Coutant 1:2371382139dd 136 #define LCD_TEON 0x35 /* Tearing Effect Line ON */
Jerome Coutant 1:2371382139dd 137 #define LCD_MAC 0x36 /* Memory Access Control register*/
Jerome Coutant 1:2371382139dd 138 #define LCD_VSCRSADD 0x37 /* Vertical Scrolling Start Address */
Jerome Coutant 1:2371382139dd 139 #define LCD_IDMOFF 0x38 /* Idle Mode OFF */
Jerome Coutant 1:2371382139dd 140 #define LCD_IDMON 0x39 /* Idle Mode ON */
Jerome Coutant 1:2371382139dd 141 #define LCD_PIXEL_FORMAT 0x3A /* Pixel Format register */
Jerome Coutant 1:2371382139dd 142 #define LCD_WRITE_MEM_CONTINUE 0x3C /* Write Memory Continue */
Jerome Coutant 1:2371382139dd 143 #define LCD_READ_MEM_CONTINUE 0x3E /* Read Memory Continue */
Jerome Coutant 1:2371382139dd 144 #define LCD_SET_TEAR_SCANLINE 0x44 /* Set Tear Scanline */
Jerome Coutant 1:2371382139dd 145 #define LCD_GET_SCANLINE 0x45 /* Get Scanline */
Jerome Coutant 1:2371382139dd 146 #define LCD_WDB 0x51 /* Write Brightness Display register */
Jerome Coutant 1:2371382139dd 147 #define LCD_RDDISBV 0x52 /* Read Display Brightness */
Jerome Coutant 1:2371382139dd 148 #define LCD_WCD 0x53 /* Write Control Display register*/
Jerome Coutant 1:2371382139dd 149 #define LCD_RDCTRLD 0x54 /* Read CTRL Display */
Jerome Coutant 1:2371382139dd 150 #define LCD_WRCABC 0x55 /* Write Content Adaptive Brightness Control */
Jerome Coutant 1:2371382139dd 151 #define LCD_RDCABC 0x56 /* Read Content Adaptive Brightness Control */
Jerome Coutant 1:2371382139dd 152 #define LCD_WRITE_CABC 0x5E /* Write CABC Minimum Brightness */
Jerome Coutant 1:2371382139dd 153 #define LCD_READ_CABC 0x5F /* Read CABC Minimum Brightness */
Jerome Coutant 1:2371382139dd 154 #define LCD_READ_ID1 0xDA /* Read ID1 */
Jerome Coutant 1:2371382139dd 155 #define LCD_READ_ID2 0xDB /* Read ID2 */
Jerome Coutant 1:2371382139dd 156 #define LCD_READ_ID3 0xDC /* Read ID3 */
Jerome Coutant 1:2371382139dd 157
Jerome Coutant 1:2371382139dd 158 /* Level 2 Commands */
Jerome Coutant 1:2371382139dd 159 #define LCD_RGB_INTERFACE 0xB0 /* RGB Interface Signal Control */
Jerome Coutant 1:2371382139dd 160 #define LCD_FRMCTR1 0xB1 /* Frame Rate Control (In Normal Mode) */
Jerome Coutant 1:2371382139dd 161 #define LCD_FRMCTR2 0xB2 /* Frame Rate Control (In Idle Mode) */
Jerome Coutant 1:2371382139dd 162 #define LCD_FRMCTR3 0xB3 /* Frame Rate Control (In Partial Mode) */
Jerome Coutant 1:2371382139dd 163 #define LCD_INVTR 0xB4 /* Display Inversion Control */
Jerome Coutant 1:2371382139dd 164 #define LCD_BPC 0xB5 /* Blanking Porch Control register */
Jerome Coutant 1:2371382139dd 165 #define LCD_DFC 0xB6 /* Display Function Control register */
Jerome Coutant 1:2371382139dd 166 #define LCD_ETMOD 0xB7 /* Entry Mode Set */
Jerome Coutant 1:2371382139dd 167 #define LCD_BACKLIGHT1 0xB8 /* Backlight Control 1 */
Jerome Coutant 1:2371382139dd 168 #define LCD_BACKLIGHT2 0xB9 /* Backlight Control 2 */
Jerome Coutant 1:2371382139dd 169 #define LCD_BACKLIGHT3 0xBA /* Backlight Control 3 */
Jerome Coutant 1:2371382139dd 170 #define LCD_BACKLIGHT4 0xBB /* Backlight Control 4 */
Jerome Coutant 1:2371382139dd 171 #define LCD_BACKLIGHT5 0xBC /* Backlight Control 5 */
Jerome Coutant 1:2371382139dd 172 #define LCD_BACKLIGHT7 0xBE /* Backlight Control 7 */
Jerome Coutant 1:2371382139dd 173 #define LCD_BACKLIGHT8 0xBF /* Backlight Control 8 */
Jerome Coutant 1:2371382139dd 174 #define LCD_POWER1 0xC0 /* Power Control 1 register */
Jerome Coutant 1:2371382139dd 175 #define LCD_POWER2 0xC1 /* Power Control 2 register */
Jerome Coutant 1:2371382139dd 176 #define LCD_VCOM1 0xC5 /* VCOM Control 1 register */
Jerome Coutant 1:2371382139dd 177 #define LCD_VCOM2 0xC7 /* VCOM Control 2 register */
Jerome Coutant 1:2371382139dd 178 #define LCD_NVMWR 0xD0 /* NV Memory Write */
Jerome Coutant 1:2371382139dd 179 #define LCD_NVMPKEY 0xD1 /* NV Memory Protection Key */
Jerome Coutant 1:2371382139dd 180 #define LCD_RDNVM 0xD2 /* NV Memory Status Read */
Jerome Coutant 1:2371382139dd 181 #define LCD_READ_ID4 0xD3 /* Read ID4 */
Jerome Coutant 1:2371382139dd 182 #define LCD_PGAMMA 0xE0 /* Positive Gamma Correction register */
Jerome Coutant 1:2371382139dd 183 #define LCD_NGAMMA 0xE1 /* Negative Gamma Correction register */
Jerome Coutant 1:2371382139dd 184 #define LCD_DGAMCTRL1 0xE2 /* Digital Gamma Control 1 */
Jerome Coutant 1:2371382139dd 185 #define LCD_DGAMCTRL2 0xE3 /* Digital Gamma Control 2 */
Jerome Coutant 1:2371382139dd 186 #define LCD_INTERFACE 0xF6 /* Interface control register */
Jerome Coutant 1:2371382139dd 187
Jerome Coutant 1:2371382139dd 188 /* Extend register commands */
Jerome Coutant 1:2371382139dd 189 #define LCD_POWERA 0xCB /* Power control A register */
Jerome Coutant 1:2371382139dd 190 #define LCD_POWERB 0xCF /* Power control B register */
Jerome Coutant 1:2371382139dd 191 #define LCD_DTCA 0xE8 /* Driver timing control A */
Jerome Coutant 1:2371382139dd 192 #define LCD_DTCB 0xEA /* Driver timing control B */
Jerome Coutant 1:2371382139dd 193 #define LCD_POWER_SEQ 0xED /* Power on sequence register */
Jerome Coutant 1:2371382139dd 194 #define LCD_3GAMMA_EN 0xF2 /* 3 Gamma enable register */
Jerome Coutant 1:2371382139dd 195 #define LCD_PRC 0xF7 /* Pump ratio control register */
Jerome Coutant 1:2371382139dd 196
Jerome Coutant 1:2371382139dd 197 /* Size of read registers */
Jerome Coutant 1:2371382139dd 198 #define LCD_READ_ID4_SIZE 3 /* Size of Read ID4 */
Jerome Coutant 1:2371382139dd 199
Jerome Coutant 1:2371382139dd 200 /**
Jerome Coutant 1:2371382139dd 201 * @}
Jerome Coutant 1:2371382139dd 202 */
Jerome Coutant 1:2371382139dd 203
Jerome Coutant 1:2371382139dd 204 /** @defgroup ILI9341_Exported_Functions
Jerome Coutant 1:2371382139dd 205 * @{
Jerome Coutant 1:2371382139dd 206 */
Jerome Coutant 1:2371382139dd 207 void ili9341_Init(void);
Jerome Coutant 1:2371382139dd 208 uint16_t ili9341_ReadID(void);
Jerome Coutant 1:2371382139dd 209 void ili9341_WriteReg(uint8_t LCD_Reg);
Jerome Coutant 1:2371382139dd 210 void ili9341_WriteData(uint16_t RegValue);
Jerome Coutant 1:2371382139dd 211 uint32_t ili9341_ReadData(uint16_t RegValue, uint8_t ReadSize);
Jerome Coutant 1:2371382139dd 212 void ili9341_DisplayOn(void);
Jerome Coutant 1:2371382139dd 213 void ili9341_DisplayOff(void);
Jerome Coutant 1:2371382139dd 214 uint16_t ili9341_GetLcdPixelWidth(void);
Jerome Coutant 1:2371382139dd 215 uint16_t ili9341_GetLcdPixelHeight(void);
Jerome Coutant 1:2371382139dd 216
Jerome Coutant 1:2371382139dd 217 /* LCD driver structure */
Jerome Coutant 1:2371382139dd 218 extern LCD_DrvTypeDef ili9341_drv;
Jerome Coutant 1:2371382139dd 219
Jerome Coutant 1:2371382139dd 220 /* LCD IO functions */
Jerome Coutant 1:2371382139dd 221 void LCD_IO_Init(void);
Jerome Coutant 1:2371382139dd 222 void LCD_IO_WriteData(uint16_t RegValue);
Jerome Coutant 1:2371382139dd 223 void LCD_IO_WriteReg(uint8_t Reg);
Jerome Coutant 1:2371382139dd 224 uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize);
Jerome Coutant 1:2371382139dd 225 void LCD_Delay (uint32_t delay);
Jerome Coutant 1:2371382139dd 226
Jerome Coutant 1:2371382139dd 227 #ifdef __cplusplus
Jerome Coutant 1:2371382139dd 228 }
Jerome Coutant 1:2371382139dd 229 #endif
Jerome Coutant 1:2371382139dd 230
Jerome Coutant 1:2371382139dd 231 #endif /* __ILI9341_H */
Jerome Coutant 1:2371382139dd 232
Jerome Coutant 1:2371382139dd 233 /**
Jerome Coutant 1:2371382139dd 234 * @}
Jerome Coutant 1:2371382139dd 235 */
Jerome Coutant 1:2371382139dd 236
Jerome Coutant 1:2371382139dd 237 /**
Jerome Coutant 1:2371382139dd 238 * @}
Jerome Coutant 1:2371382139dd 239 */
Jerome Coutant 1:2371382139dd 240
Jerome Coutant 1:2371382139dd 241 /**
Jerome Coutant 1:2371382139dd 242 * @}
Jerome Coutant 1:2371382139dd 243 */
Jerome Coutant 1:2371382139dd 244
Jerome Coutant 1:2371382139dd 245 /**
Jerome Coutant 1:2371382139dd 246 * @}
Jerome Coutant 1:2371382139dd 247 */
Jerome Coutant 1:2371382139dd 248
Jerome Coutant 1:2371382139dd 249 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/