Dependents:   Configurable_Robots DISCO-F469NI_LCD_demo DISCO-F469NI_SD_demo DISCO-F469NI_EEPROM_demo ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32469i_discovery_lcd.h Source File

stm32469i_discovery_lcd.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32469i_discovery_lcd.h
00004   * @author  MCD Application Team
00005   * @brief   This file contains the common defines and functions prototypes for
00006   *          the stm32469i_discovery_lcd.c driver.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
00011   *
00012   * Redistribution and use in source and binary forms, with or without modification,
00013   * are permitted provided that the following conditions are met:
00014   *   1. Redistributions of source code must retain the above copyright notice,
00015   *      this list of conditions and the following disclaimer.
00016   *   2. Redistributions in binary form must reproduce the above copyright notice,
00017   *      this list of conditions and the following disclaimer in the documentation
00018   *      and/or other materials provided with the distribution.
00019   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00020   *      may be used to endorse or promote products derived from this software
00021   *      without specific prior written permission.
00022   *
00023   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00026   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00027   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00029   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033   *
00034   ******************************************************************************
00035   */
00036 
00037 /* Define to prevent recursive inclusion -------------------------------------*/
00038 #ifndef __STM32469I_DISCOVERY_LCD_H
00039 #define __STM32469I_DISCOVERY_LCD_H
00040 
00041 #ifdef __cplusplus
00042  extern "C" {
00043 #endif
00044 
00045 /* Includes ------------------------------------------------------------------*/
00046 /* Include LCD component Driver */
00047 
00048 /* Include OTM8009A LCD Driver IC driver code */
00049 #include "../Components/otm8009a/otm8009a.h"
00050 
00051 /* Include SDRAM Driver */
00052 #include "stm32469i_discovery_sdram.h"
00053 #include "stm32469i_discovery.h"
00054 #include "../Fonts/fonts.h"
00055 
00056 #include <string.h> /* use of memset() */
00057 
00058 /** @addtogroup BSP
00059   * @{
00060   */
00061 
00062 /** @addtogroup STM32469I_Discovery
00063   * @{
00064   */
00065 
00066 /** @addtogroup STM32469I-Discovery_LCD 
00067   * @{
00068   */
00069 
00070 /** @defgroup STM32469I-Discovery_LCD_Exported_Constants STM32469I Discovery LCD Exported Constants
00071   * @{
00072   */
00073 
00074 #define LCD_LayerCfgTypeDef    LTDC_LayerCfgTypeDef
00075 /** 
00076   * @brief  LCD FB_StartAddress  
00077   */
00078 #define LCD_FB_START_ADDRESS       ((uint32_t)0xC0000000)
00079    
00080 /** @brief Maximum number of LTDC layers
00081  */
00082 #define LTDC_MAX_LAYER_NUMBER             ((uint32_t) 2)
00083 
00084 /** @brief LTDC Background layer index
00085  */
00086 #define LTDC_ACTIVE_LAYER_BACKGROUND      ((uint32_t) 0)
00087 
00088 /** @brief LTDC Foreground layer index
00089  */
00090 #define LTDC_ACTIVE_LAYER_FOREGROUND      ((uint32_t) 1)
00091 
00092 /** @brief Number of LTDC layers
00093  */
00094 #define LTDC_NB_OF_LAYERS                 ((uint32_t) 2)
00095 
00096 /** @brief LTDC Default used layer index
00097  */
00098 #define LTDC_DEFAULT_ACTIVE_LAYER         LTDC_ACTIVE_LAYER_FOREGROUND
00099 
00100 /** 
00101   * @brief  LCD status structure definition  
00102   */     
00103 #define   LCD_OK         0x00
00104 #define   LCD_ERROR      0x01
00105 #define   LCD_TIMEOUT    0x02
00106 
00107 /** 
00108   * @brief  LCD Display OTM8009A ID  
00109   */ 
00110 #define LCD_OTM8009A_ID  ((uint32_t) 0)
00111    
00112 /**
00113   * @brief  LCD color definitions values
00114   * in ARGB8888 format.
00115   */
00116 
00117 /** @brief Blue value in ARGB8888 format
00118  */
00119 #define LCD_COLOR_BLUE          ((uint32_t) 0xFF0000FF)
00120 
00121 /** @brief Green value in ARGB8888 format
00122  */
00123 #define LCD_COLOR_GREEN         ((uint32_t) 0xFF00FF00)
00124 
00125 /** @brief Red value in ARGB8888 format
00126  */
00127 #define LCD_COLOR_RED           ((uint32_t) 0xFFFF0000)
00128 
00129 /** @brief Cyan value in ARGB8888 format
00130  */
00131 #define LCD_COLOR_CYAN          ((uint32_t) 0xFF00FFFF)
00132 
00133 /** @brief Magenta value in ARGB8888 format
00134  */
00135 #define LCD_COLOR_MAGENTA       ((uint32_t) 0xFFFF00FF)
00136 
00137 /** @brief Yellow value in ARGB8888 format
00138  */
00139 #define LCD_COLOR_YELLOW        ((uint32_t) 0xFFFFFF00)
00140 
00141 /** @brief Light Blue value in ARGB8888 format
00142  */
00143 #define LCD_COLOR_LIGHTBLUE     ((uint32_t) 0xFF8080FF)
00144 
00145 /** @brief Light Green value in ARGB8888 format
00146  */
00147 #define LCD_COLOR_LIGHTGREEN    ((uint32_t) 0xFF80FF80)
00148 
00149 /** @brief Light Red value in ARGB8888 format
00150  */
00151 #define LCD_COLOR_LIGHTRED      ((uint32_t) 0xFFFF8080)
00152 
00153 /** @brief Light Cyan value in ARGB8888 format
00154  */
00155 #define LCD_COLOR_LIGHTCYAN     ((uint32_t) 0xFF80FFFF)
00156 
00157 /** @brief Light Magenta value in ARGB8888 format
00158  */
00159 #define LCD_COLOR_LIGHTMAGENTA  ((uint32_t) 0xFFFF80FF)
00160 
00161 /** @brief Light Yellow value in ARGB8888 format
00162  */
00163 #define LCD_COLOR_LIGHTYELLOW   ((uint32_t) 0xFFFFFF80)
00164 
00165 /** @brief Dark Blue value in ARGB8888 format
00166  */
00167 #define LCD_COLOR_DARKBLUE      ((uint32_t) 0xFF000080)
00168 
00169 /** @brief Light Dark Green value in ARGB8888 format
00170  */
00171 #define LCD_COLOR_DARKGREEN     ((uint32_t) 0xFF008000)
00172 
00173 /** @brief Light Dark Red value in ARGB8888 format
00174  */
00175 #define LCD_COLOR_DARKRED       ((uint32_t) 0xFF800000)
00176 
00177 /** @brief Dark Cyan value in ARGB8888 format
00178  */
00179 #define LCD_COLOR_DARKCYAN      ((uint32_t) 0xFF008080)
00180 
00181 /** @brief Dark Magenta value in ARGB8888 format
00182  */
00183 #define LCD_COLOR_DARKMAGENTA   ((uint32_t) 0xFF800080)
00184 
00185 /** @brief Dark Yellow value in ARGB8888 format
00186  */
00187 #define LCD_COLOR_DARKYELLOW    ((uint32_t) 0xFF808000)
00188 
00189 /** @brief White value in ARGB8888 format
00190  */
00191 #define LCD_COLOR_WHITE         ((uint32_t) 0xFFFFFFFF)
00192 
00193 /** @brief Light Gray value in ARGB8888 format
00194  */
00195 #define LCD_COLOR_LIGHTGRAY     ((uint32_t) 0xFFD3D3D3)
00196 
00197 /** @brief Gray value in ARGB8888 format
00198  */
00199 #define LCD_COLOR_GRAY          ((uint32_t) 0xFF808080)
00200 
00201 /** @brief Dark Gray value in ARGB8888 format
00202  */
00203 #define LCD_COLOR_DARKGRAY      ((uint32_t) 0xFF404040)
00204 
00205 /** @brief Black value in ARGB8888 format
00206  */
00207 #define LCD_COLOR_BLACK         ((uint32_t) 0xFF000000)
00208 
00209 /** @brief Brown value in ARGB8888 format
00210  */
00211 #define LCD_COLOR_BROWN         ((uint32_t) 0xFFA52A2A)
00212 
00213 /** @brief Orange value in ARGB8888 format
00214  */
00215 #define LCD_COLOR_ORANGE        ((uint32_t) 0xFFFFA500)
00216 
00217 /** @brief Transparent value in ARGB8888 format
00218  */
00219 #define LCD_COLOR_TRANSPARENT   ((uint32_t) 0xFF000000)
00220 
00221 /**
00222   * @brief LCD default font
00223   */
00224 #define LCD_DEFAULT_FONT        Font24
00225 
00226 /**
00227  *  @brief  Possible values of
00228  *  pixel data format (ie color coding) transmitted on DSI Data lane in DSI packets
00229  */
00230 
00231 #define   LCD_DSI_PIXEL_DATA_FMT_RBG888  DSI_RGB888 /*!< DSI packet pixel format chosen is RGB888 : 24 bpp */
00232 #define   LCD_DSI_PIXEL_DATA_FMT_RBG565  DSI_RGB565 /*!< DSI packet pixel format chosen is RGB565 : 16 bpp */
00233 
00234 /**
00235   * @}
00236   */
00237    
00238 /** @defgroup STM32469I-Discovery_LCD_Exported_Types STM32469I Discovery LCD Exported Types
00239   * @{
00240   */
00241 
00242 /**
00243 * @brief  LCD Drawing main properties
00244 */
00245 typedef struct
00246 {
00247   uint32_t TextColor; /*!< Specifies the color of text */
00248   uint32_t BackColor; /*!< Specifies the background color below the text */
00249   sFONT    *pFont;    /*!< Specifies the font used for the text */
00250 
00251 } LCD_DrawPropTypeDef;
00252 
00253 /**
00254   * @brief  LCD Drawing point (pixel) geometric definition
00255   */
00256 typedef struct
00257 {
00258   int16_t X; /*!< geometric X position of drawing */
00259   int16_t Y; /*!< geometric Y position of drawing */
00260 
00261 } Point;
00262 
00263 /**
00264   * @brief  Pointer on LCD Drawing point (pixel) geometric definition
00265   */
00266 typedef Point * pPoint;
00267 
00268 /**
00269   * @brief  LCD drawing Line alignment mode definitions
00270   */
00271 typedef enum
00272 {
00273   CENTER_MODE             = 0x01,    /*!< Center mode */
00274   RIGHT_MODE              = 0x02,    /*!< Right mode  */
00275   LEFT_MODE               = 0x03     /*!< Left mode   */
00276 
00277 } Text_AlignModeTypdef;
00278 
00279 
00280 /**
00281  *  @brief LCD_OrientationTypeDef
00282  *  Possible values of Display Orientation
00283  */
00284 typedef enum
00285 {
00286   LCD_ORIENTATION_PORTRAIT  = 0x00, /*!< Portrait orientation choice of LCD screen  */
00287   LCD_ORIENTATION_LANDSCAPE = 0x01, /*!< Landscape orientation choice of LCD screen */
00288   LCD_ORIENTATION_INVALID   = 0x02  /*!< Invalid orientation choice of LCD screen   */
00289 } LCD_OrientationTypeDef;
00290 
00291 /**
00292   * @}
00293   */
00294 
00295 /** @defgroup STM32469I-Discovery_LCD_Exported_Macro STM32469I Discovery LCD Exported Macro
00296   * @{
00297   */
00298 
00299 /**
00300   * @}
00301   */
00302 
00303 /** @defgroup STM32469I-Discovery_LCD_Exported_Functions STM32469I Discovery LCD Exported Functions
00304   * @{
00305   */
00306 void     BSP_LCD_DMA2D_IRQHandler(void);
00307 void     BSP_LCD_DSI_IRQHandler(void);
00308 void     BSP_LCD_LTDC_IRQHandler(void);
00309 void     BSP_LCD_LTDC_ER_IRQHandler(void);
00310 
00311 uint8_t  BSP_LCD_Init(void);
00312 uint8_t  BSP_LCD_InitEx(LCD_OrientationTypeDef orientation);
00313 
00314 void     BSP_LCD_MspDeInit(void);
00315 void     BSP_LCD_MspInit(void);
00316 void     BSP_LCD_Reset(void);
00317 
00318 uint32_t BSP_LCD_GetXSize(void);
00319 uint32_t BSP_LCD_GetYSize(void);
00320 void     BSP_LCD_SetXSize(uint32_t imageWidthPixels);
00321 void     BSP_LCD_SetYSize(uint32_t imageHeightPixels);
00322 
00323 void     BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address);
00324 void     BSP_LCD_SetTransparency(uint32_t LayerIndex, uint8_t Transparency);
00325 void     BSP_LCD_SetLayerAddress(uint32_t LayerIndex, uint32_t Address);
00326 void     BSP_LCD_SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue);
00327 void     BSP_LCD_ResetColorKeying(uint32_t LayerIndex);
00328 void     BSP_LCD_SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00329 
00330 void     BSP_LCD_SelectLayer(uint32_t LayerIndex);
00331 void     BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState State);
00332 
00333 void     BSP_LCD_SetTextColor(uint32_t Color);
00334 uint32_t BSP_LCD_GetTextColor(void);
00335 void     BSP_LCD_SetBackColor(uint32_t Color);
00336 uint32_t BSP_LCD_GetBackColor(void);
00337 void     BSP_LCD_SetFont(sFONT *fonts);
00338 sFONT    *BSP_LCD_GetFont(void);
00339 
00340 uint32_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos);
00341 void     BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t pixel);
00342 void     BSP_LCD_Clear(uint32_t Color);
00343 void     BSP_LCD_ClearStringLine(uint32_t Line);
00344 void     BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
00345 void     BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Text_AlignModeTypdef Mode);
00346 void     BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
00347 
00348 void     BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
00349 void     BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
00350 void     BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
00351 void     BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00352 void     BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
00353 void     BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
00354 void     BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
00355 void     BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp);
00356 
00357 void     BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00358 void     BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
00359 void     BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
00360 void     BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
00361 
00362 void     BSP_LCD_DisplayOff(void);
00363 void     BSP_LCD_DisplayOn(void);
00364 
00365 /**
00366   * @}
00367   */
00368 
00369 /** @defgroup STM32469I-EVAL_LCD_Exported_Variables STM32469I EVAL LCD Exported Variables
00370   * @{
00371   */
00372 
00373 /* @brief DMA2D handle variable */
00374 extern DMA2D_HandleTypeDef hdma2d_eval;
00375 
00376 /**
00377   * @}
00378   */
00379 
00380 /** @defgroup STM32469I-Discovery_LCD_Exported_Variables STM32469I Discovery LCD Exported Variables
00381   * @{
00382   */
00383 
00384 /**
00385   * @}
00386   */
00387 
00388 /**
00389   * @}
00390   */
00391 
00392 /**
00393   * @}
00394   */
00395 
00396 /**
00397   * @}
00398   */
00399 
00400 #ifdef __cplusplus
00401 }
00402 #endif
00403 
00404 #endif /* __STM32469I_DISCOVERY_LCD_H */
00405 
00406 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/