stm32f7xx_hal_ltdc.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F7xx_HAL_LTDC_H
  37. #define __STM32F7xx_HAL_LTDC_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  42. /* Includes ------------------------------------------------------------------*/
  43. #include "stm32f7xx_hal_def.h"
  44. /** @addtogroup STM32F7xx_HAL_Driver
  45. * @{
  46. */
  47. /** @defgroup LTDC LTDC
  48. * @brief LTDC HAL module driver
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup LTDC_Exported_Types LTDC Exported Types
  53. * @{
  54. */
  55. #define MAX_LAYER 2
  56. /**
  57. * @brief LTDC color structure definition
  58. */
  59. typedef struct
  60. {
  61. uint8_t Blue; /*!< Configures the blue value.
  62. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  63. uint8_t Green; /*!< Configures the green value.
  64. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  65. uint8_t Red; /*!< Configures the red value.
  66. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  67. uint8_t Reserved; /*!< Reserved 0xFF */
  68. } LTDC_ColorTypeDef;
  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. uint32_t VSPolarity; /*!< configures the vertical synchronization polarity.
  77. This parameter can be one value of @ref LTDC_VS_POLARITY */
  78. uint32_t DEPolarity; /*!< configures the data enable polarity.
  79. This parameter can be one of value of @ref LTDC_DE_POLARITY */
  80. uint32_t PCPolarity; /*!< configures the pixel clock polarity.
  81. This parameter can be one of value of @ref LTDC_PC_POLARITY */
  82. uint32_t HorizontalSync; /*!< configures the number of Horizontal synchronization width.
  83. This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
  84. uint32_t VerticalSync; /*!< configures the number of Vertical synchronization height.
  85. This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */
  86. uint32_t AccumulatedHBP; /*!< configures the accumulated horizontal back porch width.
  87. This parameter must be a number between Min_Data = LTDC_HorizontalSync and Max_Data = 0xFFF. */
  88. uint32_t AccumulatedVBP; /*!< configures the accumulated vertical back porch height.
  89. This parameter must be a number between Min_Data = LTDC_VerticalSync and Max_Data = 0x7FF. */
  90. uint32_t AccumulatedActiveW; /*!< configures the accumulated active width.
  91. This parameter must be a number between Min_Data = LTDC_AccumulatedHBP and Max_Data = 0xFFF. */
  92. uint32_t AccumulatedActiveH; /*!< configures the accumulated active height.
  93. This parameter must be a number between Min_Data = LTDC_AccumulatedVBP and Max_Data = 0x7FF. */
  94. uint32_t TotalWidth; /*!< configures the total width.
  95. This parameter must be a number between Min_Data = LTDC_AccumulatedActiveW and Max_Data = 0xFFF. */
  96. uint32_t TotalHeigh; /*!< configures the total height.
  97. This parameter must be a number between Min_Data = LTDC_AccumulatedActiveH and Max_Data = 0x7FF. */
  98. LTDC_ColorTypeDef Backcolor; /*!< Configures the background color. */
  99. } LTDC_InitTypeDef;
  100. /**
  101. * @brief LTDC Layer structure definition
  102. */
  103. typedef struct
  104. {
  105. uint32_t WindowX0; /*!< Configures the Window Horizontal Start Position.
  106. This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
  107. uint32_t WindowX1; /*!< Configures the Window Horizontal Stop Position.
  108. This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
  109. uint32_t WindowY0; /*!< Configures the Window vertical Start Position.
  110. This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */
  111. uint32_t WindowY1; /*!< Configures the Window vertical Stop Position.
  112. This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x7FF. */
  113. uint32_t PixelFormat; /*!< Specifies the pixel format.
  114. This parameter can be one of value of @ref LTDC_Pixelformat */
  115. uint32_t Alpha; /*!< Specifies the constant alpha used for blending.
  116. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  117. uint32_t Alpha0; /*!< Configures the default alpha value.
  118. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  119. uint32_t BlendingFactor1; /*!< Select the blending factor 1.
  120. This parameter can be one of value of @ref LTDC_BlendingFactor1 */
  121. uint32_t BlendingFactor2; /*!< Select the blending factor 2.
  122. This parameter can be one of value of @ref LTDC_BlendingFactor2 */
  123. uint32_t FBStartAdress; /*!< Configures the color frame buffer address */
  124. uint32_t ImageWidth; /*!< Configures the color frame buffer line length.
  125. This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x1FFF. */
  126. uint32_t ImageHeight; /*!< Specifies the number of line in frame buffer.
  127. This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */
  128. LTDC_ColorTypeDef Backcolor; /*!< Configures the layer background color. */
  129. } LTDC_LayerCfgTypeDef;
  130. /**
  131. * @brief HAL LTDC State structures definition
  132. */
  133. typedef enum
  134. {
  135. HAL_LTDC_STATE_RESET = 0x00U, /*!< LTDC not yet initialized or disabled */
  136. HAL_LTDC_STATE_READY = 0x01U, /*!< LTDC initialized and ready for use */
  137. HAL_LTDC_STATE_BUSY = 0x02U, /*!< LTDC internal process is ongoing */
  138. HAL_LTDC_STATE_TIMEOUT = 0x03U, /*!< LTDC Timeout state */
  139. HAL_LTDC_STATE_ERROR = 0x04U /*!< LTDC state error */
  140. }HAL_LTDC_StateTypeDef;
  141. /**
  142. * @brief LTDC handle Structure definition
  143. */
  144. typedef struct
  145. {
  146. LTDC_TypeDef *Instance; /*!< LTDC Register base address */
  147. LTDC_InitTypeDef Init; /*!< LTDC parameters */
  148. LTDC_LayerCfgTypeDef LayerCfg[MAX_LAYER]; /*!< LTDC Layers parameters */
  149. HAL_LockTypeDef Lock; /*!< LTDC Lock */
  150. __IO HAL_LTDC_StateTypeDef State; /*!< LTDC state */
  151. __IO uint32_t ErrorCode; /*!< LTDC Error code */
  152. } LTDC_HandleTypeDef;
  153. /**
  154. * @}
  155. */
  156. /* Exported constants --------------------------------------------------------*/
  157. /** @defgroup LTDC_Exported_Constants LTDC Exported Constants
  158. * @{
  159. */
  160. /** @defgroup LTDC_Error_Code LTDC Error Code
  161. * @{
  162. */
  163. #define HAL_LTDC_ERROR_NONE ((uint32_t)0x00000000U) /*!< LTDC No error */
  164. #define HAL_LTDC_ERROR_TE ((uint32_t)0x00000001U) /*!< LTDC Transfer error */
  165. #define HAL_LTDC_ERROR_FU ((uint32_t)0x00000002U) /*!< LTDC FIFO Underrun */
  166. #define HAL_LTDC_ERROR_TIMEOUT ((uint32_t)0x00000020U) /*!< LTDC Timeout error */
  167. /**
  168. * @}
  169. */
  170. /** @defgroup LTDC_HS_POLARITY LTDC HS POLARITY
  171. * @{
  172. */
  173. #define LTDC_HSPOLARITY_AL ((uint32_t)0x00000000U) /*!< Horizontal Synchronization is active low. */
  174. #define LTDC_HSPOLARITY_AH LTDC_GCR_HSPOL /*!< Horizontal Synchronization is active high. */
  175. /**
  176. * @}
  177. */
  178. /** @defgroup LTDC_VS_POLARITY LTDC VS POLARITY
  179. * @{
  180. */
  181. #define LTDC_VSPOLARITY_AL ((uint32_t)0x00000000U) /*!< Vertical Synchronization is active low. */
  182. #define LTDC_VSPOLARITY_AH LTDC_GCR_VSPOL /*!< Vertical Synchronization is active high. */
  183. /**
  184. * @}
  185. */
  186. /** @defgroup LTDC_DE_POLARITY LTDC DE POLARITY
  187. * @{
  188. */
  189. #define LTDC_DEPOLARITY_AL ((uint32_t)0x00000000U) /*!< Data Enable, is active low. */
  190. #define LTDC_DEPOLARITY_AH LTDC_GCR_DEPOL /*!< Data Enable, is active high. */
  191. /**
  192. * @}
  193. */
  194. /** @defgroup LTDC_PC_POLARITY LTDC PC POLARITY
  195. * @{
  196. */
  197. #define LTDC_PCPOLARITY_IPC ((uint32_t)0x00000000U) /*!< input pixel clock. */
  198. #define LTDC_PCPOLARITY_IIPC LTDC_GCR_PCPOL /*!< inverted input pixel clock. */
  199. /**
  200. * @}
  201. */
  202. /** @defgroup LTDC_SYNC LTDC SYNC
  203. * @{
  204. */
  205. #define LTDC_HORIZONTALSYNC (LTDC_SSCR_HSW >> 16) /*!< Horizontal synchronization width. */
  206. #define LTDC_VERTICALSYNC LTDC_SSCR_VSH /*!< Vertical synchronization height. */
  207. /**
  208. * @}
  209. */
  210. /** @defgroup LTDC_BACK_COLOR LTDC BACK COLOR
  211. * @{
  212. */
  213. #define LTDC_COLOR ((uint32_t)0x000000FFU) /*!< Color mask */
  214. /**
  215. * @}
  216. */
  217. /** @defgroup LTDC_BlendingFactor1 LTDC Blending Factor1
  218. * @{
  219. */
  220. #define LTDC_BLENDING_FACTOR1_CA ((uint32_t)0x00000400U) /*!< Blending factor : Cte Alpha */
  221. #define LTDC_BLENDING_FACTOR1_PAxCA ((uint32_t)0x00000600U) /*!< Blending factor : Cte Alpha x Pixel Alpha*/
  222. /**
  223. * @}
  224. */
  225. /** @defgroup LTDC_BlendingFactor2 LTDC Blending Factor2
  226. * @{
  227. */
  228. #define LTDC_BLENDING_FACTOR2_CA ((uint32_t)0x00000005U) /*!< Blending factor : Cte Alpha */
  229. #define LTDC_BLENDING_FACTOR2_PAxCA ((uint32_t)0x00000007U) /*!< Blending factor : Cte Alpha x Pixel Alpha*/
  230. /**
  231. * @}
  232. */
  233. /** @defgroup LTDC_Pixelformat LTDC Pixel format
  234. * @{
  235. */
  236. #define LTDC_PIXEL_FORMAT_ARGB8888 ((uint32_t)0x00000000U) /*!< ARGB8888 LTDC pixel format */
  237. #define LTDC_PIXEL_FORMAT_RGB888 ((uint32_t)0x00000001U) /*!< RGB888 LTDC pixel format */
  238. #define LTDC_PIXEL_FORMAT_RGB565 ((uint32_t)0x00000002U) /*!< RGB565 LTDC pixel format */
  239. #define LTDC_PIXEL_FORMAT_ARGB1555 ((uint32_t)0x00000003U) /*!< ARGB1555 LTDC pixel format */
  240. #define LTDC_PIXEL_FORMAT_ARGB4444 ((uint32_t)0x00000004U) /*!< ARGB4444 LTDC pixel format */
  241. #define LTDC_PIXEL_FORMAT_L8 ((uint32_t)0x00000005U) /*!< L8 LTDC pixel format */
  242. #define LTDC_PIXEL_FORMAT_AL44 ((uint32_t)0x00000006U) /*!< AL44 LTDC pixel format */
  243. #define LTDC_PIXEL_FORMAT_AL88 ((uint32_t)0x00000007U) /*!< AL88 LTDC pixel format */
  244. /**
  245. * @}
  246. */
  247. /** @defgroup LTDC_Alpha LTDC Alpha
  248. * @{
  249. */
  250. #define LTDC_ALPHA LTDC_LxCACR_CONSTA /*!< LTDC Cte Alpha mask */
  251. /**
  252. * @}
  253. */
  254. /** @defgroup LTDC_LAYER_Config LTDC LAYER Config
  255. * @{
  256. */
  257. #define LTDC_STOPPOSITION (LTDC_LxWHPCR_WHSPPOS >> 16) /*!< LTDC Layer stop position */
  258. #define LTDC_STARTPOSITION LTDC_LxWHPCR_WHSTPOS /*!< LTDC Layer start position */
  259. #define LTDC_COLOR_FRAME_BUFFER LTDC_LxCFBLR_CFBLL /*!< LTDC Layer Line length */
  260. #define LTDC_LINE_NUMBER LTDC_LxCFBLNR_CFBLNBR /*!< LTDC Layer Line number */
  261. /**
  262. * @}
  263. */
  264. /** @defgroup LTDC_Interrupts LTDC Interrupts
  265. * @{
  266. */
  267. #define LTDC_IT_LI LTDC_IER_LIE
  268. #define LTDC_IT_FU LTDC_IER_FUIE
  269. #define LTDC_IT_TE LTDC_IER_TERRIE
  270. #define LTDC_IT_RR LTDC_IER_RRIE
  271. /**
  272. * @}
  273. */
  274. /** @defgroup LTDC_Flag LTDC Flag
  275. * @{
  276. */
  277. #define LTDC_FLAG_LI LTDC_ISR_LIF
  278. #define LTDC_FLAG_FU LTDC_ISR_FUIF
  279. #define LTDC_FLAG_TE LTDC_ISR_TERRIF
  280. #define LTDC_FLAG_RR LTDC_ISR_RRIF
  281. /**
  282. * @}
  283. */
  284. /** @defgroup LTDC_Reload_Type LTDC Reload Type
  285. * @{
  286. */
  287. #define LTDC_RELOAD_IMMEDIATE LTDC_SRCR_IMR /*!< Immediate Reload */
  288. #define LTDC_RELOAD_VERTICAL_BLANKING LTDC_SRCR_VBR /*!< Vertical Blanking Reload */
  289. /**
  290. * @}
  291. */
  292. /**
  293. * @}
  294. */
  295. /* Exported macro ------------------------------------------------------------*/
  296. /** @defgroup LTDC_Exported_Macros LTDC Exported Macros
  297. * @{
  298. */
  299. /** @brief Reset LTDC handle state
  300. * @param __HANDLE__ specifies the LTDC handle.
  301. * @retval None
  302. */
  303. #define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LTDC_STATE_RESET)
  304. /**
  305. * @brief Enable the LTDC.
  306. * @param __HANDLE__ LTDC handle
  307. * @retval None.
  308. */
  309. #define __HAL_LTDC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR |= LTDC_GCR_LTDCEN)
  310. /**
  311. * @brief Disable the LTDC.
  312. * @param __HANDLE__ LTDC handle
  313. * @retval None.
  314. */
  315. #define __HAL_LTDC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR &= ~(LTDC_GCR_LTDCEN))
  316. /**
  317. * @brief Enable the LTDC Layer.
  318. * @param __HANDLE__ LTDC handle
  319. * @param __LAYER__ Specify the layer to be enabled
  320. * This parameter can be 0 or 1
  321. * @retval None.
  322. */
  323. #define __HAL_LTDC_LAYER_ENABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR |= (uint32_t)LTDC_LxCR_LEN)
  324. /**
  325. * @brief Disable the LTDC Layer.
  326. * @param __HANDLE__ LTDC handle
  327. * @param __LAYER__ Specify the layer to be disabled
  328. * This parameter can be 0 or 1
  329. * @retval None.
  330. */
  331. #define __HAL_LTDC_LAYER_DISABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR &= ~(uint32_t)LTDC_LxCR_LEN)
  332. /**
  333. * @brief Reload Layer Configuration.
  334. * @param __HANDLE__ LTDC handle
  335. * @retval None.
  336. */
  337. #define __HAL_LTDC_RELOAD_CONFIG(__HANDLE__) ((__HANDLE__)->Instance->SRCR |= LTDC_SRCR_IMR)
  338. /* Interrupt & Flag management */
  339. /**
  340. * @brief Get the LTDC pending flags.
  341. * @param __HANDLE__ LTDC handle
  342. * @param __FLAG__ Get the specified flag.
  343. * This parameter can be any combination of the following values:
  344. * @arg LTDC_FLAG_LI: Line Interrupt flag
  345. * @arg LTDC_FLAG_FU: FIFO Underrun Interrupt flag
  346. * @arg LTDC_FLAG_TE: Transfer Error interrupt flag
  347. * @arg LTDC_FLAG_RR: Register Reload Interrupt Flag
  348. * @retval The state of FLAG (SET or RESET).
  349. */
  350. #define __HAL_LTDC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__))
  351. /**
  352. * @brief Clears the LTDC pending flags.
  353. * @param __HANDLE__ LTDC handle
  354. * @param __FLAG__ specifies the flag to clear.
  355. * This parameter can be any combination of the following values:
  356. * @arg LTDC_FLAG_LI: Line Interrupt flag
  357. * @arg LTDC_FLAG_FU: FIFO Underrun Interrupt flag
  358. * @arg LTDC_FLAG_TE: Transfer Error interrupt flag
  359. * @arg LTDC_FLAG_RR: Register Reload Interrupt Flag
  360. * @retval None
  361. */
  362. #define __HAL_LTDC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
  363. /**
  364. * @brief Enables the specified LTDC interrupts.
  365. * @param __HANDLE__ LTDC handle
  366. * @param __INTERRUPT__ specifies the LTDC interrupt sources to be enabled.
  367. * This parameter can be any combination of the following values:
  368. * @arg LTDC_IT_LI: Line Interrupt flag
  369. * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag
  370. * @arg LTDC_IT_TE: Transfer Error interrupt flag
  371. * @arg LTDC_IT_RR: Register Reload Interrupt Flag
  372. * @retval None
  373. */
  374. #define __HAL_LTDC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
  375. /**
  376. * @brief Disables the specified LTDC interrupts.
  377. * @param __HANDLE__ LTDC handle
  378. * @param __INTERRUPT__ specifies the LTDC interrupt sources to be disabled.
  379. * This parameter can be any combination of the following values:
  380. * @arg LTDC_IT_LI: Line Interrupt flag
  381. * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag
  382. * @arg LTDC_IT_TE: Transfer Error interrupt flag
  383. * @arg LTDC_IT_RR: Register Reload Interrupt Flag
  384. * @retval None
  385. */
  386. #define __HAL_LTDC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
  387. /**
  388. * @brief Checks whether the specified LTDC interrupt has occurred or not.
  389. * @param __HANDLE__ LTDC handle
  390. * @param __INTERRUPT__ specifies the LTDC interrupt source to check.
  391. * This parameter can be one of the following values:
  392. * @arg LTDC_IT_LI: Line Interrupt flag
  393. * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag
  394. * @arg LTDC_IT_TE: Transfer Error interrupt flag
  395. * @arg LTDC_IT_RR: Register Reload Interrupt Flag
  396. * @retval The state of INTERRUPT (SET or RESET).
  397. */
  398. #define __HAL_LTDC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->ISR & (__INTERRUPT__))
  399. /**
  400. * @}
  401. */
  402. #if defined (STM32F769xx) || defined (STM32F779xx)
  403. /* Include LTDC HAL Extension module */
  404. #include "stm32f7xx_hal_ltdc_ex.h"
  405. #endif /* STM32F769xx) | STM32F779xx */
  406. /* Exported functions --------------------------------------------------------*/
  407. /** @addtogroup LTDC_Exported_Functions
  408. * @{
  409. */
  410. /** @addtogroup LTDC_Exported_Functions_Group1
  411. * @{
  412. */
  413. /* Initialization and de-initialization functions *****************************/
  414. HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc);
  415. HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc);
  416. void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc);
  417. void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc);
  418. void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc);
  419. void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc);
  420. void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc);
  421. /**
  422. * @}
  423. */
  424. /** @addtogroup LTDC_Exported_Functions_Group2
  425. * @{
  426. */
  427. /* IO operation functions *****************************************************/
  428. void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc);
  429. /**
  430. * @}
  431. */
  432. /** @addtogroup LTDC_Exported_Functions_Group3
  433. * @{
  434. */
  435. /* Peripheral Control functions ***********************************************/
  436. HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx);
  437. HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx);
  438. HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx);
  439. HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx);
  440. HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx);
  441. HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx);
  442. HAL_StatusTypeDef HAL_LTDC_SetPitch(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx);
  443. HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx);
  444. HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx);
  445. HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
  446. HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
  447. HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
  448. HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
  449. HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line);
  450. HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc);
  451. HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc);
  452. HAL_StatusTypeDef HAL_LTDC_Reload(LTDC_HandleTypeDef *hltdc, uint32_t ReloadType);
  453. HAL_StatusTypeDef HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx);
  454. HAL_StatusTypeDef HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx);
  455. HAL_StatusTypeDef HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx);
  456. HAL_StatusTypeDef HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx);
  457. HAL_StatusTypeDef HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx);
  458. HAL_StatusTypeDef HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx);
  459. HAL_StatusTypeDef HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx);
  460. HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx);
  461. HAL_StatusTypeDef HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
  462. HAL_StatusTypeDef HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
  463. HAL_StatusTypeDef HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
  464. HAL_StatusTypeDef HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
  465. /**
  466. * @}
  467. */
  468. /** @addtogroup LTDC_Exported_Functions_Group4
  469. * @{
  470. */
  471. /* Peripheral State functions *************************************************/
  472. HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc);
  473. uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc);
  474. /**
  475. * @}
  476. */
  477. /**
  478. * @}
  479. */
  480. /* Private types -------------------------------------------------------------*/
  481. /** @defgroup LTDC_Private_Types LTDC Private Types
  482. * @{
  483. */
  484. /**
  485. * @}
  486. */
  487. /* Private variables ---------------------------------------------------------*/
  488. /** @defgroup LTDC_Private_Variables LTDC Private Variables
  489. * @{
  490. */
  491. /**
  492. * @}
  493. */
  494. /* Private constants ---------------------------------------------------------*/
  495. /** @defgroup LTDC_Private_Constants LTDC Private Constants
  496. * @{
  497. */
  498. /**
  499. * @}
  500. */
  501. /* Private macros ------------------------------------------------------------*/
  502. /** @defgroup LTDC_Private_Macros LTDC Private Macros
  503. * @{
  504. */
  505. #define LTDC_LAYER(__HANDLE__, __LAYER__) ((LTDC_Layer_TypeDef *)((uint32_t)(((uint32_t)((__HANDLE__)->Instance)) + 0x84 + (0x80*(__LAYER__)))))
  506. #define IS_LTDC_LAYER(LAYER) ((LAYER) <= MAX_LAYER)
  507. #define IS_LTDC_HSPOL(HSPOL) (((HSPOL) == LTDC_HSPOLARITY_AL) || \
  508. ((HSPOL) == LTDC_HSPOLARITY_AH))
  509. #define IS_LTDC_VSPOL(VSPOL) (((VSPOL) == LTDC_VSPOLARITY_AL) || \
  510. ((VSPOL) == LTDC_VSPOLARITY_AH))
  511. #define IS_LTDC_DEPOL(DEPOL) (((DEPOL) == LTDC_DEPOLARITY_AL) || \
  512. ((DEPOL) == LTDC_DEPOLARITY_AH))
  513. #define IS_LTDC_PCPOL(PCPOL) (((PCPOL) == LTDC_PCPOLARITY_IPC) || \
  514. ((PCPOL) == LTDC_PCPOLARITY_IIPC))
  515. #define IS_LTDC_HSYNC(HSYNC) ((HSYNC) <= LTDC_HORIZONTALSYNC)
  516. #define IS_LTDC_VSYNC(VSYNC) ((VSYNC) <= LTDC_VERTICALSYNC)
  517. #define IS_LTDC_AHBP(AHBP) ((AHBP) <= LTDC_HORIZONTALSYNC)
  518. #define IS_LTDC_AVBP(AVBP) ((AVBP) <= LTDC_VERTICALSYNC)
  519. #define IS_LTDC_AAW(AAW) ((AAW) <= LTDC_HORIZONTALSYNC)
  520. #define IS_LTDC_AAH(AAH) ((AAH) <= LTDC_VERTICALSYNC)
  521. #define IS_LTDC_TOTALW(TOTALW) ((TOTALW) <= LTDC_HORIZONTALSYNC)
  522. #define IS_LTDC_TOTALH(TOTALH) ((TOTALH) <= LTDC_VERTICALSYNC)
  523. #define IS_LTDC_BLUEVALUE(BBLUE) ((BBLUE) <= LTDC_COLOR)
  524. #define IS_LTDC_GREENVALUE(BGREEN) ((BGREEN) <= LTDC_COLOR)
  525. #define IS_LTDC_REDVALUE(BRED) ((BRED) <= LTDC_COLOR)
  526. #define IS_LTDC_BLENDING_FACTOR1(BlendingFactor1) (((BlendingFactor1) == LTDC_BLENDING_FACTOR1_CA) || \
  527. ((BlendingFactor1) == LTDC_BLENDING_FACTOR1_PAxCA))
  528. #define IS_LTDC_BLENDING_FACTOR2(BlendingFactor2) (((BlendingFactor2) == LTDC_BLENDING_FACTOR2_CA) || \
  529. ((BlendingFactor2) == LTDC_BLENDING_FACTOR2_PAxCA))
  530. #define IS_LTDC_PIXEL_FORMAT(Pixelformat) (((Pixelformat) == LTDC_PIXEL_FORMAT_ARGB8888) || ((Pixelformat) == LTDC_PIXEL_FORMAT_RGB888) || \
  531. ((Pixelformat) == LTDC_PIXEL_FORMAT_RGB565) || ((Pixelformat) == LTDC_PIXEL_FORMAT_ARGB1555) || \
  532. ((Pixelformat) == LTDC_PIXEL_FORMAT_ARGB4444) || ((Pixelformat) == LTDC_PIXEL_FORMAT_L8) || \
  533. ((Pixelformat) == LTDC_PIXEL_FORMAT_AL44) || ((Pixelformat) == LTDC_PIXEL_FORMAT_AL88))
  534. #define IS_LTDC_ALPHA(ALPHA) ((ALPHA) <= LTDC_ALPHA)
  535. #define IS_LTDC_HCONFIGST(HCONFIGST) ((HCONFIGST) <= LTDC_STARTPOSITION)
  536. #define IS_LTDC_HCONFIGSP(HCONFIGSP) ((HCONFIGSP) <= LTDC_STOPPOSITION)
  537. #define IS_LTDC_VCONFIGST(VCONFIGST) ((VCONFIGST) <= LTDC_STARTPOSITION)
  538. #define IS_LTDC_VCONFIGSP(VCONFIGSP) ((VCONFIGSP) <= LTDC_STOPPOSITION)
  539. #define IS_LTDC_CFBP(CFBP) ((CFBP) <= LTDC_COLOR_FRAME_BUFFER)
  540. #define IS_LTDC_CFBLL(CFBLL) ((CFBLL) <= LTDC_COLOR_FRAME_BUFFER)
  541. #define IS_LTDC_CFBLNBR(CFBLNBR) ((CFBLNBR) <= LTDC_LINE_NUMBER)
  542. #define IS_LTDC_LIPOS(LIPOS) ((LIPOS) <= 0x7FF)
  543. #define IS_LTDC_RELAOD(RELOADTYPE) (((RELOADTYPE) == LTDC_RELOAD_IMMEDIATE) || ((RELOADTYPE) == LTDC_SRCR_VBR))
  544. /**
  545. * @}
  546. */
  547. /* Private functions ---------------------------------------------------------*/
  548. /** @defgroup LTDC_Private_Functions LTDC Private Functions
  549. * @{
  550. */
  551. /**
  552. * @}
  553. */
  554. /**
  555. * @}
  556. */
  557. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  558. /**
  559. * @}
  560. */
  561. #ifdef __cplusplus
  562. }
  563. #endif
  564. #endif /* __STM32F7xx_HAL_LTDC_H */
  565. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/