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