STM32F479xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_hal_ltdc.h 00004 * @author MCD Application Team 00005 * @brief Header file of LTDC HAL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© Copyright (c) 2016 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Define to prevent recursive inclusion -------------------------------------*/ 00021 #ifndef STM32F4xx_HAL_LTDC_H 00022 #define STM32F4xx_HAL_LTDC_H 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32f4xx_hal_def.h" 00030 00031 #if defined (LTDC) 00032 00033 /** @addtogroup STM32F4xx_HAL_Driver 00034 * @{ 00035 */ 00036 00037 /** @defgroup LTDC LTDC 00038 * @brief LTDC HAL module driver 00039 * @{ 00040 */ 00041 00042 /* Exported types ------------------------------------------------------------*/ 00043 /** @defgroup LTDC_Exported_Types LTDC Exported Types 00044 * @{ 00045 */ 00046 #define MAX_LAYER 2U 00047 00048 /** 00049 * @brief LTDC color structure definition 00050 */ 00051 typedef struct 00052 { 00053 uint8_t Blue; /*!< Configures the blue value. 00054 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 00055 00056 uint8_t Green; /*!< Configures the green value. 00057 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 00058 00059 uint8_t Red; /*!< Configures the red value. 00060 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 00061 00062 uint8_t Reserved; /*!< Reserved 0xFF */ 00063 } LTDC_ColorTypeDef; 00064 00065 /** 00066 * @brief LTDC Init structure definition 00067 */ 00068 typedef struct 00069 { 00070 uint32_t HSPolarity; /*!< configures the horizontal synchronization polarity. 00071 This parameter can be one value of @ref LTDC_HS_POLARITY */ 00072 00073 uint32_t VSPolarity; /*!< configures the vertical synchronization polarity. 00074 This parameter can be one value of @ref LTDC_VS_POLARITY */ 00075 00076 uint32_t DEPolarity; /*!< configures the data enable polarity. 00077 This parameter can be one of value of @ref LTDC_DE_POLARITY */ 00078 00079 uint32_t PCPolarity; /*!< configures the pixel clock polarity. 00080 This parameter can be one of value of @ref LTDC_PC_POLARITY */ 00081 00082 uint32_t HorizontalSync; /*!< configures the number of Horizontal synchronization width. 00083 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ 00084 00085 uint32_t VerticalSync; /*!< configures the number of Vertical synchronization height. 00086 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */ 00087 00088 uint32_t AccumulatedHBP; /*!< configures the accumulated horizontal back porch width. 00089 This parameter must be a number between Min_Data = LTDC_HorizontalSync and Max_Data = 0xFFF. */ 00090 00091 uint32_t AccumulatedVBP; /*!< configures the accumulated vertical back porch height. 00092 This parameter must be a number between Min_Data = LTDC_VerticalSync and Max_Data = 0x7FF. */ 00093 00094 uint32_t AccumulatedActiveW; /*!< configures the accumulated active width. 00095 This parameter must be a number between Min_Data = LTDC_AccumulatedHBP and Max_Data = 0xFFF. */ 00096 00097 uint32_t AccumulatedActiveH; /*!< configures the accumulated active height. 00098 This parameter must be a number between Min_Data = LTDC_AccumulatedVBP and Max_Data = 0x7FF. */ 00099 00100 uint32_t TotalWidth; /*!< configures the total width. 00101 This parameter must be a number between Min_Data = LTDC_AccumulatedActiveW and Max_Data = 0xFFF. */ 00102 00103 uint32_t TotalHeigh; /*!< configures the total height. 00104 This parameter must be a number between Min_Data = LTDC_AccumulatedActiveH and Max_Data = 0x7FF. */ 00105 00106 LTDC_ColorTypeDef Backcolor; /*!< Configures the background color. */ 00107 } LTDC_InitTypeDef; 00108 00109 /** 00110 * @brief LTDC Layer structure definition 00111 */ 00112 typedef struct 00113 { 00114 uint32_t WindowX0; /*!< Configures the Window Horizontal Start Position. 00115 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ 00116 00117 uint32_t WindowX1; /*!< Configures the Window Horizontal Stop Position. 00118 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ 00119 00120 uint32_t WindowY0; /*!< Configures the Window vertical Start Position. 00121 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */ 00122 00123 uint32_t WindowY1; /*!< Configures the Window vertical Stop Position. 00124 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x7FF. */ 00125 00126 uint32_t PixelFormat; /*!< Specifies the pixel format. 00127 This parameter can be one of value of @ref LTDC_Pixelformat */ 00128 00129 uint32_t Alpha; /*!< Specifies the constant alpha used for blending. 00130 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 00131 00132 uint32_t Alpha0; /*!< Configures the default alpha value. 00133 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 00134 00135 uint32_t BlendingFactor1; /*!< Select the blending factor 1. 00136 This parameter can be one of value of @ref LTDC_BlendingFactor1 */ 00137 00138 uint32_t BlendingFactor2; /*!< Select the blending factor 2. 00139 This parameter can be one of value of @ref LTDC_BlendingFactor2 */ 00140 00141 uint32_t FBStartAdress; /*!< Configures the color frame buffer address */ 00142 00143 uint32_t ImageWidth; /*!< Configures the color frame buffer line length. 00144 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x1FFF. */ 00145 00146 uint32_t ImageHeight; /*!< Specifies the number of line in frame buffer. 00147 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */ 00148 00149 LTDC_ColorTypeDef Backcolor; /*!< Configures the layer background color. */ 00150 } LTDC_LayerCfgTypeDef; 00151 00152 /** 00153 * @brief HAL LTDC State structures definition 00154 */ 00155 typedef enum 00156 { 00157 HAL_LTDC_STATE_RESET = 0x00U, /*!< LTDC not yet initialized or disabled */ 00158 HAL_LTDC_STATE_READY = 0x01U, /*!< LTDC initialized and ready for use */ 00159 HAL_LTDC_STATE_BUSY = 0x02U, /*!< LTDC internal process is ongoing */ 00160 HAL_LTDC_STATE_TIMEOUT = 0x03U, /*!< LTDC Timeout state */ 00161 HAL_LTDC_STATE_ERROR = 0x04U /*!< LTDC state error */ 00162 } HAL_LTDC_StateTypeDef; 00163 00164 /** 00165 * @brief LTDC handle Structure definition 00166 */ 00167 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00168 typedef struct __LTDC_HandleTypeDef 00169 #else 00170 typedef struct 00171 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00172 { 00173 LTDC_TypeDef *Instance; /*!< LTDC Register base address */ 00174 00175 LTDC_InitTypeDef Init; /*!< LTDC parameters */ 00176 00177 LTDC_LayerCfgTypeDef LayerCfg[MAX_LAYER]; /*!< LTDC Layers parameters */ 00178 00179 HAL_LockTypeDef Lock; /*!< LTDC Lock */ 00180 00181 __IO HAL_LTDC_StateTypeDef State; /*!< LTDC state */ 00182 00183 __IO uint32_t ErrorCode; /*!< LTDC Error code */ 00184 00185 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00186 void (* LineEventCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Line Event Callback */ 00187 void (* ReloadEventCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Reload Event Callback */ 00188 void (* ErrorCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Error Callback */ 00189 00190 void (* MspInitCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Msp Init callback */ 00191 void (* MspDeInitCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Msp DeInit callback */ 00192 00193 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00194 00195 00196 } LTDC_HandleTypeDef; 00197 00198 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00199 /** 00200 * @brief HAL LTDC Callback ID enumeration definition 00201 */ 00202 typedef enum 00203 { 00204 HAL_LTDC_MSPINIT_CB_ID = 0x00U, /*!< LTDC MspInit callback ID */ 00205 HAL_LTDC_MSPDEINIT_CB_ID = 0x01U, /*!< LTDC MspDeInit callback ID */ 00206 00207 HAL_LTDC_LINE_EVENT_CB_ID = 0x02U, /*!< LTDC Line Event Callback ID */ 00208 HAL_LTDC_RELOAD_EVENT_CB_ID = 0x03U, /*!< LTDC Reload Callback ID */ 00209 HAL_LTDC_ERROR_CB_ID = 0x04U /*!< LTDC Error Callback ID */ 00210 00211 } HAL_LTDC_CallbackIDTypeDef; 00212 00213 /** 00214 * @brief HAL LTDC Callback pointer definition 00215 */ 00216 typedef void (*pLTDC_CallbackTypeDef)(LTDC_HandleTypeDef *hltdc); /*!< pointer to an LTDC callback function */ 00217 00218 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00219 00220 /** 00221 * @} 00222 */ 00223 00224 /* Exported constants --------------------------------------------------------*/ 00225 /** @defgroup LTDC_Exported_Constants LTDC Exported Constants 00226 * @{ 00227 */ 00228 00229 /** @defgroup LTDC_Error_Code LTDC Error Code 00230 * @{ 00231 */ 00232 #define HAL_LTDC_ERROR_NONE 0x00000000U /*!< LTDC No error */ 00233 #define HAL_LTDC_ERROR_TE 0x00000001U /*!< LTDC Transfer error */ 00234 #define HAL_LTDC_ERROR_FU 0x00000002U /*!< LTDC FIFO Underrun */ 00235 #define HAL_LTDC_ERROR_TIMEOUT 0x00000020U /*!< LTDC Timeout error */ 00236 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00237 #define HAL_LTDC_ERROR_INVALID_CALLBACK 0x00000040U /*!< LTDC Invalid Callback error */ 00238 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00239 /** 00240 * @} 00241 */ 00242 00243 /** @defgroup LTDC_Layer LTDC Layer 00244 * @{ 00245 */ 00246 #define LTDC_LAYER_1 0x00000000U /*!< LTDC Layer 1 */ 00247 #define LTDC_LAYER_2 0x00000001U /*!< LTDC Layer 2 */ 00248 /** 00249 * @} 00250 */ 00251 00252 /** @defgroup LTDC_HS_POLARITY LTDC HS POLARITY 00253 * @{ 00254 */ 00255 #define LTDC_HSPOLARITY_AL 0x00000000U /*!< Horizontal Synchronization is active low. */ 00256 #define LTDC_HSPOLARITY_AH LTDC_GCR_HSPOL /*!< Horizontal Synchronization is active high. */ 00257 /** 00258 * @} 00259 */ 00260 00261 /** @defgroup LTDC_VS_POLARITY LTDC VS POLARITY 00262 * @{ 00263 */ 00264 #define LTDC_VSPOLARITY_AL 0x00000000U /*!< Vertical Synchronization is active low. */ 00265 #define LTDC_VSPOLARITY_AH LTDC_GCR_VSPOL /*!< Vertical Synchronization is active high. */ 00266 /** 00267 * @} 00268 */ 00269 00270 /** @defgroup LTDC_DE_POLARITY LTDC DE POLARITY 00271 * @{ 00272 */ 00273 #define LTDC_DEPOLARITY_AL 0x00000000U /*!< Data Enable, is active low. */ 00274 #define LTDC_DEPOLARITY_AH LTDC_GCR_DEPOL /*!< Data Enable, is active high. */ 00275 /** 00276 * @} 00277 */ 00278 00279 /** @defgroup LTDC_PC_POLARITY LTDC PC POLARITY 00280 * @{ 00281 */ 00282 #define LTDC_PCPOLARITY_IPC 0x00000000U /*!< input pixel clock. */ 00283 #define LTDC_PCPOLARITY_IIPC LTDC_GCR_PCPOL /*!< inverted input pixel clock. */ 00284 /** 00285 * @} 00286 */ 00287 00288 /** @defgroup LTDC_SYNC LTDC SYNC 00289 * @{ 00290 */ 00291 #define LTDC_HORIZONTALSYNC (LTDC_SSCR_HSW >> 16U) /*!< Horizontal synchronization width. */ 00292 #define LTDC_VERTICALSYNC LTDC_SSCR_VSH /*!< Vertical synchronization height. */ 00293 /** 00294 * @} 00295 */ 00296 00297 /** @defgroup LTDC_BACK_COLOR LTDC BACK COLOR 00298 * @{ 00299 */ 00300 #define LTDC_COLOR 0x000000FFU /*!< Color mask */ 00301 /** 00302 * @} 00303 */ 00304 00305 /** @defgroup LTDC_BlendingFactor1 LTDC Blending Factor1 00306 * @{ 00307 */ 00308 #define LTDC_BLENDING_FACTOR1_CA 0x00000400U /*!< Blending factor : Cte Alpha */ 00309 #define LTDC_BLENDING_FACTOR1_PAxCA 0x00000600U /*!< Blending factor : Cte Alpha x Pixel Alpha*/ 00310 /** 00311 * @} 00312 */ 00313 00314 /** @defgroup LTDC_BlendingFactor2 LTDC Blending Factor2 00315 * @{ 00316 */ 00317 #define LTDC_BLENDING_FACTOR2_CA 0x00000005U /*!< Blending factor : Cte Alpha */ 00318 #define LTDC_BLENDING_FACTOR2_PAxCA 0x00000007U /*!< Blending factor : Cte Alpha x Pixel Alpha*/ 00319 /** 00320 * @} 00321 */ 00322 00323 /** @defgroup LTDC_Pixelformat LTDC Pixel format 00324 * @{ 00325 */ 00326 #define LTDC_PIXEL_FORMAT_ARGB8888 0x00000000U /*!< ARGB8888 LTDC pixel format */ 00327 #define LTDC_PIXEL_FORMAT_RGB888 0x00000001U /*!< RGB888 LTDC pixel format */ 00328 #define LTDC_PIXEL_FORMAT_RGB565 0x00000002U /*!< RGB565 LTDC pixel format */ 00329 #define LTDC_PIXEL_FORMAT_ARGB1555 0x00000003U /*!< ARGB1555 LTDC pixel format */ 00330 #define LTDC_PIXEL_FORMAT_ARGB4444 0x00000004U /*!< ARGB4444 LTDC pixel format */ 00331 #define LTDC_PIXEL_FORMAT_L8 0x00000005U /*!< L8 LTDC pixel format */ 00332 #define LTDC_PIXEL_FORMAT_AL44 0x00000006U /*!< AL44 LTDC pixel format */ 00333 #define LTDC_PIXEL_FORMAT_AL88 0x00000007U /*!< AL88 LTDC pixel format */ 00334 /** 00335 * @} 00336 */ 00337 00338 /** @defgroup LTDC_Alpha LTDC Alpha 00339 * @{ 00340 */ 00341 #define LTDC_ALPHA LTDC_LxCACR_CONSTA /*!< LTDC Constant Alpha mask */ 00342 /** 00343 * @} 00344 */ 00345 00346 /** @defgroup LTDC_LAYER_Config LTDC LAYER Config 00347 * @{ 00348 */ 00349 #define LTDC_STOPPOSITION (LTDC_LxWHPCR_WHSPPOS >> 16U) /*!< LTDC Layer stop position */ 00350 #define LTDC_STARTPOSITION LTDC_LxWHPCR_WHSTPOS /*!< LTDC Layer start position */ 00351 00352 #define LTDC_COLOR_FRAME_BUFFER LTDC_LxCFBLR_CFBLL /*!< LTDC Layer Line length */ 00353 #define LTDC_LINE_NUMBER LTDC_LxCFBLNR_CFBLNBR /*!< LTDC Layer Line number */ 00354 /** 00355 * @} 00356 */ 00357 00358 /** @defgroup LTDC_Interrupts LTDC Interrupts 00359 * @{ 00360 */ 00361 #define LTDC_IT_LI LTDC_IER_LIE /*!< LTDC Line Interrupt */ 00362 #define LTDC_IT_FU LTDC_IER_FUIE /*!< LTDC FIFO Underrun Interrupt */ 00363 #define LTDC_IT_TE LTDC_IER_TERRIE /*!< LTDC Transfer Error Interrupt */ 00364 #define LTDC_IT_RR LTDC_IER_RRIE /*!< LTDC Register Reload Interrupt */ 00365 /** 00366 * @} 00367 */ 00368 00369 /** @defgroup LTDC_Flags LTDC Flags 00370 * @{ 00371 */ 00372 #define LTDC_FLAG_LI LTDC_ISR_LIF /*!< LTDC Line Interrupt Flag */ 00373 #define LTDC_FLAG_FU LTDC_ISR_FUIF /*!< LTDC FIFO Underrun interrupt Flag */ 00374 #define LTDC_FLAG_TE LTDC_ISR_TERRIF /*!< LTDC Transfer Error interrupt Flag */ 00375 #define LTDC_FLAG_RR LTDC_ISR_RRIF /*!< LTDC Register Reload interrupt Flag */ 00376 /** 00377 * @} 00378 */ 00379 00380 /** @defgroup LTDC_Reload_Type LTDC Reload Type 00381 * @{ 00382 */ 00383 #define LTDC_RELOAD_IMMEDIATE LTDC_SRCR_IMR /*!< Immediate Reload */ 00384 #define LTDC_RELOAD_VERTICAL_BLANKING LTDC_SRCR_VBR /*!< Vertical Blanking Reload */ 00385 /** 00386 * @} 00387 */ 00388 00389 /** 00390 * @} 00391 */ 00392 00393 /* Exported macro ------------------------------------------------------------*/ 00394 /** @defgroup LTDC_Exported_Macros LTDC Exported Macros 00395 * @{ 00396 */ 00397 00398 /** @brief Reset LTDC handle state. 00399 * @param __HANDLE__ LTDC handle 00400 * @retval None 00401 */ 00402 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00403 #define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) do{ \ 00404 (__HANDLE__)->State = HAL_LTDC_STATE_RESET; \ 00405 (__HANDLE__)->MspInitCallback = NULL; \ 00406 (__HANDLE__)->MspDeInitCallback = NULL; \ 00407 } while(0) 00408 #else 00409 #define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LTDC_STATE_RESET) 00410 #endif /*USE_HAL_LTDC_REGISTER_CALLBACKS */ 00411 00412 /** 00413 * @brief Enable the LTDC. 00414 * @param __HANDLE__ LTDC handle 00415 * @retval None. 00416 */ 00417 #define __HAL_LTDC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR |= LTDC_GCR_LTDCEN) 00418 00419 /** 00420 * @brief Disable the LTDC. 00421 * @param __HANDLE__ LTDC handle 00422 * @retval None. 00423 */ 00424 #define __HAL_LTDC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR &= ~(LTDC_GCR_LTDCEN)) 00425 00426 /** 00427 * @brief Enable the LTDC Layer. 00428 * @param __HANDLE__ LTDC handle 00429 * @param __LAYER__ Specify the layer to be enabled. 00430 * This parameter can be LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1). 00431 * @retval None. 00432 */ 00433 #define __HAL_LTDC_LAYER_ENABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR |= (uint32_t)LTDC_LxCR_LEN) 00434 00435 /** 00436 * @brief Disable the LTDC Layer. 00437 * @param __HANDLE__ LTDC handle 00438 * @param __LAYER__ Specify the layer to be disabled. 00439 * This parameter can be LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1). 00440 * @retval None. 00441 */ 00442 #define __HAL_LTDC_LAYER_DISABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR &= ~(uint32_t)LTDC_LxCR_LEN) 00443 00444 /** 00445 * @brief Reload immediately all LTDC Layers. 00446 * @param __HANDLE__ LTDC handle 00447 * @retval None. 00448 */ 00449 #define __HAL_LTDC_RELOAD_IMMEDIATE_CONFIG(__HANDLE__) ((__HANDLE__)->Instance->SRCR |= LTDC_SRCR_IMR) 00450 00451 /** 00452 * @brief Reload during vertical blanking period all LTDC Layers. 00453 * @param __HANDLE__ LTDC handle 00454 * @retval None. 00455 */ 00456 #define __HAL_LTDC_VERTICAL_BLANKING_RELOAD_CONFIG(__HANDLE__) ((__HANDLE__)->Instance->SRCR |= LTDC_SRCR_VBR) 00457 00458 /* Interrupt & Flag management */ 00459 /** 00460 * @brief Get the LTDC pending flags. 00461 * @param __HANDLE__ LTDC handle 00462 * @param __FLAG__ Get the specified flag. 00463 * This parameter can be any combination of the following values: 00464 * @arg LTDC_FLAG_LI: Line Interrupt flag 00465 * @arg LTDC_FLAG_FU: FIFO Underrun Interrupt flag 00466 * @arg LTDC_FLAG_TE: Transfer Error interrupt flag 00467 * @arg LTDC_FLAG_RR: Register Reload Interrupt Flag 00468 * @retval The state of FLAG (SET or RESET). 00469 */ 00470 #define __HAL_LTDC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__)) 00471 00472 /** 00473 * @brief Clears the LTDC pending flags. 00474 * @param __HANDLE__ LTDC handle 00475 * @param __FLAG__ Specify the flag to clear. 00476 * This parameter can be any combination of the following values: 00477 * @arg LTDC_FLAG_LI: Line Interrupt flag 00478 * @arg LTDC_FLAG_FU: FIFO Underrun Interrupt flag 00479 * @arg LTDC_FLAG_TE: Transfer Error interrupt flag 00480 * @arg LTDC_FLAG_RR: Register Reload Interrupt Flag 00481 * @retval None 00482 */ 00483 #define __HAL_LTDC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) 00484 00485 /** 00486 * @brief Enables the specified LTDC interrupts. 00487 * @param __HANDLE__ LTDC handle 00488 * @param __INTERRUPT__ Specify the LTDC interrupt sources to be enabled. 00489 * This parameter can be any combination of the following values: 00490 * @arg LTDC_IT_LI: Line Interrupt flag 00491 * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag 00492 * @arg LTDC_IT_TE: Transfer Error interrupt flag 00493 * @arg LTDC_IT_RR: Register Reload Interrupt Flag 00494 * @retval None 00495 */ 00496 #define __HAL_LTDC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) 00497 00498 /** 00499 * @brief Disables the specified LTDC interrupts. 00500 * @param __HANDLE__ LTDC handle 00501 * @param __INTERRUPT__ Specify the LTDC interrupt sources to be disabled. 00502 * This parameter can be any combination of the following values: 00503 * @arg LTDC_IT_LI: Line Interrupt flag 00504 * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag 00505 * @arg LTDC_IT_TE: Transfer Error interrupt flag 00506 * @arg LTDC_IT_RR: Register Reload Interrupt Flag 00507 * @retval None 00508 */ 00509 #define __HAL_LTDC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__)) 00510 00511 /** 00512 * @brief Check whether the specified LTDC interrupt has occurred or not. 00513 * @param __HANDLE__ LTDC handle 00514 * @param __INTERRUPT__ Specify the LTDC interrupt source to check. 00515 * This parameter can be one of the following values: 00516 * @arg LTDC_IT_LI: Line Interrupt flag 00517 * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag 00518 * @arg LTDC_IT_TE: Transfer Error interrupt flag 00519 * @arg LTDC_IT_RR: Register Reload Interrupt Flag 00520 * @retval The state of INTERRUPT (SET or RESET). 00521 */ 00522 #define __HAL_LTDC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__)) 00523 /** 00524 * @} 00525 */ 00526 00527 /* Include LTDC HAL Extension module */ 00528 #include "stm32f4xx_hal_ltdc_ex.h" 00529 00530 /* Exported functions --------------------------------------------------------*/ 00531 /** @addtogroup LTDC_Exported_Functions 00532 * @{ 00533 */ 00534 /** @addtogroup LTDC_Exported_Functions_Group1 00535 * @{ 00536 */ 00537 /* Initialization and de-initialization functions *****************************/ 00538 HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc); 00539 HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc); 00540 void HAL_LTDC_MspInit(LTDC_HandleTypeDef *hltdc); 00541 void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc); 00542 void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc); 00543 void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc); 00544 void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc); 00545 00546 /* Callbacks Register/UnRegister functions ***********************************/ 00547 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00548 HAL_StatusTypeDef HAL_LTDC_RegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID, pLTDC_CallbackTypeDef pCallback); 00549 HAL_StatusTypeDef HAL_LTDC_UnRegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID); 00550 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00551 00552 /** 00553 * @} 00554 */ 00555 00556 /** @addtogroup LTDC_Exported_Functions_Group2 00557 * @{ 00558 */ 00559 /* IO operation functions *****************************************************/ 00560 void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc); 00561 /** 00562 * @} 00563 */ 00564 00565 /** @addtogroup LTDC_Exported_Functions_Group3 00566 * @{ 00567 */ 00568 /* Peripheral Control functions ***********************************************/ 00569 HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx); 00570 HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx); 00571 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx); 00572 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx); 00573 HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx); 00574 HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx); 00575 HAL_StatusTypeDef HAL_LTDC_SetPitch(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx); 00576 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx); 00577 HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx); 00578 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 00579 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 00580 HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 00581 HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 00582 HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line); 00583 HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc); 00584 HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc); 00585 HAL_StatusTypeDef HAL_LTDC_Reload(LTDC_HandleTypeDef *hltdc, uint32_t ReloadType); 00586 HAL_StatusTypeDef HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx); 00587 HAL_StatusTypeDef HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx); 00588 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx); 00589 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx); 00590 HAL_StatusTypeDef HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx); 00591 HAL_StatusTypeDef HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx); 00592 HAL_StatusTypeDef HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx); 00593 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx); 00594 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 00595 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 00596 HAL_StatusTypeDef HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 00597 HAL_StatusTypeDef HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 00598 00599 /** 00600 * @} 00601 */ 00602 00603 /** @addtogroup LTDC_Exported_Functions_Group4 00604 * @{ 00605 */ 00606 /* Peripheral State functions *************************************************/ 00607 HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc); 00608 uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc); 00609 /** 00610 * @} 00611 */ 00612 00613 /** 00614 * @} 00615 */ 00616 00617 /* Private types -------------------------------------------------------------*/ 00618 /* Private variables ---------------------------------------------------------*/ 00619 /* Private constants ---------------------------------------------------------*/ 00620 /* Private macros ------------------------------------------------------------*/ 00621 /** @defgroup LTDC_Private_Macros LTDC Private Macros 00622 * @{ 00623 */ 00624 #define LTDC_LAYER(__HANDLE__, __LAYER__) ((LTDC_Layer_TypeDef *)((uint32_t)(((uint32_t)((__HANDLE__)->Instance)) + 0x84U + (0x80U*(__LAYER__))))) 00625 #define IS_LTDC_LAYER(__LAYER__) ((__LAYER__) < MAX_LAYER) 00626 #define IS_LTDC_HSPOL(__HSPOL__) (((__HSPOL__) == LTDC_HSPOLARITY_AL) || ((__HSPOL__) == LTDC_HSPOLARITY_AH)) 00627 #define IS_LTDC_VSPOL(__VSPOL__) (((__VSPOL__) == LTDC_VSPOLARITY_AL) || ((__VSPOL__) == LTDC_VSPOLARITY_AH)) 00628 #define IS_LTDC_DEPOL(__DEPOL__) (((__DEPOL__) == LTDC_DEPOLARITY_AL) || ((__DEPOL__) == LTDC_DEPOLARITY_AH)) 00629 #define IS_LTDC_PCPOL(__PCPOL__) (((__PCPOL__) == LTDC_PCPOLARITY_IPC) || ((__PCPOL__) == LTDC_PCPOLARITY_IIPC)) 00630 #define IS_LTDC_HSYNC(__HSYNC__) ((__HSYNC__) <= LTDC_HORIZONTALSYNC) 00631 #define IS_LTDC_VSYNC(__VSYNC__) ((__VSYNC__) <= LTDC_VERTICALSYNC) 00632 #define IS_LTDC_AHBP(__AHBP__) ((__AHBP__) <= LTDC_HORIZONTALSYNC) 00633 #define IS_LTDC_AVBP(__AVBP__) ((__AVBP__) <= LTDC_VERTICALSYNC) 00634 #define IS_LTDC_AAW(__AAW__) ((__AAW__) <= LTDC_HORIZONTALSYNC) 00635 #define IS_LTDC_AAH(__AAH__) ((__AAH__) <= LTDC_VERTICALSYNC) 00636 #define IS_LTDC_TOTALW(__TOTALW__) ((__TOTALW__) <= LTDC_HORIZONTALSYNC) 00637 #define IS_LTDC_TOTALH(__TOTALH__) ((__TOTALH__) <= LTDC_VERTICALSYNC) 00638 #define IS_LTDC_BLUEVALUE(__BBLUE__) ((__BBLUE__) <= LTDC_COLOR) 00639 #define IS_LTDC_GREENVALUE(__BGREEN__) ((__BGREEN__) <= LTDC_COLOR) 00640 #define IS_LTDC_REDVALUE(__BRED__) ((__BRED__) <= LTDC_COLOR) 00641 #define IS_LTDC_BLENDING_FACTOR1(__BLENDING_FACTOR1__) (((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR1_CA) || \ 00642 ((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR1_PAxCA)) 00643 #define IS_LTDC_BLENDING_FACTOR2(__BLENDING_FACTOR1__) (((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR2_CA) || \ 00644 ((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR2_PAxCA)) 00645 #define IS_LTDC_PIXEL_FORMAT(__PIXEL_FORMAT__) (((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB8888) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_RGB888) || \ 00646 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_RGB565) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB1555) || \ 00647 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB4444) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_L8) || \ 00648 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_AL44) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_AL88)) 00649 #define IS_LTDC_ALPHA(__ALPHA__) ((__ALPHA__) <= LTDC_ALPHA) 00650 #define IS_LTDC_HCONFIGST(__HCONFIGST__) ((__HCONFIGST__) <= LTDC_STARTPOSITION) 00651 #define IS_LTDC_HCONFIGSP(__HCONFIGSP__) ((__HCONFIGSP__) <= LTDC_STOPPOSITION) 00652 #define IS_LTDC_VCONFIGST(__VCONFIGST__) ((__VCONFIGST__) <= LTDC_STARTPOSITION) 00653 #define IS_LTDC_VCONFIGSP(__VCONFIGSP__) ((__VCONFIGSP__) <= LTDC_STOPPOSITION) 00654 #define IS_LTDC_CFBP(__CFBP__) ((__CFBP__) <= LTDC_COLOR_FRAME_BUFFER) 00655 #define IS_LTDC_CFBLL(__CFBLL__) ((__CFBLL__) <= LTDC_COLOR_FRAME_BUFFER) 00656 #define IS_LTDC_CFBLNBR(__CFBLNBR__) ((__CFBLNBR__) <= LTDC_LINE_NUMBER) 00657 #define IS_LTDC_LIPOS(__LIPOS__) ((__LIPOS__) <= 0x7FFU) 00658 #define IS_LTDC_RELOAD(__RELOADTYPE__) (((__RELOADTYPE__) == LTDC_RELOAD_IMMEDIATE) || ((__RELOADTYPE__) == LTDC_RELOAD_VERTICAL_BLANKING)) 00659 /** 00660 * @} 00661 */ 00662 00663 /* Private functions ---------------------------------------------------------*/ 00664 /** @defgroup LTDC_Private_Functions LTDC Private Functions 00665 * @{ 00666 */ 00667 00668 /** 00669 * @} 00670 */ 00671 00672 /** 00673 * @} 00674 */ 00675 00676 /** 00677 * @} 00678 */ 00679 00680 #endif /* LTDC */ 00681 00682 #ifdef __cplusplus 00683 } 00684 #endif 00685 00686 #endif /* STM32F4xx_HAL_LTDC_H */ 00687 00688 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/