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