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