Merge pull request #10592 from iNavFlight/MrD_Update-parameter-description
[inav.git] / lib / main / STM32F4 / Drivers / STM32F4xx_StdPeriph_Driver / inc / stm32f4xx_ltdc.h
blob21b1cdb4962d7b727eb94016b0f3124789b95b9d
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_ltdc.h
4 * @author MCD Application Team
5 * @version V1.7.1
6 * @date 20-May-2016
7 * @brief This file contains all the functions prototypes for the LTDC firmware
8 * library.
9 ******************************************************************************
10 * @attention
12 * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 * You may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at:
18 * http://www.st.com/software_license_agreement_liberty_v2
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
26 ******************************************************************************
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F4xx_LTDC_H
31 #define __STM32F4xx_LTDC_H
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f4xx.h"
40 /** @addtogroup STM32F4xx_StdPeriph_Driver
41 * @{
44 /** @addtogroup LTDC
45 * @{
46 */
48 /* Exported types ------------------------------------------------------------*/
50 /**
51 * @brief LTDC Init structure definition
54 typedef struct
56 uint32_t LTDC_HSPolarity; /*!< configures the horizontal synchronization polarity.
57 This parameter can be one value of @ref LTDC_HSPolarity */
59 uint32_t LTDC_VSPolarity; /*!< configures the vertical synchronization polarity.
60 This parameter can be one value of @ref LTDC_VSPolarity */
62 uint32_t LTDC_DEPolarity; /*!< configures the data enable polarity. This parameter can
63 be one of value of @ref LTDC_DEPolarity */
65 uint32_t LTDC_PCPolarity; /*!< configures the pixel clock polarity. This parameter can
66 be one of value of @ref LTDC_PCPolarity */
68 uint32_t LTDC_HorizontalSync; /*!< configures the number of Horizontal synchronization
69 width. This parameter must range from 0x000 to 0xFFF. */
71 uint32_t LTDC_VerticalSync; /*!< configures the number of Vertical synchronization
72 height. This parameter must range from 0x000 to 0x7FF. */
74 uint32_t LTDC_AccumulatedHBP; /*!< configures the accumulated horizontal back porch width.
75 This parameter must range from LTDC_HorizontalSync to 0xFFF. */
77 uint32_t LTDC_AccumulatedVBP; /*!< configures the accumulated vertical back porch height.
78 This parameter must range from LTDC_VerticalSync to 0x7FF. */
80 uint32_t LTDC_AccumulatedActiveW; /*!< configures the accumulated active width. This parameter
81 must range from LTDC_AccumulatedHBP to 0xFFF. */
83 uint32_t LTDC_AccumulatedActiveH; /*!< configures the accumulated active height. This parameter
84 must range from LTDC_AccumulatedVBP to 0x7FF. */
86 uint32_t LTDC_TotalWidth; /*!< configures the total width. This parameter
87 must range from LTDC_AccumulatedActiveW to 0xFFF. */
89 uint32_t LTDC_TotalHeigh; /*!< configures the total height. This parameter
90 must range from LTDC_AccumulatedActiveH to 0x7FF. */
92 uint32_t LTDC_BackgroundRedValue; /*!< configures the background red value.
93 This parameter must range from 0x00 to 0xFF. */
95 uint32_t LTDC_BackgroundGreenValue; /*!< configures the background green value.
96 This parameter must range from 0x00 to 0xFF. */
98 uint32_t LTDC_BackgroundBlueValue; /*!< configures the background blue value.
99 This parameter must range from 0x00 to 0xFF. */
100 } LTDC_InitTypeDef;
102 /**
103 * @brief LTDC Layer structure definition
106 typedef struct
108 uint32_t LTDC_HorizontalStart; /*!< Configures the Window Horizontal Start Position.
109 This parameter must range from 0x000 to 0xFFF. */
111 uint32_t LTDC_HorizontalStop; /*!< Configures the Window Horizontal Stop Position.
112 This parameter must range from 0x0000 to 0xFFFF. */
114 uint32_t LTDC_VerticalStart; /*!< Configures the Window vertical Start Position.
115 This parameter must range from 0x000 to 0xFFF. */
117 uint32_t LTDC_VerticalStop; /*!< Configures the Window vaertical Stop Position.
118 This parameter must range from 0x0000 to 0xFFFF. */
120 uint32_t LTDC_PixelFormat; /*!< Specifies the pixel format. This parameter can be
121 one of value of @ref LTDC_Pixelformat */
123 uint32_t LTDC_ConstantAlpha; /*!< Specifies the constant alpha used for blending.
124 This parameter must range from 0x00 to 0xFF. */
126 uint32_t LTDC_DefaultColorBlue; /*!< Configures the default blue value.
127 This parameter must range from 0x00 to 0xFF. */
129 uint32_t LTDC_DefaultColorGreen; /*!< Configures the default green value.
130 This parameter must range from 0x00 to 0xFF. */
132 uint32_t LTDC_DefaultColorRed; /*!< Configures the default red value.
133 This parameter must range from 0x00 to 0xFF. */
135 uint32_t LTDC_DefaultColorAlpha; /*!< Configures the default alpha value.
136 This parameter must range from 0x00 to 0xFF. */
138 uint32_t LTDC_BlendingFactor_1; /*!< Select the blending factor 1. This parameter
139 can be one of value of @ref LTDC_BlendingFactor1 */
141 uint32_t LTDC_BlendingFactor_2; /*!< Select the blending factor 2. This parameter
142 can be one of value of @ref LTDC_BlendingFactor2 */
144 uint32_t LTDC_CFBStartAdress; /*!< Configures the color frame buffer address */
146 uint32_t LTDC_CFBLineLength; /*!< Configures the color frame buffer line length.
147 This parameter must range from 0x0000 to 0x1FFF. */
149 uint32_t LTDC_CFBPitch; /*!< Configures the color frame buffer pitch in bytes.
150 This parameter must range from 0x0000 to 0x1FFF. */
152 uint32_t LTDC_CFBLineNumber; /*!< Specifies the number of line in frame buffer.
153 This parameter must range from 0x000 to 0x7FF. */
154 } LTDC_Layer_InitTypeDef;
156 /**
157 * @brief LTDC Position structure definition
159 typedef struct
161 uint32_t LTDC_POSX; /*!< Current X Position */
162 uint32_t LTDC_POSY; /*!< Current Y Position */
163 } LTDC_PosTypeDef;
165 /**
166 * @brief LTDC RGB structure definition
168 typedef struct
170 uint32_t LTDC_BlueWidth; /*!< Blue width */
171 uint32_t LTDC_GreenWidth; /*!< Green width */
172 uint32_t LTDC_RedWidth; /*!< Red width */
173 } LTDC_RGBTypeDef;
175 /**
176 * @brief LTDC Color Keying structure definition
178 typedef struct
180 uint32_t LTDC_ColorKeyBlue; /*!< Configures the color key blue value.
181 This parameter must range from 0x00 to 0xFF. */
183 uint32_t LTDC_ColorKeyGreen; /*!< Configures the color key green value.
184 This parameter must range from 0x00 to 0xFF. */
186 uint32_t LTDC_ColorKeyRed; /*!< Configures the color key red value.
187 This parameter must range from 0x00 to 0xFF. */
188 } LTDC_ColorKeying_InitTypeDef;
190 /**
191 * @brief LTDC CLUT structure definition
193 typedef struct
195 uint32_t LTDC_CLUTAdress; /*!< Configures the CLUT address.
196 This parameter must range from 0x00 to 0xFF. */
198 uint32_t LTDC_BlueValue; /*!< Configures the blue value.
199 This parameter must range from 0x00 to 0xFF. */
201 uint32_t LTDC_GreenValue; /*!< Configures the green value.
202 This parameter must range from 0x00 to 0xFF. */
204 uint32_t LTDC_RedValue; /*!< Configures the red value.
205 This parameter must range from 0x00 to 0xFF. */
206 } LTDC_CLUT_InitTypeDef;
208 /* Exported constants --------------------------------------------------------*/
209 /** @defgroup LTDC_Exported_Constants
210 * @{
213 /** @defgroup LTDC_SYNC
214 * @{
217 #define LTDC_HorizontalSYNC ((uint32_t)0x00000FFF)
218 #define LTDC_VerticalSYNC ((uint32_t)0x000007FF)
220 #define IS_LTDC_HSYNC(HSYNC) ((HSYNC) <= LTDC_HorizontalSYNC)
221 #define IS_LTDC_VSYNC(VSYNC) ((VSYNC) <= LTDC_VerticalSYNC)
222 #define IS_LTDC_AHBP(AHBP) ((AHBP) <= LTDC_HorizontalSYNC)
223 #define IS_LTDC_AVBP(AVBP) ((AVBP) <= LTDC_VerticalSYNC)
224 #define IS_LTDC_AAW(AAW) ((AAW) <= LTDC_HorizontalSYNC)
225 #define IS_LTDC_AAH(AAH) ((AAH) <= LTDC_VerticalSYNC)
226 #define IS_LTDC_TOTALW(TOTALW) ((TOTALW) <= LTDC_HorizontalSYNC)
227 #define IS_LTDC_TOTALH(TOTALH) ((TOTALH) <= LTDC_VerticalSYNC)
229 * @}
232 /** @defgroup LTDC_HSPolarity
233 * @{
235 #define LTDC_HSPolarity_AL ((uint32_t)0x00000000) /*!< Horizontal Synchronization is active low. */
236 #define LTDC_HSPolarity_AH LTDC_GCR_HSPOL /*!< Horizontal Synchronization is active high. */
238 #define IS_LTDC_HSPOL(HSPOL) (((HSPOL) == LTDC_HSPolarity_AL) || \
239 ((HSPOL) == LTDC_HSPolarity_AH))
241 * @}
244 /** @defgroup LTDC_VSPolarity
245 * @{
247 #define LTDC_VSPolarity_AL ((uint32_t)0x00000000) /*!< Vertical Synchronization is active low. */
248 #define LTDC_VSPolarity_AH LTDC_GCR_VSPOL /*!< Vertical Synchronization is active high. */
250 #define IS_LTDC_VSPOL(VSPOL) (((VSPOL) == LTDC_VSPolarity_AL) || \
251 ((VSPOL) == LTDC_VSPolarity_AH))
253 * @}
256 /** @defgroup LTDC_DEPolarity
257 * @{
259 #define LTDC_DEPolarity_AL ((uint32_t)0x00000000) /*!< Data Enable, is active low. */
260 #define LTDC_DEPolarity_AH LTDC_GCR_DEPOL /*!< Data Enable, is active high. */
262 #define IS_LTDC_DEPOL(DEPOL) (((DEPOL) == LTDC_VSPolarity_AL) || \
263 ((DEPOL) == LTDC_DEPolarity_AH))
265 * @}
268 /** @defgroup LTDC_PCPolarity
269 * @{
271 #define LTDC_PCPolarity_IPC ((uint32_t)0x00000000) /*!< input pixel clock. */
272 #define LTDC_PCPolarity_IIPC LTDC_GCR_PCPOL /*!< inverted input pixel clock. */
274 #define IS_LTDC_PCPOL(PCPOL) (((PCPOL) == LTDC_PCPolarity_IPC) || \
275 ((PCPOL) == LTDC_PCPolarity_IIPC))
277 * @}
280 /** @defgroup LTDC_Reload
281 * @{
283 #define LTDC_IMReload LTDC_SRCR_IMR /*!< Immediately Reload. */
284 #define LTDC_VBReload LTDC_SRCR_VBR /*!< Vertical Blanking Reload. */
286 #define IS_LTDC_RELOAD(RELOAD) (((RELOAD) == LTDC_IMReload) || \
287 ((RELOAD) == LTDC_VBReload))
289 * @}
292 /** @defgroup LTDC_Back_Color
293 * @{
295 #define LTDC_Back_Color ((uint32_t)0x000000FF)
297 #define IS_LTDC_BackBlueValue(BBLUE) ((BBLUE) <= LTDC_Back_Color)
298 #define IS_LTDC_BackGreenValue(BGREEN) ((BGREEN) <= LTDC_Back_Color)
299 #define IS_LTDC_BackRedValue(BRED) ((BRED) <= LTDC_Back_Color)
301 * @}
304 /** @defgroup LTDC_Position
305 * @{
307 #define LTDC_POS_CY LTDC_CPSR_CYPOS
308 #define LTDC_POS_CX LTDC_CPSR_CXPOS
310 #define IS_LTDC_GET_POS(POS) (((POS) <= LTDC_POS_CY))
312 * @}
315 /** @defgroup LTDC_LIPosition
316 * @{
318 #define IS_LTDC_LIPOS(LIPOS) ((LIPOS) <= 0x7FF)
320 * @}
323 /** @defgroup LTDC_CurrentStatus
324 * @{
326 #define LTDC_CD_VDES LTDC_CDSR_VDES
327 #define LTDC_CD_HDES LTDC_CDSR_HDES
328 #define LTDC_CD_VSYNC LTDC_CDSR_VSYNCS
329 #define LTDC_CD_HSYNC LTDC_CDSR_HSYNCS
331 #define IS_LTDC_GET_CD(CD) (((CD) == LTDC_CD_VDES) || ((CD) == LTDC_CD_HDES) || \
332 ((CD) == LTDC_CD_VSYNC) || ((CD) == LTDC_CD_HSYNC))
334 * @}
337 /** @defgroup LTDC_Interrupts
338 * @{
340 #define LTDC_IT_LI LTDC_IER_LIE
341 #define LTDC_IT_FU LTDC_IER_FUIE
342 #define LTDC_IT_TERR LTDC_IER_TERRIE
343 #define LTDC_IT_RR LTDC_IER_RRIE
345 #define IS_LTDC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFF0) == 0x00) && ((IT) != 0x00))
348 * @}
351 /** @defgroup LTDC_Flag
352 * @{
354 #define LTDC_FLAG_LI LTDC_ISR_LIF
355 #define LTDC_FLAG_FU LTDC_ISR_FUIF
356 #define LTDC_FLAG_TERR LTDC_ISR_TERRIF
357 #define LTDC_FLAG_RR LTDC_ISR_RRIF
359 #define IS_LTDC_FLAG(FLAG) (((FLAG) == LTDC_FLAG_LI) || ((FLAG) == LTDC_FLAG_FU) || \
360 ((FLAG) == LTDC_FLAG_TERR) || ((FLAG) == LTDC_FLAG_RR))
362 * @}
365 /** @defgroup LTDC_Pixelformat
366 * @{
368 #define LTDC_Pixelformat_ARGB8888 ((uint32_t)0x00000000)
369 #define LTDC_Pixelformat_RGB888 ((uint32_t)0x00000001)
370 #define LTDC_Pixelformat_RGB565 ((uint32_t)0x00000002)
371 #define LTDC_Pixelformat_ARGB1555 ((uint32_t)0x00000003)
372 #define LTDC_Pixelformat_ARGB4444 ((uint32_t)0x00000004)
373 #define LTDC_Pixelformat_L8 ((uint32_t)0x00000005)
374 #define LTDC_Pixelformat_AL44 ((uint32_t)0x00000006)
375 #define LTDC_Pixelformat_AL88 ((uint32_t)0x00000007)
377 #define IS_LTDC_Pixelformat(Pixelformat) (((Pixelformat) == LTDC_Pixelformat_ARGB8888) || ((Pixelformat) == LTDC_Pixelformat_RGB888) || \
378 ((Pixelformat) == LTDC_Pixelformat_RGB565) || ((Pixelformat) == LTDC_Pixelformat_ARGB1555) || \
379 ((Pixelformat) == LTDC_Pixelformat_ARGB4444) || ((Pixelformat) == LTDC_Pixelformat_L8) || \
380 ((Pixelformat) == LTDC_Pixelformat_AL44) || ((Pixelformat) == LTDC_Pixelformat_AL88))
383 * @}
386 /** @defgroup LTDC_BlendingFactor1
387 * @{
389 #define LTDC_BlendingFactor1_CA ((uint32_t)0x00000400)
390 #define LTDC_BlendingFactor1_PAxCA ((uint32_t)0x00000600)
392 #define IS_LTDC_BlendingFactor1(BlendingFactor1) (((BlendingFactor1) == LTDC_BlendingFactor1_CA) || ((BlendingFactor1) == LTDC_BlendingFactor1_PAxCA))
394 * @}
397 /** @defgroup LTDC_BlendingFactor2
398 * @{
400 #define LTDC_BlendingFactor2_CA ((uint32_t)0x00000005)
401 #define LTDC_BlendingFactor2_PAxCA ((uint32_t)0x00000007)
403 #define IS_LTDC_BlendingFactor2(BlendingFactor2) (((BlendingFactor2) == LTDC_BlendingFactor2_CA) || ((BlendingFactor2) == LTDC_BlendingFactor2_PAxCA))
405 * @}
408 /** @defgroup LTDC_LAYER_Config
409 * @{
411 #define LTDC_STOPPosition ((uint32_t)0x0000FFFF)
412 #define LTDC_STARTPosition ((uint32_t)0x00000FFF)
414 #define LTDC_DefaultColorConfig ((uint32_t)0x000000FF)
415 #define LTDC_ColorFrameBuffer ((uint32_t)0x00001FFF)
416 #define LTDC_LineNumber ((uint32_t)0x000007FF)
418 #define IS_LTDC_HCONFIGST(HCONFIGST) ((HCONFIGST) <= LTDC_STARTPosition)
419 #define IS_LTDC_HCONFIGSP(HCONFIGSP) ((HCONFIGSP) <= LTDC_STOPPosition)
420 #define IS_LTDC_VCONFIGST(VCONFIGST) ((VCONFIGST) <= LTDC_STARTPosition)
421 #define IS_LTDC_VCONFIGSP(VCONFIGSP) ((VCONFIGSP) <= LTDC_STOPPosition)
423 #define IS_LTDC_DEFAULTCOLOR(DEFAULTCOLOR) ((DEFAULTCOLOR) <= LTDC_DefaultColorConfig)
425 #define IS_LTDC_CFBP(CFBP) ((CFBP) <= LTDC_ColorFrameBuffer)
426 #define IS_LTDC_CFBLL(CFBLL) ((CFBLL) <= LTDC_ColorFrameBuffer)
428 #define IS_LTDC_CFBLNBR(CFBLNBR) ((CFBLNBR) <= LTDC_LineNumber)
430 * @}
433 /** @defgroup LTDC_colorkeying_Config
434 * @{
436 #define LTDC_colorkeyingConfig ((uint32_t)0x000000FF)
438 #define IS_LTDC_CKEYING(CKEYING) ((CKEYING) <= LTDC_colorkeyingConfig)
440 * @}
443 /** @defgroup LTDC_CLUT_Config
444 * @{
447 #define LTDC_CLUTWR ((uint32_t)0x000000FF)
449 #define IS_LTDC_CLUTWR(CLUTWR) ((CLUTWR) <= LTDC_CLUTWR)
451 /* Exported macro ------------------------------------------------------------*/
452 /* Exported functions ------------------------------------------------------- */
453 /* Function used to set the LTDC configuration to the default reset state *****/
454 void LTDC_DeInit(void);
456 /* Initialization and Configuration functions *********************************/
457 void LTDC_Init(LTDC_InitTypeDef* LTDC_InitStruct);
458 void LTDC_StructInit(LTDC_InitTypeDef* LTDC_InitStruct);
459 void LTDC_Cmd(FunctionalState NewState);
460 void LTDC_DitherCmd(FunctionalState NewState);
461 LTDC_RGBTypeDef LTDC_GetRGBWidth(void);
462 void LTDC_RGBStructInit(LTDC_RGBTypeDef* LTDC_RGB_InitStruct);
463 void LTDC_LIPConfig(uint32_t LTDC_LIPositionConfig);
464 void LTDC_ReloadConfig(uint32_t LTDC_Reload);
465 void LTDC_LayerInit(LTDC_Layer_TypeDef* LTDC_Layerx, LTDC_Layer_InitTypeDef* LTDC_Layer_InitStruct);
466 void LTDC_LayerStructInit(LTDC_Layer_InitTypeDef * LTDC_Layer_InitStruct);
467 void LTDC_LayerCmd(LTDC_Layer_TypeDef* LTDC_Layerx, FunctionalState NewState);
468 LTDC_PosTypeDef LTDC_GetPosStatus(void);
469 void LTDC_PosStructInit(LTDC_PosTypeDef* LTDC_Pos_InitStruct);
470 FlagStatus LTDC_GetCDStatus(uint32_t LTDC_CD);
471 void LTDC_ColorKeyingConfig(LTDC_Layer_TypeDef* LTDC_Layerx, LTDC_ColorKeying_InitTypeDef* LTDC_colorkeying_InitStruct, FunctionalState NewState);
472 void LTDC_ColorKeyingStructInit(LTDC_ColorKeying_InitTypeDef* LTDC_colorkeying_InitStruct);
473 void LTDC_CLUTCmd(LTDC_Layer_TypeDef* LTDC_Layerx, FunctionalState NewState);
474 void LTDC_CLUTInit(LTDC_Layer_TypeDef* LTDC_Layerx, LTDC_CLUT_InitTypeDef* LTDC_CLUT_InitStruct);
475 void LTDC_CLUTStructInit(LTDC_CLUT_InitTypeDef* LTDC_CLUT_InitStruct);
476 void LTDC_LayerPosition(LTDC_Layer_TypeDef* LTDC_Layerx, uint16_t OffsetX, uint16_t OffsetY);
477 void LTDC_LayerAlpha(LTDC_Layer_TypeDef* LTDC_Layerx, uint8_t ConstantAlpha);
478 void LTDC_LayerAddress(LTDC_Layer_TypeDef* LTDC_Layerx, uint32_t Address);
479 void LTDC_LayerSize(LTDC_Layer_TypeDef* LTDC_Layerx, uint32_t Width, uint32_t Height);
480 void LTDC_LayerPixelFormat(LTDC_Layer_TypeDef* LTDC_Layerx, uint32_t PixelFormat);
482 /* Interrupts and flags management functions **********************************/
483 void LTDC_ITConfig(uint32_t LTDC_IT, FunctionalState NewState);
484 FlagStatus LTDC_GetFlagStatus(uint32_t LTDC_FLAG);
485 void LTDC_ClearFlag(uint32_t LTDC_FLAG);
486 ITStatus LTDC_GetITStatus(uint32_t LTDC_IT);
487 void LTDC_ClearITPendingBit(uint32_t LTDC_IT);
489 #ifdef __cplusplus
491 #endif
493 #endif /* __STM32F4xx_LTDC_H */
496 * @}
500 * @}
503 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/