BSP files for STM32H747I-Discovery Copy from ST Cube delivery
Dependents: DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo
stm32h747i_discovery_lcd.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32h747i_discovery_lcd.h 00004 * @author MCD Application Team 00005 * @brief This file contains the common defines and functions prototypes for 00006 * the stm32h747i_discovery_lcd.c driver. 00007 ****************************************************************************** 00008 * @attention 00009 * 00010 * <h2><center>© Copyright (c) 2019 STMicroelectronics. 00011 * All rights reserved.</center></h2> 00012 * 00013 * This software component is licensed by ST under BSD 3-Clause license, 00014 * the "License"; You may not use this file except in compliance with the 00015 * License. You may obtain a copy of the License at: 00016 * opensource.org/licenses/BSD-3-Clause 00017 * 00018 ****************************************************************************** 00019 */ 00020 00021 /* Define to prevent recursive inclusion -------------------------------------*/ 00022 #ifndef __STM32H747I_DISCOVERY_LCD_H 00023 #define __STM32H747I_DISCOVERY_LCD_H 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 /* Includes ------------------------------------------------------------------*/ 00030 /* Include LCD component Driver */ 00031 00032 /* Include OTM8009A LCD Driver IC driver code */ 00033 #include "../Components/otm8009a/otm8009a.h" 00034 00035 #if defined(USE_LCD_HDMI) 00036 /* Include ADV7533 HDMI Driver IC driver code */ 00037 #include "../Components/adv7533/adv7533.h" 00038 #endif /* USE_LCD_HDMI */ 00039 00040 /* Include SDRAM Driver */ 00041 #include "stm32h747i_discovery_sdram.h" 00042 #include "stm32h747i_discovery.h" 00043 00044 #include "../Utilities/Fonts/fonts.h" 00045 00046 #include <string.h> /* use of memset() */ 00047 00048 /** @addtogroup BSP 00049 * @{ 00050 */ 00051 00052 /** @addtogroup STM32H747I_DISCOVERY 00053 * @{ 00054 */ 00055 00056 /** @addtogroup STM32H747I_DISCOVERY_LCD 00057 * @{ 00058 */ 00059 00060 /** @defgroup STM32H747I_DISCOVERY_LCD_Exported_Constants Exported Constants 00061 * @{ 00062 */ 00063 #define BSP_LCD_DMA2D_IRQHandler DMA2D_IRQHandler 00064 #define BSP_LCD_DSI_IRQHandler DSI_IRQHandler 00065 #define BSP_LCD_LTDC_IRQHandler LTDC_IRQHandler 00066 #define BSP_LCD_LTDC_ER_IRQHandler LTDC_ER_IRQHandler 00067 00068 00069 #define LCD_LayerCfgTypeDef LTDC_LayerCfgTypeDef 00070 /** 00071 * @brief LCD FB_StartAddress 00072 */ 00073 #define LCD_FB_START_ADDRESS ((uint32_t)0xD0000000) 00074 00075 /** @brief Maximum number of LTDC layers 00076 */ 00077 #define LTDC_MAX_LAYER_NUMBER ((uint32_t) 2) 00078 00079 /** @brief LTDC Background layer index 00080 */ 00081 #define LTDC_ACTIVE_LAYER_BACKGROUND ((uint32_t) 0) 00082 00083 /** @brief LTDC Foreground layer index 00084 */ 00085 #define LTDC_ACTIVE_LAYER_FOREGROUND ((uint32_t) 1) 00086 00087 /** @brief Number of LTDC layers 00088 */ 00089 #define LTDC_NB_OF_LAYERS ((uint32_t) 2) 00090 00091 /** @brief LTDC Default used layer index 00092 */ 00093 #define LTDC_DEFAULT_ACTIVE_LAYER LTDC_ACTIVE_LAYER_FOREGROUND 00094 00095 /** 00096 * @brief LCD status structure definition 00097 */ 00098 #define LCD_OK 0x00 00099 #define LCD_ERROR 0x01 00100 #define LCD_TIMEOUT 0x02 00101 00102 /** 00103 * @brief LCD Display OTM8009A ID 00104 */ 00105 #define LCD_OTM8009A_ID ((uint32_t) 0) 00106 00107 #if defined(USE_LCD_HDMI) 00108 /** 00109 * @brief HDMI ADV7533 DSI Virtual Channel ID 00110 */ 00111 #define HDMI_ADV7533_ID ((uint32_t) 0) 00112 00113 /** 00114 * @brief HDMI Foramt 00115 */ 00116 #define HDMI_FORMAT_720_480 ((uint8_t) 0x00) /*720_480 format choice of HDMI display */ 00117 #define HDMI_FORMAT_720_576 ((uint8_t) 0x01) /*720_576 format choice of HDMI display*/ 00118 00119 #endif /* USE_LCD_HDMI */ 00120 00121 /** 00122 * @brief LCD color definitions values 00123 * in ARGB8888 format. 00124 */ 00125 00126 /** @brief Blue value in ARGB8888 format 00127 */ 00128 #define LCD_COLOR_BLUE ((uint32_t) 0xFF0000FF) 00129 00130 /** @brief Green value in ARGB8888 format 00131 */ 00132 #define LCD_COLOR_GREEN ((uint32_t) 0xFF00FF00) 00133 00134 /** @brief Red value in ARGB8888 format 00135 */ 00136 #define LCD_COLOR_RED ((uint32_t) 0xFFFF0000) 00137 00138 /** @brief Cyan value in ARGB8888 format 00139 */ 00140 #define LCD_COLOR_CYAN ((uint32_t) 0xFF00FFFF) 00141 00142 /** @brief Magenta value in ARGB8888 format 00143 */ 00144 #define LCD_COLOR_MAGENTA ((uint32_t) 0xFFFF00FF) 00145 00146 /** @brief Yellow value in ARGB8888 format 00147 */ 00148 #define LCD_COLOR_YELLOW ((uint32_t) 0xFFFFFF00) 00149 00150 /** @brief Light Blue value in ARGB8888 format 00151 */ 00152 #define LCD_COLOR_LIGHTBLUE ((uint32_t) 0xFF8080FF) 00153 00154 /** @brief Light Green value in ARGB8888 format 00155 */ 00156 #define LCD_COLOR_LIGHTGREEN ((uint32_t) 0xFF80FF80) 00157 00158 /** @brief Light Red value in ARGB8888 format 00159 */ 00160 #define LCD_COLOR_LIGHTRED ((uint32_t) 0xFFFF8080) 00161 00162 /** @brief Light Cyan value in ARGB8888 format 00163 */ 00164 #define LCD_COLOR_LIGHTCYAN ((uint32_t) 0xFF80FFFF) 00165 00166 /** @brief Light Magenta value in ARGB8888 format 00167 */ 00168 #define LCD_COLOR_LIGHTMAGENTA ((uint32_t) 0xFFFF80FF) 00169 00170 /** @brief Light Yellow value in ARGB8888 format 00171 */ 00172 #define LCD_COLOR_LIGHTYELLOW ((uint32_t) 0xFFFFFF80) 00173 00174 /** @brief Dark Blue value in ARGB8888 format 00175 */ 00176 #define LCD_COLOR_DARKBLUE ((uint32_t) 0xFF000080) 00177 00178 /** @brief Light Dark Green value in ARGB8888 format 00179 */ 00180 #define LCD_COLOR_DARKGREEN ((uint32_t) 0xFF008000) 00181 00182 /** @brief Light Dark Red value in ARGB8888 format 00183 */ 00184 #define LCD_COLOR_DARKRED ((uint32_t) 0xFF800000) 00185 00186 /** @brief Dark Cyan value in ARGB8888 format 00187 */ 00188 #define LCD_COLOR_DARKCYAN ((uint32_t) 0xFF008080) 00189 00190 /** @brief Dark Magenta value in ARGB8888 format 00191 */ 00192 #define LCD_COLOR_DARKMAGENTA ((uint32_t) 0xFF800080) 00193 00194 /** @brief Dark Yellow value in ARGB8888 format 00195 */ 00196 #define LCD_COLOR_DARKYELLOW ((uint32_t) 0xFF808000) 00197 00198 /** @brief White value in ARGB8888 format 00199 */ 00200 #define LCD_COLOR_WHITE ((uint32_t) 0xFFFFFFFF) 00201 00202 /** @brief Light Gray value in ARGB8888 format 00203 */ 00204 #define LCD_COLOR_LIGHTGRAY ((uint32_t) 0xFFD3D3D3) 00205 00206 /** @brief Gray value in ARGB8888 format 00207 */ 00208 #define LCD_COLOR_GRAY ((uint32_t) 0xFF808080) 00209 00210 /** @brief Dark Gray value in ARGB8888 format 00211 */ 00212 #define LCD_COLOR_DARKGRAY ((uint32_t) 0xFF404040) 00213 00214 /** @brief Black value in ARGB8888 format 00215 */ 00216 #define LCD_COLOR_BLACK ((uint32_t) 0xFF000000) 00217 00218 /** @brief Brown value in ARGB8888 format 00219 */ 00220 #define LCD_COLOR_BROWN ((uint32_t) 0xFFA52A2A) 00221 00222 /** @brief Orange value in ARGB8888 format 00223 */ 00224 #define LCD_COLOR_ORANGE ((uint32_t) 0xFFFFA500) 00225 00226 /** @brief Transparent value in ARGB8888 format 00227 */ 00228 #define LCD_COLOR_TRANSPARENT ((uint32_t) 0xFF000000) 00229 00230 /** 00231 * @brief LCD default font 00232 */ 00233 #define LCD_DEFAULT_FONT Font24 00234 00235 /** 00236 * @brief Possible values of 00237 * pixel data format (ie color coding) transmitted on DSI Data lane in DSI packets 00238 */ 00239 00240 #define LCD_DSI_PIXEL_DATA_FMT_RBG888 DSI_RGB888 /*!< DSI packet pixel format chosen is RGB888 : 24 bpp */ 00241 #define LCD_DSI_PIXEL_DATA_FMT_RBG565 DSI_RGB565 /*!< DSI packet pixel format chosen is RGB565 : 16 bpp */ 00242 00243 /** 00244 * @} 00245 */ 00246 00247 /** @defgroup STM32H747I_DISCOVERY_LCD_Exported_Types Exported Types 00248 * @{ 00249 */ 00250 00251 /** 00252 * @brief LCD Drawing main properties 00253 */ 00254 typedef struct 00255 { 00256 uint32_t TextColor; /*!< Specifies the color of text */ 00257 uint32_t BackColor; /*!< Specifies the background color below the text */ 00258 sFONT *pFont; /*!< Specifies the font used for the text */ 00259 00260 } LCD_DrawPropTypeDef; 00261 00262 /** 00263 * @brief LCD Drawing point (pixel) geometric definition 00264 */ 00265 typedef struct 00266 { 00267 int16_t X; /*!< geometric X position of drawing */ 00268 int16_t Y; /*!< geometric Y position of drawing */ 00269 00270 } Point; 00271 00272 /** 00273 * @brief Pointer on LCD Drawing point (pixel) geometric definition 00274 */ 00275 typedef Point * pPoint; 00276 00277 /** 00278 * @brief LCD drawing Line alignment mode definitions 00279 */ 00280 typedef enum 00281 { 00282 CENTER_MODE = 0x01, /*!< Center mode */ 00283 RIGHT_MODE = 0x02, /*!< Right mode */ 00284 LEFT_MODE = 0x03 /*!< Left mode */ 00285 00286 } Text_AlignModeTypdef; 00287 00288 00289 /** 00290 * @brief LCD_OrientationTypeDef 00291 * Possible values of Display Orientation 00292 */ 00293 typedef enum 00294 { 00295 LCD_ORIENTATION_PORTRAIT = 0x00, /*!< Portrait orientation choice of LCD screen */ 00296 LCD_ORIENTATION_LANDSCAPE = 0x01, /*!< Landscape orientation choice of LCD screen */ 00297 LCD_ORIENTATION_INVALID = 0x02 /*!< Invalid orientation choice of LCD screen */ 00298 } LCD_OrientationTypeDef; 00299 00300 /** 00301 * @} 00302 */ 00303 00304 /** @addtogroup STM32H747I_DISCOVERY_LCD_Exported_Functions 00305 * @{ 00306 */ 00307 uint8_t BSP_LCD_Init(void); 00308 uint8_t BSP_LCD_InitEx(LCD_OrientationTypeDef orientation); 00309 00310 #if defined(USE_LCD_HDMI) 00311 uint8_t BSP_LCD_HDMIInitEx(uint8_t format); 00312 #endif /* USE_LCD_HDMI */ 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 void BSP_LCD_SetBrightness(uint8_t BrightnessValue); 00365 /** 00366 * @} 00367 */ 00368 00369 /** @addtogroup STM32H747I_DISCOVERY_LCD_Exported_Variables 00370 * @{ 00371 */ 00372 00373 /* @brief DMA2D handle variable */ 00374 extern DMA2D_HandleTypeDef hdma2d_discovery; 00375 00376 /** 00377 * @} 00378 */ 00379 00380 /** 00381 * @} 00382 */ 00383 00384 /** 00385 * @} 00386 */ 00387 00388 /** 00389 * @} 00390 */ 00391 00392 /** 00393 * @} 00394 */ 00395 00396 #ifdef __cplusplus 00397 } 00398 #endif 00399 00400 #endif /* __STM32H747I_DISCOVERY_LCD_H */ 00401 00402 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 18:45:41 by 1.7.2