]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/stm32f4xx_hal_ltdc.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F4 / stm32f4xx_hal_ltdc.h
1 /**
2   ******************************************************************************
3   * @file    stm32f4xx_hal_ltdc.h
4   * @author  MCD Application Team
5   * @version V1.1.0
6   * @date    19-June-2014
7   * @brief   Header file of LTDC HAL module.
8   ******************************************************************************
9   * @attention
10   *
11   * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
12   *
13   * Redistribution and use in source and binary forms, with or without modification,
14   * are permitted provided that the following conditions are met:
15   *   1. Redistributions of source code must retain the above copyright notice,
16   *      this list of conditions and the following disclaimer.
17   *   2. Redistributions in binary form must reproduce the above copyright notice,
18   *      this list of conditions and the following disclaimer in the documentation
19   *      and/or other materials provided with the distribution.
20   *   3. Neither the name of STMicroelectronics nor the names of its contributors
21   *      may be used to endorse or promote products derived from this software
22   *      without specific prior written permission.
23   *
24   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34   *
35   ******************************************************************************
36   */ 
37
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F4xx_HAL_LTDC_H
40 #define __STM32F4xx_HAL_LTDC_H
41
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45
46 #if defined(STM32F429xx) || defined(STM32F439xx)
47 /* Includes ------------------------------------------------------------------*/
48 #include "stm32f4xx_hal_def.h"
49
50
51 /** @addtogroup STM32F4xx_HAL_Driver
52   * @{
53   */
54
55 /** @addtogroup LTDC
56   * @{
57   */
58   
59 /* Exported types ------------------------------------------------------------*/
60
61 #define MAX_LAYER  2
62
63 /** 
64   * @brief  LTDC color structure definition
65   */
66 typedef struct
67 {
68   uint8_t Blue;                    /*!< Configures the blue value.
69                                         This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
70
71   uint8_t Green;                   /*!< Configures the green value.
72                                         This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
73
74   uint8_t Red;                     /*!< Configures the red value. 
75                                         This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
76
77   uint8_t Reserved;                /*!< Reserved 0xFF */
78 } LTDC_ColorTypeDef;
79
80 /** 
81   * @brief  LTDC Init structure definition
82   */
83 typedef struct
84 {
85   uint32_t            HSPolarity;                /*!< configures the horizontal synchronization polarity.
86                                                       This parameter can be one value of @ref LTDC_HS_POLARITY */
87
88   uint32_t            VSPolarity;                /*!< configures the vertical synchronization polarity.
89                                                       This parameter can be one value of @ref LTDC_VS_POLARITY */
90
91   uint32_t            DEPolarity;                /*!< configures the data enable polarity. 
92                                                       This parameter can be one of value of @ref LTDC_DE_POLARITY */
93
94   uint32_t            PCPolarity;                /*!< configures the pixel clock polarity. 
95                                                       This parameter can be one of value of @ref LTDC_PC_POLARITY */
96
97   uint32_t            HorizontalSync;            /*!< configures the number of Horizontal synchronization width.
98                                                       This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
99
100   uint32_t            VerticalSync;              /*!< configures the number of Vertical synchronization heigh. 
101                                                       This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */
102
103   uint32_t            AccumulatedHBP;            /*!< configures the accumulated horizontal back porch width.
104                                                       This parameter must be a number between Min_Data = LTDC_HorizontalSync and Max_Data = 0xFFF. */
105
106   uint32_t            AccumulatedVBP;            /*!< configures the accumulated vertical back porch heigh.
107                                                       This parameter must be a number between Min_Data = LTDC_VerticalSync and Max_Data = 0x7FF. */
108
109   uint32_t            AccumulatedActiveW;        /*!< configures the accumulated active width. 
110                                                       This parameter must be a number between Min_Data = LTDC_AccumulatedHBP and Max_Data = 0xFFF. */
111
112   uint32_t            AccumulatedActiveH;        /*!< configures the accumulated active heigh.
113                                                       This parameter must be a number between Min_Data = LTDC_AccumulatedVBP and Max_Data = 0x7FF. */
114
115   uint32_t            TotalWidth;                /*!< configures the total width.
116                                                       This parameter must be a number between Min_Data = LTDC_AccumulatedActiveW and Max_Data = 0xFFF. */
117
118   uint32_t            TotalHeigh;                /*!< configures the total heigh.
119                                                       This parameter must be a number between Min_Data = LTDC_AccumulatedActiveH and Max_Data = 0x7FF. */
120
121   LTDC_ColorTypeDef   Backcolor;                 /*!< Configures the background color. */
122 } LTDC_InitTypeDef;
123
124
125 /** 
126   * @brief  LTDC Layer structure definition
127   */
128 typedef struct
129 {
130   uint32_t WindowX0;                   /*!< Configures the Window Horizontal Start Position.
131                                             This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
132
133   uint32_t WindowX1;                   /*!< Configures the Window Horizontal Stop Position.
134                                             This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
135
136   uint32_t WindowY0;                   /*!< Configures the Window vertical Start Position.
137                                             This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
138
139   uint32_t WindowY1;                   /*!< Configures the Window vertical Stop Position.
140                                             This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */
141
142   uint32_t PixelFormat;                /*!< Specifies the pixel format. 
143                                             This parameter can be one of value of @ref LTDC_Pixelformat */
144
145   uint32_t Alpha;                      /*!< Specifies the constant alpha used for blending.
146                                             This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
147
148   uint32_t Alpha0;                     /*!< Configures the default alpha value.
149                                             This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
150
151   uint32_t BlendingFactor1;            /*!< Select the blending factor 1. 
152                                             This parameter can be one of value of @ref LTDC_BlendingFactor1 */
153
154   uint32_t BlendingFactor2;            /*!< Select the blending factor 2. 
155                                             This parameter can be one of value of @ref LTDC_BlendingFactor2 */
156
157   uint32_t FBStartAdress;              /*!< Configures the color frame buffer address */
158
159   uint32_t ImageWidth;                 /*!< Configures the color frame buffer line length. 
160                                             This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x1FFF. */
161
162   uint32_t ImageHeight;                /*!< Specifies the number of line in frame buffer. 
163                                             This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */
164
165   LTDC_ColorTypeDef   Backcolor;       /*!< Configures the layer background color. */
166 } LTDC_LayerCfgTypeDef;
167
168 /** 
169   * @brief  HAL LTDC State structures definition
170   */
171 typedef enum
172 {
173   HAL_LTDC_STATE_RESET             = 0x00,    /*!< LTDC not yet initialized or disabled */
174   HAL_LTDC_STATE_READY             = 0x01,    /*!< LTDC initialized and ready for use   */
175   HAL_LTDC_STATE_BUSY              = 0x02,    /*!< LTDC internal process is ongoing     */
176   HAL_LTDC_STATE_TIMEOUT           = 0x03,    /*!< LTDC Timeout state                   */
177   HAL_LTDC_STATE_ERROR             = 0x04     /*!< LTDC state error                     */
178 }HAL_LTDC_StateTypeDef;
179
180 /** 
181   * @brief  LTDC handle Structure definition
182   */
183 typedef struct
184 {
185   LTDC_TypeDef                *Instance;                /*!< LTDC Register base address                */
186
187   LTDC_InitTypeDef            Init;                     /*!< LTDC parameters                           */
188
189   LTDC_LayerCfgTypeDef        LayerCfg[MAX_LAYER];      /*!< LTDC Layers parameters                    */
190
191   HAL_LockTypeDef             Lock;                     /*!< LTDC Lock                                 */
192
193   __IO HAL_LTDC_StateTypeDef  State;                    /*!< LTDC state                                */
194
195   __IO uint32_t               ErrorCode;                /*!< LTDC Error code                           */
196
197 } LTDC_HandleTypeDef;
198
199 /* Exported constants --------------------------------------------------------*/
200 /** @defgroup LTDC_Exported_Constants
201   * @{
202   */
203
204 /** @defgroup LTDC_Layer 
205   * @{
206   */  
207 #define IS_LTDC_LAYER(LAYER) ((LAYER) <= MAX_LAYER)
208 /**
209   * @}
210   */
211
212 /** @defgroup LTDC Error Code 
213   * @{
214   */  
215 #define HAL_LTDC_ERROR_NONE      ((uint32_t)0x00000000)    /*!< LTDC No error             */
216 #define HAL_LTDC_ERROR_TE        ((uint32_t)0x00000001)    /*!< LTDC Transfer error       */
217 #define HAL_LTDC_ERROR_FU        ((uint32_t)0x00000002)    /*!< LTDC FIFO Underrun        */
218 #define HAL_LTDC_ERROR_TIMEOUT   ((uint32_t)0x00000020)    /*!< LTDC Timeout error        */
219
220 /**
221   * @}
222   */
223
224 /** @defgroup LTDC_HS_POLARITY 
225   * @{
226   */
227 #define LTDC_HSPOLARITY_AL                ((uint32_t)0x00000000)                /*!< Horizontal Synchronization is active low. */
228 #define LTDC_HSPOLARITY_AH                LTDC_GCR_HSPOL                        /*!< Horizontal Synchronization is active high. */
229
230 #define IS_LTDC_HSPOL(HSPOL) (((HSPOL) == LTDC_HSPOLARITY_AL) || \
231                               ((HSPOL) == LTDC_HSPOLARITY_AH))  
232 /**
233   * @}
234   */
235
236 /** @defgroup LTDC_VS_POLARITY 
237   * @{
238   */
239 #define LTDC_VSPOLARITY_AL                ((uint32_t)0x00000000)                /*!< Vertical Synchronization is active low. */
240 #define LTDC_VSPOLARITY_AH                LTDC_GCR_VSPOL                        /*!< Vertical Synchronization is active high. */
241
242 #define IS_LTDC_VSPOL(VSPOL) (((VSPOL) == LTDC_VSPOLARITY_AL) || \
243                               ((VSPOL) == LTDC_VSPOLARITY_AH))
244 /**
245   * @}
246   */
247   
248 /** @defgroup LTDC_DE_POLARITY 
249   * @{
250   */
251 #define LTDC_DEPOLARITY_AL                ((uint32_t)0x00000000)                /*!< Data Enable, is active low. */
252 #define LTDC_DEPOLARITY_AH                LTDC_GCR_DEPOL                        /*!< Data Enable, is active high. */
253
254 #define IS_LTDC_DEPOL(DEPOL) (((DEPOL) ==  LTDC_DEPOLARITY_AL) || \
255                               ((DEPOL) ==  LTDC_DEPOLARITY_AH))
256 /**
257   * @}
258   */
259
260 /** @defgroup LTDC_PC_POLARITY 
261   * @{
262   */
263 #define LTDC_PCPOLARITY_IPC               ((uint32_t)0x00000000)                /*!< input pixel clock. */
264 #define LTDC_PCPOLARITY_IIPC              LTDC_GCR_PCPOL                        /*!< inverted input pixel clock. */
265
266 #define IS_LTDC_PCPOL(PCPOL) (((PCPOL) ==  LTDC_PCPOLARITY_IPC) || \
267                               ((PCPOL) ==  LTDC_PCPOLARITY_IIPC))
268 /**
269   * @}
270   */
271
272 /** @defgroup LTDC_SYNC 
273   * @{
274   */
275 #define LTDC_HORIZONTALSYNC               (LTDC_SSCR_HSW >> 16)                 /*!< Horizontal synchronization width. */ 
276 #define LTDC_VERTICALSYNC                 LTDC_SSCR_VSH                         /*!< Vertical synchronization heigh. */
277
278 #define IS_LTDC_HSYNC(HSYNC)   ((HSYNC)  <= LTDC_HORIZONTALSYNC)
279 #define IS_LTDC_VSYNC(VSYNC)   ((VSYNC)  <= LTDC_VERTICALSYNC)
280 #define IS_LTDC_AHBP(AHBP)     ((AHBP)   <= LTDC_HORIZONTALSYNC)
281 #define IS_LTDC_AVBP(AVBP)     ((AVBP)   <= LTDC_VERTICALSYNC)
282 #define IS_LTDC_AAW(AAW)       ((AAW)    <= LTDC_HORIZONTALSYNC)
283 #define IS_LTDC_AAH(AAH)       ((AAH)    <= LTDC_VERTICALSYNC)
284 #define IS_LTDC_TOTALW(TOTALW) ((TOTALW) <= LTDC_HORIZONTALSYNC)
285 #define IS_LTDC_TOTALH(TOTALH) ((TOTALH) <= LTDC_VERTICALSYNC)
286 /**
287   * @}
288   */
289
290 /** @defgroup LTDC_BACK_COLOR
291   * @{
292   */ 
293 #define LTDC_COLOR                   ((uint32_t)0x000000FF)                     /*!< Color mask */
294
295 #define IS_LTDC_BLUEVALUE(BBLUE)    ((BBLUE)  <= LTDC_COLOR)
296 #define IS_LTDC_GREENVALUE(BGREEN)  ((BGREEN) <= LTDC_COLOR)
297 #define IS_LTDC_REDVALUE(BRED)      ((BRED)   <= LTDC_COLOR) 
298 /**
299   * @}
300   */
301       
302 /** @defgroup LTDC_BlendingFactor1 
303   * @{
304   */
305 #define LTDC_BLENDING_FACTOR1_CA                       ((uint32_t)0x00000400)   /*!< Blending factor : Cte Alpha */
306 #define LTDC_BLENDING_FACTOR1_PAxCA                    ((uint32_t)0x00000600)   /*!< Blending factor : Cte Alpha x Pixel Alpha*/
307
308 #define IS_LTDC_BLENDING_FACTOR1(BlendingFactor1) (((BlendingFactor1) == LTDC_BLENDING_FACTOR1_CA) || \
309                                                    ((BlendingFactor1) == LTDC_BLENDING_FACTOR1_PAxCA))
310 /**
311   * @}
312   */
313
314 /** @defgroup LTDC_BlendingFactor2
315   * @{
316   */
317 #define LTDC_BLENDING_FACTOR2_CA                       ((uint32_t)0x00000005)   /*!< Blending factor : Cte Alpha */
318 #define LTDC_BLENDING_FACTOR2_PAxCA                    ((uint32_t)0x00000007)   /*!< Blending factor : Cte Alpha x Pixel Alpha*/
319
320 #define IS_LTDC_BLENDING_FACTOR2(BlendingFactor2) (((BlendingFactor2) == LTDC_BLENDING_FACTOR2_CA) || \
321                                                    ((BlendingFactor2) == LTDC_BLENDING_FACTOR2_PAxCA))
322 /**
323   * @}
324   */
325       
326 /** @defgroup LTDC_Pixelformat 
327   * @{
328   */
329 #define LTDC_PIXEL_FORMAT_ARGB8888                  ((uint32_t)0x00000000)      /*!< ARGB8888 LTDC pixel format */
330 #define LTDC_PIXEL_FORMAT_RGB888                    ((uint32_t)0x00000001)      /*!< RGB888 LTDC pixel format   */
331 #define LTDC_PIXEL_FORMAT_RGB565                    ((uint32_t)0x00000002)      /*!< RGB565 LTDC pixel format   */
332 #define LTDC_PIXEL_FORMAT_ARGB1555                  ((uint32_t)0x00000003)      /*!< ARGB1555 LTDC pixel format */
333 #define LTDC_PIXEL_FORMAT_ARGB4444                  ((uint32_t)0x00000004)      /*!< ARGB4444 LTDC pixel format */
334 #define LTDC_PIXEL_FORMAT_L8                        ((uint32_t)0x00000005)      /*!< L8 LTDC pixel format       */
335 #define LTDC_PIXEL_FORMAT_AL44                      ((uint32_t)0x00000006)      /*!< AL44 LTDC pixel format     */
336 #define LTDC_PIXEL_FORMAT_AL88                      ((uint32_t)0x00000007)      /*!< AL88 LTDC pixel format     */
337
338 #define IS_LTDC_PIXEL_FORMAT(Pixelformat) (((Pixelformat) == LTDC_PIXEL_FORMAT_ARGB8888) || ((Pixelformat) == LTDC_PIXEL_FORMAT_RGB888)   || \
339                                            ((Pixelformat) == LTDC_PIXEL_FORMAT_RGB565)   || ((Pixelformat) == LTDC_PIXEL_FORMAT_ARGB1555) || \
340                                            ((Pixelformat) == LTDC_PIXEL_FORMAT_ARGB4444) || ((Pixelformat) == LTDC_PIXEL_FORMAT_L8)       || \
341                                            ((Pixelformat) == LTDC_PIXEL_FORMAT_AL44)     || ((Pixelformat) == LTDC_PIXEL_FORMAT_AL88))
342 /**
343   * @}
344   */
345
346 /** @defgroup LTDC_Alpha
347   * @{
348   */
349 #define LTDC_ALPHA               LTDC_LxCACR_CONSTA                             /*!< LTDC Cte Alpha mask */
350
351 #define IS_LTDC_ALPHA(ALPHA) ((ALPHA) <= LTDC_ALPHA)
352 /**
353   * @}
354   */
355
356 /** @defgroup LTDC_LAYER_Config
357   * @{
358   */
359 #define LTDC_STOPPOSITION                 (LTDC_LxWHPCR_WHSPPOS >> 16)          /*!< LTDC Layer stop position  */
360 #define LTDC_STARTPOSITION                LTDC_LxWHPCR_WHSTPOS                  /*!< LTDC Layer start position */
361
362 #define LTDC_COLOR_FRAME_BUFFER           LTDC_LxCFBLR_CFBLL                    /*!< LTDC Layer Line length    */ 
363 #define LTDC_LINE_NUMBER                  LTDC_LxCFBLNR_CFBLNBR                 /*!< LTDC Layer Line number    */
364
365 #define IS_LTDC_HCONFIGST(HCONFIGST) ((HCONFIGST) <= LTDC_STARTPOSITION)
366 #define IS_LTDC_HCONFIGSP(HCONFIGSP) ((HCONFIGSP) <= LTDC_STOPPOSITION)
367 #define IS_LTDC_VCONFIGST(VCONFIGST)  ((VCONFIGST) <= LTDC_STARTPOSITION)
368 #define IS_LTDC_VCONFIGSP(VCONFIGSP) ((VCONFIGSP) <= LTDC_STOPPOSITION)
369
370 #define IS_LTDC_CFBP(CFBP) ((CFBP) <= LTDC_COLOR_FRAME_BUFFER)
371 #define IS_LTDC_CFBLL(CFBLL) ((CFBLL) <= LTDC_COLOR_FRAME_BUFFER)
372
373 #define IS_LTDC_CFBLNBR(CFBLNBR) ((CFBLNBR) <= LTDC_LINE_NUMBER)
374 /**
375   * @}
376   */
377
378 /** @defgroup LTDC_LIPosition 
379   * @{
380   */
381 #define IS_LTDC_LIPOS(LIPOS) ((LIPOS) <= 0x7FF)
382 /**
383   * @}
384   */
385
386 /** @defgroup LTDC_Interrupts 
387   * @{
388   */
389 #define LTDC_IT_LI                      LTDC_IER_LIE
390 #define LTDC_IT_FU                      LTDC_IER_FUIE
391 #define LTDC_IT_TE                      LTDC_IER_TERRIE
392 #define LTDC_IT_RR                      LTDC_IER_RRIE
393
394 #define IS_LTDC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFF0) == 0x00) && ((IT) != 0x00))
395 /**
396   * @}
397   */
398       
399 /** @defgroup LTDC_Flag 
400   * @{
401   */
402 #define LTDC_FLAG_LI                     LTDC_ISR_LIF
403 #define LTDC_FLAG_FU                     LTDC_ISR_FUIF
404 #define LTDC_FLAG_TE                     LTDC_ISR_TERRIF
405 #define LTDC_FLAG_RR                     LTDC_ISR_RRIF
406
407 #define IS_LTDC_FLAG(FLAG) (((FLAG) == LTDC_FLAG_LI) || ((FLAG) == LTDC_FLAG_FU) || \
408                                ((FLAG) == LTDC_FLAG_TERR) || ((FLAG) == LTDC_FLAG_RR))
409 /**
410   * @}
411   */
412
413 /**
414   * @}
415   */  
416
417 /* Exported macro ------------------------------------------------------------*/
418
419 /** @brief Reset LTDC handle state
420   * @param  __HANDLE__: specifies the LTDC handle.
421   * @retval None
422   */
423 #define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LTDC_STATE_RESET)
424
425 /**
426   * @brief  Enable the LTDC.
427   * @param  __HANDLE__: LTDC handle
428   * @retval None.
429   */
430 #define __HAL_LTDC_ENABLE(__HANDLE__)    ((__HANDLE__)->Instance->GCR |= LTDC_GCR_LTDCEN)
431
432 /**
433   * @brief  Disable the LTDC.
434   * @param  __HANDLE__: LTDC handle
435   * @retval None.
436   */
437 #define __HAL_LTDC_DISABLE(__HANDLE__)   ((__HANDLE__)->Instance->GCR &= ~(LTDC_GCR_LTDCEN))
438
439 /**
440   * @brief  Enable the LTDC Layer.
441   * @param  __HANDLE__: LTDC handle
442   * @param  __LAYER__: Specify the layer to be enabled
443                        This parameter can be 0 or 1
444   * @retval None.
445   */
446 #define __HAL_LTDC_LAYER(__HANDLE__, __LAYER__)   ((LTDC_Layer_TypeDef *)(((uint32_t)((__HANDLE__)->Instance)) + 0x84 + (0x80*(__LAYER__))))
447
448 #define __HAL_LTDC_LAYER_ENABLE(__HANDLE__, __LAYER__)  ((__HAL_LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR |= (uint32_t)LTDC_LxCR_LEN)
449
450 /**
451   * @brief  Disable the LTDC Layer.
452   * @param  __HANDLE__: LTDC handle
453   * @param  __LAYER__: Specify the layer to be disabled
454                        This parameter can be 0 or 1
455   * @retval None.
456   */
457 #define __HAL_LTDC_LAYER_DISABLE(__HANDLE__, __LAYER__) ((__HAL_LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR &= ~(uint32_t)LTDC_LxCR_LEN)
458
459 /**
460   * @brief  Reload  Layer Configuration.
461   * @param  __HANDLE__: LTDC handle
462   * @retval None.
463   */
464 #define __HAL_LTDC_RELOAD_CONFIG(__HANDLE__)   ((__HANDLE__)->Instance->SRCR |= LTDC_SRCR_IMR)
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__: specifies 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__: specifies 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__: specifies 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  Checks whether the specified LTDC interrupt has occurred or not.
521   * @param  __HANDLE__: LTDC handle
522   * @param  __INTERRUPT__: specifies 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->ISR & (__INTERRUPT__))
531
532 /* Exported functions --------------------------------------------------------*/
533
534 /* Initialization and de-initialization functions *****************************/
535 HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc);
536 HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc);
537 void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc);
538 void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc);
539 void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc);
540 void HAL_LTDC_LineEvenCallback(LTDC_HandleTypeDef *hltdc);
541
542 /* IO operation functions *****************************************************/
543 void  HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc);
544
545 /* Peripheral Control functions ***********************************************/
546 HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx);
547 HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx);
548 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx);
549 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx);
550 HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx);
551 HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx);
552 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx);
553 HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx);
554 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
555 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
556 HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
557 HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
558 HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line);
559 HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc);
560 HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc);
561
562 /* Peripheral State functions *************************************************/
563 HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc);
564 uint32_t              HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc);
565
566 #endif /* STM32F429xx || STM32F439xx */
567
568 /**
569   * @}
570   */ 
571
572 /**
573   * @}
574   */ 
575   
576 #ifdef __cplusplus
577 }
578 #endif
579
580 #endif /* __STM32F4xx_HAL_LTDC_H */
581
582 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/