1 /** 2 ****************************************************************************** 3 * @file stm32l4xx_hal_ltdc.h 4 * @author MCD Application Team 5 * @brief Header file of LTDC HAL module. 6 ****************************************************************************** 7 * @attention 8 * 9 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 10 * All rights reserved.</center></h2> 11 * 12 * This software component is licensed by ST under BSD 3-Clause license, 13 * the "License"; You may not use this file except in compliance with the 14 * License. You may obtain a copy of the License at: 15 * opensource.org/licenses/BSD-3-Clause 16 * 17 ****************************************************************************** 18 */ 19 20 /* Define to prevent recursive inclusion -------------------------------------*/ 21 #ifndef STM32L4xx_HAL_LTDC_H 22 #define STM32L4xx_HAL_LTDC_H 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Includes ------------------------------------------------------------------*/ 29 #include "stm32l4xx_hal_def.h" 30 31 #if defined (LTDC) 32 33 /** @addtogroup STM32L4xx_HAL_Driver 34 * @{ 35 */ 36 37 /** @defgroup LTDC LTDC 38 * @brief LTDC HAL module driver 39 * @{ 40 */ 41 42 /* Exported types ------------------------------------------------------------*/ 43 /** @defgroup LTDC_Exported_Types LTDC Exported Types 44 * @{ 45 */ 46 #if defined(LTDC_Layer2_BASE) 47 #define MAX_LAYER 2U 48 #elif defined(LTDC_Layer1_BASE) 49 #define MAX_LAYER 1U 50 #endif 51 52 /** 53 * @brief LTDC color structure definition 54 */ 55 typedef struct 56 { 57 uint8_t Blue; /*!< Configures the blue value. 58 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 59 60 uint8_t Green; /*!< Configures the green value. 61 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 62 63 uint8_t Red; /*!< Configures the red value. 64 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 65 66 uint8_t Reserved; /*!< Reserved 0xFF */ 67 } LTDC_ColorTypeDef; 68 69 /** 70 * @brief LTDC Init structure definition 71 */ 72 typedef struct 73 { 74 uint32_t HSPolarity; /*!< configures the horizontal synchronization polarity. 75 This parameter can be one value of @ref LTDC_HS_POLARITY */ 76 77 uint32_t VSPolarity; /*!< configures the vertical synchronization polarity. 78 This parameter can be one value of @ref LTDC_VS_POLARITY */ 79 80 uint32_t DEPolarity; /*!< configures the data enable polarity. 81 This parameter can be one of value of @ref LTDC_DE_POLARITY */ 82 83 uint32_t PCPolarity; /*!< configures the pixel clock polarity. 84 This parameter can be one of value of @ref LTDC_PC_POLARITY */ 85 86 uint32_t HorizontalSync; /*!< configures the number of Horizontal synchronization width. 87 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ 88 89 uint32_t VerticalSync; /*!< configures the number of Vertical synchronization height. 90 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */ 91 92 uint32_t AccumulatedHBP; /*!< configures the accumulated horizontal back porch width. 93 This parameter must be a number between Min_Data = LTDC_HorizontalSync and Max_Data = 0xFFF. */ 94 95 uint32_t AccumulatedVBP; /*!< configures the accumulated vertical back porch height. 96 This parameter must be a number between Min_Data = LTDC_VerticalSync and Max_Data = 0x7FF. */ 97 98 uint32_t AccumulatedActiveW; /*!< configures the accumulated active width. 99 This parameter must be a number between Min_Data = LTDC_AccumulatedHBP and Max_Data = 0xFFF. */ 100 101 uint32_t AccumulatedActiveH; /*!< configures the accumulated active height. 102 This parameter must be a number between Min_Data = LTDC_AccumulatedVBP and Max_Data = 0x7FF. */ 103 104 uint32_t TotalWidth; /*!< configures the total width. 105 This parameter must be a number between Min_Data = LTDC_AccumulatedActiveW and Max_Data = 0xFFF. */ 106 107 uint32_t TotalHeigh; /*!< configures the total height. 108 This parameter must be a number between Min_Data = LTDC_AccumulatedActiveH and Max_Data = 0x7FF. */ 109 110 LTDC_ColorTypeDef Backcolor; /*!< Configures the background color. */ 111 } LTDC_InitTypeDef; 112 113 /** 114 * @brief LTDC Layer structure definition 115 */ 116 typedef struct 117 { 118 uint32_t WindowX0; /*!< Configures the Window Horizontal Start Position. 119 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ 120 121 uint32_t WindowX1; /*!< Configures the Window Horizontal Stop Position. 122 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ 123 124 uint32_t WindowY0; /*!< Configures the Window vertical Start Position. 125 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */ 126 127 uint32_t WindowY1; /*!< Configures the Window vertical Stop Position. 128 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x7FF. */ 129 130 uint32_t PixelFormat; /*!< Specifies the pixel format. 131 This parameter can be one of value of @ref LTDC_Pixelformat */ 132 133 uint32_t Alpha; /*!< Specifies the constant alpha used for blending. 134 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 135 136 uint32_t Alpha0; /*!< Configures the default alpha value. 137 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ 138 139 uint32_t BlendingFactor1; /*!< Select the blending factor 1. 140 This parameter can be one of value of @ref LTDC_BlendingFactor1 */ 141 142 uint32_t BlendingFactor2; /*!< Select the blending factor 2. 143 This parameter can be one of value of @ref LTDC_BlendingFactor2 */ 144 145 uint32_t FBStartAdress; /*!< Configures the color frame buffer address */ 146 147 uint32_t ImageWidth; /*!< Configures the color frame buffer line length. 148 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x1FFF. */ 149 150 uint32_t ImageHeight; /*!< Specifies the number of line in frame buffer. 151 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */ 152 153 LTDC_ColorTypeDef Backcolor; /*!< Configures the layer background color. */ 154 } LTDC_LayerCfgTypeDef; 155 156 /** 157 * @brief HAL LTDC State structures definition 158 */ 159 typedef enum 160 { 161 HAL_LTDC_STATE_RESET = 0x00U, /*!< LTDC not yet initialized or disabled */ 162 HAL_LTDC_STATE_READY = 0x01U, /*!< LTDC initialized and ready for use */ 163 HAL_LTDC_STATE_BUSY = 0x02U, /*!< LTDC internal process is ongoing */ 164 HAL_LTDC_STATE_TIMEOUT = 0x03U, /*!< LTDC Timeout state */ 165 HAL_LTDC_STATE_ERROR = 0x04U /*!< LTDC state error */ 166 } HAL_LTDC_StateTypeDef; 167 168 /** 169 * @brief LTDC handle Structure definition 170 */ 171 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 172 typedef struct __LTDC_HandleTypeDef 173 #else 174 typedef struct 175 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 176 { 177 LTDC_TypeDef *Instance; /*!< LTDC Register base address */ 178 179 LTDC_InitTypeDef Init; /*!< LTDC parameters */ 180 181 LTDC_LayerCfgTypeDef LayerCfg[MAX_LAYER]; /*!< LTDC Layers parameters */ 182 183 HAL_LockTypeDef Lock; /*!< LTDC Lock */ 184 185 __IO HAL_LTDC_StateTypeDef State; /*!< LTDC state */ 186 187 __IO uint32_t ErrorCode; /*!< LTDC Error code */ 188 189 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 190 void (* LineEventCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Line Event Callback */ 191 void (* ReloadEventCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Reload Event Callback */ 192 void (* ErrorCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Error Callback */ 193 194 void (* MspInitCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Msp Init callback */ 195 void (* MspDeInitCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Msp DeInit callback */ 196 197 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 198 199 200 } LTDC_HandleTypeDef; 201 202 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 203 /** 204 * @brief HAL LTDC Callback ID enumeration definition 205 */ 206 typedef enum 207 { 208 HAL_LTDC_MSPINIT_CB_ID = 0x00U, /*!< LTDC MspInit callback ID */ 209 HAL_LTDC_MSPDEINIT_CB_ID = 0x01U, /*!< LTDC MspDeInit callback ID */ 210 211 HAL_LTDC_LINE_EVENT_CB_ID = 0x02U, /*!< LTDC Line Event Callback ID */ 212 HAL_LTDC_RELOAD_EVENT_CB_ID = 0x03U, /*!< LTDC Reload Callback ID */ 213 HAL_LTDC_ERROR_CB_ID = 0x04U /*!< LTDC Error Callback ID */ 214 215 } HAL_LTDC_CallbackIDTypeDef; 216 217 /** 218 * @brief HAL LTDC Callback pointer definition 219 */ 220 typedef void (*pLTDC_CallbackTypeDef)(LTDC_HandleTypeDef *hltdc); /*!< pointer to an LTDC callback function */ 221 222 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 223 224 /** 225 * @} 226 */ 227 228 /* Exported constants --------------------------------------------------------*/ 229 /** @defgroup LTDC_Exported_Constants LTDC Exported Constants 230 * @{ 231 */ 232 233 /** @defgroup LTDC_Error_Code LTDC Error Code 234 * @{ 235 */ 236 #define HAL_LTDC_ERROR_NONE 0x00000000U /*!< LTDC No error */ 237 #define HAL_LTDC_ERROR_TE 0x00000001U /*!< LTDC Transfer error */ 238 #define HAL_LTDC_ERROR_FU 0x00000002U /*!< LTDC FIFO Underrun */ 239 #define HAL_LTDC_ERROR_TIMEOUT 0x00000020U /*!< LTDC Timeout error */ 240 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 241 #define HAL_LTDC_ERROR_INVALID_CALLBACK 0x00000040U /*!< LTDC Invalid Callback error */ 242 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 243 /** 244 * @} 245 */ 246 247 /** @defgroup LTDC_Layer LTDC Layer 248 * @{ 249 */ 250 #if defined(LTDC_Layer1_BASE) 251 #define LTDC_LAYER_1 0x00000000U /*!< LTDC Layer 1 */ 252 #endif 253 #if defined(LTDC_Layer2_BASE) 254 #define LTDC_LAYER_2 0x00000001U /*!< LTDC Layer 2 */ 255 #endif 256 /** 257 * @} 258 */ 259 260 /** @defgroup LTDC_HS_POLARITY LTDC HS POLARITY 261 * @{ 262 */ 263 #define LTDC_HSPOLARITY_AL 0x00000000U /*!< Horizontal Synchronization is active low. */ 264 #define LTDC_HSPOLARITY_AH LTDC_GCR_HSPOL /*!< Horizontal Synchronization is active high. */ 265 /** 266 * @} 267 */ 268 269 /** @defgroup LTDC_VS_POLARITY LTDC VS POLARITY 270 * @{ 271 */ 272 #define LTDC_VSPOLARITY_AL 0x00000000U /*!< Vertical Synchronization is active low. */ 273 #define LTDC_VSPOLARITY_AH LTDC_GCR_VSPOL /*!< Vertical Synchronization is active high. */ 274 /** 275 * @} 276 */ 277 278 /** @defgroup LTDC_DE_POLARITY LTDC DE POLARITY 279 * @{ 280 */ 281 #define LTDC_DEPOLARITY_AL 0x00000000U /*!< Data Enable, is active low. */ 282 #define LTDC_DEPOLARITY_AH LTDC_GCR_DEPOL /*!< Data Enable, is active high. */ 283 /** 284 * @} 285 */ 286 287 /** @defgroup LTDC_PC_POLARITY LTDC PC POLARITY 288 * @{ 289 */ 290 #define LTDC_PCPOLARITY_IPC 0x00000000U /*!< input pixel clock. */ 291 #define LTDC_PCPOLARITY_IIPC LTDC_GCR_PCPOL /*!< inverted input pixel clock. */ 292 /** 293 * @} 294 */ 295 296 /** @defgroup LTDC_SYNC LTDC SYNC 297 * @{ 298 */ 299 #define LTDC_HORIZONTALSYNC (LTDC_SSCR_HSW >> 16U) /*!< Horizontal synchronization width. */ 300 #define LTDC_VERTICALSYNC LTDC_SSCR_VSH /*!< Vertical synchronization height. */ 301 /** 302 * @} 303 */ 304 305 /** @defgroup LTDC_BACK_COLOR LTDC BACK COLOR 306 * @{ 307 */ 308 #define LTDC_COLOR 0x000000FFU /*!< Color mask */ 309 /** 310 * @} 311 */ 312 313 /** @defgroup LTDC_BlendingFactor1 LTDC Blending Factor1 314 * @{ 315 */ 316 #define LTDC_BLENDING_FACTOR1_CA 0x00000400U /*!< Blending factor : Cte Alpha */ 317 #define LTDC_BLENDING_FACTOR1_PAxCA 0x00000600U /*!< Blending factor : Cte Alpha x Pixel Alpha*/ 318 /** 319 * @} 320 */ 321 322 /** @defgroup LTDC_BlendingFactor2 LTDC Blending Factor2 323 * @{ 324 */ 325 #define LTDC_BLENDING_FACTOR2_CA 0x00000005U /*!< Blending factor : Cte Alpha */ 326 #define LTDC_BLENDING_FACTOR2_PAxCA 0x00000007U /*!< Blending factor : Cte Alpha x Pixel Alpha*/ 327 /** 328 * @} 329 */ 330 331 /** @defgroup LTDC_Pixelformat LTDC Pixel format 332 * @{ 333 */ 334 #define LTDC_PIXEL_FORMAT_ARGB8888 0x00000000U /*!< ARGB8888 LTDC pixel format */ 335 #define LTDC_PIXEL_FORMAT_RGB888 0x00000001U /*!< RGB888 LTDC pixel format */ 336 #define LTDC_PIXEL_FORMAT_RGB565 0x00000002U /*!< RGB565 LTDC pixel format */ 337 #define LTDC_PIXEL_FORMAT_ARGB1555 0x00000003U /*!< ARGB1555 LTDC pixel format */ 338 #define LTDC_PIXEL_FORMAT_ARGB4444 0x00000004U /*!< ARGB4444 LTDC pixel format */ 339 #define LTDC_PIXEL_FORMAT_L8 0x00000005U /*!< L8 LTDC pixel format */ 340 #define LTDC_PIXEL_FORMAT_AL44 0x00000006U /*!< AL44 LTDC pixel format */ 341 #define LTDC_PIXEL_FORMAT_AL88 0x00000007U /*!< AL88 LTDC pixel format */ 342 /** 343 * @} 344 */ 345 346 /** @defgroup LTDC_Alpha LTDC Alpha 347 * @{ 348 */ 349 #define LTDC_ALPHA LTDC_LxCACR_CONSTA /*!< LTDC Constant Alpha mask */ 350 /** 351 * @} 352 */ 353 354 /** @defgroup LTDC_LAYER_Config LTDC LAYER Config 355 * @{ 356 */ 357 #define LTDC_STOPPOSITION (LTDC_LxWHPCR_WHSPPOS >> 16U) /*!< LTDC Layer stop position */ 358 #define LTDC_STARTPOSITION LTDC_LxWHPCR_WHSTPOS /*!< LTDC Layer start position */ 359 360 #define LTDC_COLOR_FRAME_BUFFER LTDC_LxCFBLR_CFBLL /*!< LTDC Layer Line length */ 361 #define LTDC_LINE_NUMBER LTDC_LxCFBLNR_CFBLNBR /*!< LTDC Layer Line number */ 362 /** 363 * @} 364 */ 365 366 /** @defgroup LTDC_Interrupts LTDC Interrupts 367 * @{ 368 */ 369 #define LTDC_IT_LI LTDC_IER_LIE /*!< LTDC Line Interrupt */ 370 #define LTDC_IT_FU LTDC_IER_FUIE /*!< LTDC FIFO Underrun Interrupt */ 371 #define LTDC_IT_TE LTDC_IER_TERRIE /*!< LTDC Transfer Error Interrupt */ 372 #define LTDC_IT_RR LTDC_IER_RRIE /*!< LTDC Register Reload Interrupt */ 373 /** 374 * @} 375 */ 376 377 /** @defgroup LTDC_Flags LTDC Flags 378 * @{ 379 */ 380 #define LTDC_FLAG_LI LTDC_ISR_LIF /*!< LTDC Line Interrupt Flag */ 381 #define LTDC_FLAG_FU LTDC_ISR_FUIF /*!< LTDC FIFO Underrun interrupt Flag */ 382 #define LTDC_FLAG_TE LTDC_ISR_TERRIF /*!< LTDC Transfer Error interrupt Flag */ 383 #define LTDC_FLAG_RR LTDC_ISR_RRIF /*!< LTDC Register Reload interrupt Flag */ 384 /** 385 * @} 386 */ 387 388 /** @defgroup LTDC_Reload_Type LTDC Reload Type 389 * @{ 390 */ 391 #define LTDC_RELOAD_IMMEDIATE LTDC_SRCR_IMR /*!< Immediate Reload */ 392 #define LTDC_RELOAD_VERTICAL_BLANKING LTDC_SRCR_VBR /*!< Vertical Blanking Reload */ 393 /** 394 * @} 395 */ 396 397 /** 398 * @} 399 */ 400 401 /* Exported macro ------------------------------------------------------------*/ 402 /** @defgroup LTDC_Exported_Macros LTDC Exported Macros 403 * @{ 404 */ 405 406 /** @brief Reset LTDC handle state. 407 * @param __HANDLE__ LTDC handle 408 * @retval None 409 */ 410 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 411 #define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) do{ \ 412 (__HANDLE__)->State = HAL_LTDC_STATE_RESET; \ 413 (__HANDLE__)->MspInitCallback = NULL; \ 414 (__HANDLE__)->MspDeInitCallback = NULL; \ 415 } while(0) 416 #else 417 #define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LTDC_STATE_RESET) 418 #endif /*USE_HAL_LTDC_REGISTER_CALLBACKS */ 419 420 /** 421 * @brief Enable the LTDC. 422 * @param __HANDLE__ LTDC handle 423 * @retval None. 424 */ 425 #define __HAL_LTDC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR |= LTDC_GCR_LTDCEN) 426 427 /** 428 * @brief Disable the LTDC. 429 * @param __HANDLE__ LTDC handle 430 * @retval None. 431 */ 432 #define __HAL_LTDC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR &= ~(LTDC_GCR_LTDCEN)) 433 434 /** 435 * @brief Enable the LTDC Layer. 436 * @param __HANDLE__ LTDC handle 437 * @param __LAYER__ Specify the layer to be enabled. 438 * This parameter can be LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1). 439 * @retval None. 440 */ 441 #define __HAL_LTDC_LAYER_ENABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR |= (uint32_t)LTDC_LxCR_LEN) 442 443 /** 444 * @brief Disable the LTDC Layer. 445 * @param __HANDLE__ LTDC handle 446 * @param __LAYER__ Specify the layer to be disabled. 447 * This parameter can be LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1). 448 * @retval None. 449 */ 450 #define __HAL_LTDC_LAYER_DISABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR &= ~(uint32_t)LTDC_LxCR_LEN) 451 452 /** 453 * @brief Reload immediately all LTDC Layers. 454 * @param __HANDLE__ LTDC handle 455 * @retval None. 456 */ 457 #define __HAL_LTDC_RELOAD_IMMEDIATE_CONFIG(__HANDLE__) ((__HANDLE__)->Instance->SRCR |= LTDC_SRCR_IMR) 458 459 /** 460 * @brief Reload during vertical blanking period all LTDC Layers. 461 * @param __HANDLE__ LTDC handle 462 * @retval None. 463 */ 464 #define __HAL_LTDC_VERTICAL_BLANKING_RELOAD_CONFIG(__HANDLE__) ((__HANDLE__)->Instance->SRCR |= LTDC_SRCR_VBR) 465 466 /* Interrupt & Flag management */ 467 /** 468 * @brief Get the LTDC pending flags. 469 * @param __HANDLE__ LTDC handle 470 * @param __FLAG__ Get the specified flag. 471 * This parameter can be any combination of the following values: 472 * @arg LTDC_FLAG_LI: Line Interrupt flag 473 * @arg LTDC_FLAG_FU: FIFO Underrun Interrupt flag 474 * @arg LTDC_FLAG_TE: Transfer Error interrupt flag 475 * @arg LTDC_FLAG_RR: Register Reload Interrupt Flag 476 * @retval The state of FLAG (SET or RESET). 477 */ 478 #define __HAL_LTDC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__)) 479 480 /** 481 * @brief Clears the LTDC pending flags. 482 * @param __HANDLE__ LTDC handle 483 * @param __FLAG__ Specify the flag to clear. 484 * This parameter can be any combination of the following values: 485 * @arg LTDC_FLAG_LI: Line Interrupt flag 486 * @arg LTDC_FLAG_FU: FIFO Underrun Interrupt flag 487 * @arg LTDC_FLAG_TE: Transfer Error interrupt flag 488 * @arg LTDC_FLAG_RR: Register Reload Interrupt Flag 489 * @retval None 490 */ 491 #define __HAL_LTDC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) 492 493 /** 494 * @brief Enables the specified LTDC interrupts. 495 * @param __HANDLE__ LTDC handle 496 * @param __INTERRUPT__ Specify the LTDC interrupt sources to be enabled. 497 * This parameter can be any combination of the following values: 498 * @arg LTDC_IT_LI: Line Interrupt flag 499 * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag 500 * @arg LTDC_IT_TE: Transfer Error interrupt flag 501 * @arg LTDC_IT_RR: Register Reload Interrupt Flag 502 * @retval None 503 */ 504 #define __HAL_LTDC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) 505 506 /** 507 * @brief Disables the specified LTDC interrupts. 508 * @param __HANDLE__ LTDC handle 509 * @param __INTERRUPT__ Specify the LTDC interrupt sources to be disabled. 510 * This parameter can be any combination of the following values: 511 * @arg LTDC_IT_LI: Line Interrupt flag 512 * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag 513 * @arg LTDC_IT_TE: Transfer Error interrupt flag 514 * @arg LTDC_IT_RR: Register Reload Interrupt Flag 515 * @retval None 516 */ 517 #define __HAL_LTDC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__)) 518 519 /** 520 * @brief Check whether the specified LTDC interrupt has occurred or not. 521 * @param __HANDLE__ LTDC handle 522 * @param __INTERRUPT__ Specify the LTDC interrupt source to check. 523 * This parameter can be one of the following values: 524 * @arg LTDC_IT_LI: Line Interrupt flag 525 * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag 526 * @arg LTDC_IT_TE: Transfer Error interrupt flag 527 * @arg LTDC_IT_RR: Register Reload Interrupt Flag 528 * @retval The state of INTERRUPT (SET or RESET). 529 */ 530 #define __HAL_LTDC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__)) 531 /** 532 * @} 533 */ 534 535 /* Include LTDC HAL Extension module */ 536 #include "stm32l4xx_hal_ltdc_ex.h" 537 538 /* Exported functions --------------------------------------------------------*/ 539 /** @addtogroup LTDC_Exported_Functions 540 * @{ 541 */ 542 /** @addtogroup LTDC_Exported_Functions_Group1 543 * @{ 544 */ 545 /* Initialization and de-initialization functions *****************************/ 546 HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc); 547 HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc); 548 void HAL_LTDC_MspInit(LTDC_HandleTypeDef *hltdc); 549 void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc); 550 void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc); 551 void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc); 552 void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc); 553 554 /* Callbacks Register/UnRegister functions ***********************************/ 555 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 556 HAL_StatusTypeDef HAL_LTDC_RegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID, pLTDC_CallbackTypeDef pCallback); 557 HAL_StatusTypeDef HAL_LTDC_UnRegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID); 558 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 559 560 /** 561 * @} 562 */ 563 564 /** @addtogroup LTDC_Exported_Functions_Group2 565 * @{ 566 */ 567 /* IO operation functions *****************************************************/ 568 void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc); 569 /** 570 * @} 571 */ 572 573 /** @addtogroup LTDC_Exported_Functions_Group3 574 * @{ 575 */ 576 /* Peripheral Control functions ***********************************************/ 577 HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx); 578 HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx); 579 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx); 580 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx); 581 HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx); 582 HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx); 583 HAL_StatusTypeDef HAL_LTDC_SetPitch(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx); 584 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx); 585 HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx); 586 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 587 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 588 HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 589 HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 590 HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line); 591 HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc); 592 HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc); 593 HAL_StatusTypeDef HAL_LTDC_Reload(LTDC_HandleTypeDef *hltdc, uint32_t ReloadType); 594 HAL_StatusTypeDef HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx); 595 HAL_StatusTypeDef HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx); 596 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx); 597 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx); 598 HAL_StatusTypeDef HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx); 599 HAL_StatusTypeDef HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx); 600 HAL_StatusTypeDef HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx); 601 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx); 602 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 603 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 604 HAL_StatusTypeDef HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 605 HAL_StatusTypeDef HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); 606 607 /** 608 * @} 609 */ 610 611 /** @addtogroup LTDC_Exported_Functions_Group4 612 * @{ 613 */ 614 /* Peripheral State functions *************************************************/ 615 HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc); 616 uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc); 617 /** 618 * @} 619 */ 620 621 /** 622 * @} 623 */ 624 625 /* Private types -------------------------------------------------------------*/ 626 /* Private variables ---------------------------------------------------------*/ 627 /* Private constants ---------------------------------------------------------*/ 628 /* Private macros ------------------------------------------------------------*/ 629 /** @defgroup LTDC_Private_Macros LTDC Private Macros 630 * @{ 631 */ 632 #define LTDC_LAYER(__HANDLE__, __LAYER__) ((LTDC_Layer_TypeDef *)((uint32_t)(((uint32_t)((__HANDLE__)->Instance)) + 0x84U + (0x80U*(__LAYER__))))) 633 #define IS_LTDC_LAYER(__LAYER__) ((__LAYER__) < MAX_LAYER) 634 #define IS_LTDC_HSPOL(__HSPOL__) (((__HSPOL__) == LTDC_HSPOLARITY_AL) || ((__HSPOL__) == LTDC_HSPOLARITY_AH)) 635 #define IS_LTDC_VSPOL(__VSPOL__) (((__VSPOL__) == LTDC_VSPOLARITY_AL) || ((__VSPOL__) == LTDC_VSPOLARITY_AH)) 636 #define IS_LTDC_DEPOL(__DEPOL__) (((__DEPOL__) == LTDC_DEPOLARITY_AL) || ((__DEPOL__) == LTDC_DEPOLARITY_AH)) 637 #define IS_LTDC_PCPOL(__PCPOL__) (((__PCPOL__) == LTDC_PCPOLARITY_IPC) || ((__PCPOL__) == LTDC_PCPOLARITY_IIPC)) 638 #define IS_LTDC_HSYNC(__HSYNC__) ((__HSYNC__) <= LTDC_HORIZONTALSYNC) 639 #define IS_LTDC_VSYNC(__VSYNC__) ((__VSYNC__) <= LTDC_VERTICALSYNC) 640 #define IS_LTDC_AHBP(__AHBP__) ((__AHBP__) <= LTDC_HORIZONTALSYNC) 641 #define IS_LTDC_AVBP(__AVBP__) ((__AVBP__) <= LTDC_VERTICALSYNC) 642 #define IS_LTDC_AAW(__AAW__) ((__AAW__) <= LTDC_HORIZONTALSYNC) 643 #define IS_LTDC_AAH(__AAH__) ((__AAH__) <= LTDC_VERTICALSYNC) 644 #define IS_LTDC_TOTALW(__TOTALW__) ((__TOTALW__) <= LTDC_HORIZONTALSYNC) 645 #define IS_LTDC_TOTALH(__TOTALH__) ((__TOTALH__) <= LTDC_VERTICALSYNC) 646 #define IS_LTDC_BLUEVALUE(__BBLUE__) ((__BBLUE__) <= LTDC_COLOR) 647 #define IS_LTDC_GREENVALUE(__BGREEN__) ((__BGREEN__) <= LTDC_COLOR) 648 #define IS_LTDC_REDVALUE(__BRED__) ((__BRED__) <= LTDC_COLOR) 649 #define IS_LTDC_BLENDING_FACTOR1(__BLENDING_FACTOR1__) (((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR1_CA) || \ 650 ((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR1_PAxCA)) 651 #define IS_LTDC_BLENDING_FACTOR2(__BLENDING_FACTOR1__) (((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR2_CA) || \ 652 ((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR2_PAxCA)) 653 #define IS_LTDC_PIXEL_FORMAT(__PIXEL_FORMAT__) (((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB8888) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_RGB888) || \ 654 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_RGB565) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB1555) || \ 655 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB4444) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_L8) || \ 656 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_AL44) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_AL88)) 657 #define IS_LTDC_ALPHA(__ALPHA__) ((__ALPHA__) <= LTDC_ALPHA) 658 #define IS_LTDC_HCONFIGST(__HCONFIGST__) ((__HCONFIGST__) <= LTDC_STARTPOSITION) 659 #define IS_LTDC_HCONFIGSP(__HCONFIGSP__) ((__HCONFIGSP__) <= LTDC_STOPPOSITION) 660 #define IS_LTDC_VCONFIGST(__VCONFIGST__) ((__VCONFIGST__) <= LTDC_STARTPOSITION) 661 #define IS_LTDC_VCONFIGSP(__VCONFIGSP__) ((__VCONFIGSP__) <= LTDC_STOPPOSITION) 662 #define IS_LTDC_CFBP(__CFBP__) ((__CFBP__) <= LTDC_COLOR_FRAME_BUFFER) 663 #define IS_LTDC_CFBLL(__CFBLL__) ((__CFBLL__) <= LTDC_COLOR_FRAME_BUFFER) 664 #define IS_LTDC_CFBLNBR(__CFBLNBR__) ((__CFBLNBR__) <= LTDC_LINE_NUMBER) 665 #define IS_LTDC_LIPOS(__LIPOS__) ((__LIPOS__) <= 0x7FFU) 666 #define IS_LTDC_RELOAD(__RELOADTYPE__) (((__RELOADTYPE__) == LTDC_RELOAD_IMMEDIATE) || ((__RELOADTYPE__) == LTDC_RELOAD_VERTICAL_BLANKING)) 667 /** 668 * @} 669 */ 670 671 /* Private functions ---------------------------------------------------------*/ 672 /** @defgroup LTDC_Private_Functions LTDC Private Functions 673 * @{ 674 */ 675 676 /** 677 * @} 678 */ 679 680 /** 681 * @} 682 */ 683 684 /** 685 * @} 686 */ 687 688 #endif /* LTDC */ 689 690 #ifdef __cplusplus 691 } 692 #endif 693 694 #endif /* STM32L4xx_HAL_LTDC_H */ 695 696 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 697