Merge maintenance-8.x.x fixes into master
[inav.git] / lib / main / STM32H7 / Drivers / STM32H7xx_HAL_Driver / Inc / stm32h7xx_hal_dcmi.h
blob672d5de0f8ffffcf1459f3a80b4b2fcb54e09e32
1 /**
2 ******************************************************************************
3 * @file stm32h7xx_hal_dcmi.h
4 * @author MCD Application Team
5 * @brief Header file of DCMI HAL module.
6 ******************************************************************************
7 * @attention
9 * Copyright (c) 2017 STMicroelectronics.
10 * All rights reserved.
12 * This software is licensed under terms that can be found in the LICENSE file
13 * in the root directory of this software component.
14 * If no LICENSE file comes with this software, it is provided AS-IS.
16 ******************************************************************************
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32H7xx_HAL_DCMI_H
21 #define STM32H7xx_HAL_DCMI_H
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h7xx_hal_def.h"
30 #if defined (DCMI)
31 /** @addtogroup STM32H7xx_HAL_Driver
32 * @{
35 /** @addtogroup DCMI DCMI
36 * @brief DCMI HAL module driver
37 * @{
40 /* Exported types ------------------------------------------------------------*/
41 /** @defgroup DCMI_Exported_Types DCMI Exported Types
42 * @{
44 /**
45 * @brief HAL DCMI State structures definition
47 typedef enum
49 HAL_DCMI_STATE_RESET = 0x00U, /*!< DCMI not yet initialized or disabled */
50 HAL_DCMI_STATE_READY = 0x01U, /*!< DCMI initialized and ready for use */
51 HAL_DCMI_STATE_BUSY = 0x02U, /*!< DCMI internal processing is ongoing */
52 HAL_DCMI_STATE_TIMEOUT = 0x03U, /*!< DCMI timeout state */
53 HAL_DCMI_STATE_ERROR = 0x04U, /*!< DCMI error state */
54 HAL_DCMI_STATE_SUSPENDED = 0x05U /*!< DCMI suspend state */
55 } HAL_DCMI_StateTypeDef;
57 /**
58 * @brief DCMI Embedded Synchronisation CODE Init structure definition
60 typedef struct
62 uint8_t FrameStartCode; /*!< Specifies the code of the frame start delimiter. */
63 uint8_t LineStartCode; /*!< Specifies the code of the line start delimiter. */
64 uint8_t LineEndCode; /*!< Specifies the code of the line end delimiter. */
65 uint8_t FrameEndCode; /*!< Specifies the code of the frame end delimiter. */
66 } DCMI_CodesInitTypeDef;
68 /**
69 * @brief DCMI Embedded Synchronisation UNMASK Init structure definition
71 typedef struct
73 uint8_t FrameStartUnmask; /*!< Specifies the frame start delimiter unmask. */
74 uint8_t LineStartUnmask; /*!< Specifies the line start delimiter unmask. */
75 uint8_t LineEndUnmask; /*!< Specifies the line end delimiter unmask. */
76 uint8_t FrameEndUnmask; /*!< Specifies the frame end delimiter unmask. */
77 } DCMI_SyncUnmaskTypeDef;
78 /**
79 * @brief DCMI Init structure definition
81 typedef struct
83 uint32_t SynchroMode; /*!< Specifies the Synchronization Mode: Hardware or Embedded.
84 This parameter can be a value of @ref DCMI_Synchronization_Mode */
86 uint32_t PCKPolarity; /*!< Specifies the Pixel clock polarity: Falling or Rising.
87 This parameter can be a value of @ref DCMI_PIXCK_Polarity */
89 uint32_t VSPolarity; /*!< Specifies the Vertical synchronization polarity: High or Low.
90 This parameter can be a value of @ref DCMI_VSYNC_Polarity */
92 uint32_t HSPolarity; /*!< Specifies the Horizontal synchronization polarity: High or Low.
93 This parameter can be a value of @ref DCMI_HSYNC_Polarity */
95 uint32_t CaptureRate; /*!< Specifies the frequency of frame capture: All, 1/2 or 1/4.
96 This parameter can be a value of @ref DCMI_Capture_Rate */
98 uint32_t ExtendedDataMode; /*!< Specifies the data width: 8-bit, 10-bit, 12-bit or 14-bit.
99 This parameter can be a value of @ref DCMI_Extended_Data_Mode */
101 DCMI_CodesInitTypeDef SyncroCode; /*!< Specifies the code of the line/frame start delimiter and the
102 line/frame end delimiter */
104 uint32_t JPEGMode; /*!< Enable or Disable the JPEG mode.
105 This parameter can be a value of @ref DCMI_MODE_JPEG */
107 uint32_t ByteSelectMode; /*!< Specifies the data to be captured by the interface
108 This parameter can be a value of @ref DCMI_Byte_Select_Mode */
110 uint32_t ByteSelectStart; /*!< Specifies if the data to be captured by the interface is even or odd
111 This parameter can be a value of @ref DCMI_Byte_Select_Start */
113 uint32_t LineSelectMode; /*!< Specifies the line of data to be captured by the interface
114 This parameter can be a value of @ref DCMI_Line_Select_Mode */
116 uint32_t LineSelectStart; /*!< Specifies if the line of data to be captured by the interface is even or odd
117 This parameter can be a value of @ref DCMI_Line_Select_Start */
118 } DCMI_InitTypeDef;
121 * @brief DCMI handle Structure definition
123 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
124 typedef struct __DCMI_HandleTypeDef
125 #else
126 typedef struct
127 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
129 DCMI_TypeDef *Instance; /*!< DCMI Register base address */
131 DCMI_InitTypeDef Init; /*!< DCMI parameters */
133 HAL_LockTypeDef Lock; /*!< DCMI locking object */
135 __IO HAL_DCMI_StateTypeDef State; /*!< DCMI state */
137 __IO uint32_t XferCount; /*!< DMA transfer counter */
139 __IO uint32_t XferSize; /*!< DMA transfer size */
141 uint32_t XferTransferNumber; /*!< DMA transfer number */
143 uint32_t pBuffPtr; /*!< Pointer to DMA output buffer */
145 DMA_HandleTypeDef *DMA_Handle; /*!< Pointer to the DMA handler */
147 __IO uint32_t ErrorCode; /*!< DCMI Error code */
149 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
150 void (* FrameEventCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Frame Event Callback */
151 void (* VsyncEventCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Vsync Event Callback */
152 void (* LineEventCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Line Event Callback */
153 void (* ErrorCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Error Callback */
154 void (* MspInitCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Msp Init callback */
155 void (* MspDeInitCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Msp DeInit callback */
156 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
157 } DCMI_HandleTypeDef;
159 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
161 * @brief HAL DCMI Callback ID enumeration definition
163 typedef enum
165 HAL_DCMI_FRAME_EVENT_CB_ID = 0x00U, /*!< DCMI Frame Event Callback ID */
166 HAL_DCMI_VSYNC_EVENT_CB_ID = 0x01U, /*!< DCMI Vsync Event Callback ID */
167 HAL_DCMI_LINE_EVENT_CB_ID = 0x02U, /*!< DCMI Line Event Callback ID */
168 HAL_DCMI_ERROR_CB_ID = 0x03U, /*!< DCMI Error Callback ID */
169 HAL_DCMI_MSPINIT_CB_ID = 0x04U, /*!< DCMI MspInit callback ID */
170 HAL_DCMI_MSPDEINIT_CB_ID = 0x05U /*!< DCMI MspDeInit callback ID */
172 } HAL_DCMI_CallbackIDTypeDef;
175 * @brief HAL DCMI Callback pointer definition
177 typedef void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef * hdcmi); /*!< pointer to a DCMI callback function */
179 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
181 * @}
183 /* Exported constants --------------------------------------------------------*/
185 /** @defgroup DCMI_Exported_Constants DCMI Exported Constants
186 * @{
189 /** @defgroup DCMI_Error_Code DCMI Error Code
190 * @{
192 #define HAL_DCMI_ERROR_NONE (0x00000000U) /*!< No error */
193 #define HAL_DCMI_ERROR_OVR (0x00000001U) /*!< Overrun error */
194 #define HAL_DCMI_ERROR_SYNC (0x00000002U) /*!< Synchronization error */
195 #define HAL_DCMI_ERROR_TIMEOUT (0x00000020U) /*!< Timeout error */
196 #define HAL_DCMI_ERROR_DMA (0x00000040U) /*!< DMA error */
197 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
198 #define HAL_DCMI_ERROR_INVALID_CALLBACK (0x00000080U) /*!< Invalid Callback error */
199 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
201 * @}
204 /** @defgroup DCMI_Capture_Mode DCMI Capture Mode
205 * @{
207 #define DCMI_MODE_CONTINUOUS (0x00000000U) /*!< The received data are transferred continuously
208 into the destination memory through the DMA */
209 #define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM) /*!< Once activated, the interface waits for the start of
210 frame and then transfers a single frame through the DMA */
212 * @}
215 /** @defgroup DCMI_Synchronization_Mode DCMI Synchronization Mode
216 * @{
218 #define DCMI_SYNCHRO_HARDWARE (0x00000000U) /*!< Hardware synchronization data capture (frame/line start/stop)
219 is synchronized with the HSYNC/VSYNC signals */
220 #define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS) /*!< Embedded synchronization data capture is synchronized with
221 synchronization codes embedded in the data flow */
224 * @}
227 /** @defgroup DCMI_PIXCK_Polarity DCMI PIXCK Polarity
228 * @{
230 #define DCMI_PCKPOLARITY_FALLING (0x00000000U) /*!< Pixel clock active on Falling edge */
231 #define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL) /*!< Pixel clock active on Rising edge */
234 * @}
237 /** @defgroup DCMI_VSYNC_Polarity DCMI VSYNC Polarity
238 * @{
240 #define DCMI_VSPOLARITY_LOW (0x00000000U) /*!< Vertical synchronization active Low */
241 #define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL) /*!< Vertical synchronization active High */
244 * @}
247 /** @defgroup DCMI_HSYNC_Polarity DCMI HSYNC Polarity
248 * @{
250 #define DCMI_HSPOLARITY_LOW (0x00000000U) /*!< Horizontal synchronization active Low */
251 #define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL) /*!< Horizontal synchronization active High */
254 * @}
257 /** @defgroup DCMI_MODE_JPEG DCMI MODE JPEG
258 * @{
260 #define DCMI_JPEG_DISABLE (0x00000000U) /*!< Mode JPEG Disabled */
261 #define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG) /*!< Mode JPEG Enabled */
264 * @}
267 /** @defgroup DCMI_Capture_Rate DCMI Capture Rate
268 * @{
270 #define DCMI_CR_ALL_FRAME (0x00000000U) /*!< All frames are captured */
271 #define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0) /*!< Every alternate frame captured */
272 #define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1) /*!< One frame in 4 frames captured */
275 * @}
278 /** @defgroup DCMI_Extended_Data_Mode DCMI Extended Data Mode
279 * @{
281 #define DCMI_EXTEND_DATA_8B (0x00000000U) /*!< Interface captures 8-bit data on every pixel clock */
282 #define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0) /*!< Interface captures 10-bit data on every pixel clock */
283 #define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1) /*!< Interface captures 12-bit data on every pixel clock */
284 #define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1)) /*!< Interface captures 14-bit data on every pixel clock */
287 * @}
290 /** @defgroup DCMI_Window_Coordinate DCMI Window Coordinate
291 * @{
293 #define DCMI_WINDOW_COORDINATE (0x3FFFU) /*!< Window coordinate */
296 * @}
299 /** @defgroup DCMI_Window_Height DCMI Window Height
300 * @{
302 #define DCMI_WINDOW_HEIGHT (0x1FFFU) /*!< Window Height */
305 * @}
308 /** @defgroup DCMI_interrupt_sources DCMI interrupt sources
309 * @{
311 #define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE) /*!< Capture complete interrupt */
312 #define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE) /*!< Overrun interrupt */
313 #define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE) /*!< Synchronization error interrupt */
314 #define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE) /*!< VSYNC interrupt */
315 #define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE) /*!< Line interrupt */
317 * @}
320 /** @defgroup DCMI_Flags DCMI Flags
321 * @{
325 * @brief DCMI SR register
327 #define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC) /*!< HSYNC pin state (active line / synchronization between lines) */
328 #define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC) /*!< VSYNC pin state (active frame / synchronization between frames) */
329 #define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE) /*!< FIFO not empty flag */
331 * @brief DCMI RIS register
333 #define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RIS_FRAME_RIS) /*!< Frame capture complete interrupt flag */
334 #define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RIS_OVR_RIS) /*!< Overrun interrupt flag */
335 #define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RIS_ERR_RIS) /*!< Synchronization error interrupt flag */
336 #define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RIS_VSYNC_RIS) /*!< VSYNC interrupt flag */
337 #define DCMI_FLAG_LINERI ((uint32_t)DCMI_RIS_LINE_RIS) /*!< Line interrupt flag */
339 * @brief DCMI MIS register
341 #define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS) /*!< DCMI Frame capture complete masked interrupt status */
342 #define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS ) /*!< DCMI Overrun masked interrupt status */
343 #define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS ) /*!< DCMI Synchronization error masked interrupt status */
344 #define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS) /*!< DCMI VSYNC masked interrupt status */
345 #define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS ) /*!< DCMI Line masked interrupt status */
347 * @}
350 /** @defgroup DCMI_Byte_Select_Mode DCMI Byte Select Mode
351 * @{
353 #define DCMI_BSM_ALL (0x00000000U) /*!< Interface captures all received data */
354 #define DCMI_BSM_OTHER ((uint32_t)DCMI_CR_BSM_0) /*!< Interface captures every other byte from the received data */
355 #define DCMI_BSM_ALTERNATE_4 ((uint32_t)DCMI_CR_BSM_1) /*!< Interface captures one byte out of four */
356 #define DCMI_BSM_ALTERNATE_2 ((uint32_t)(DCMI_CR_BSM_0 | DCMI_CR_BSM_1)) /*!< Interface captures two bytes out of four */
359 * @}
362 /** @defgroup DCMI_Byte_Select_Start DCMI Byte Select Start
363 * @{
365 #define DCMI_OEBS_ODD (0x00000000U) /*!< Interface captures first data from the frame/line start, second one being dropped */
366 #define DCMI_OEBS_EVEN ((uint32_t)DCMI_CR_OEBS) /*!< Interface captures second data from the frame/line start, first one being dropped */
369 * @}
372 /** @defgroup DCMI_Line_Select_Mode DCMI Line Select Mode
373 * @{
375 #define DCMI_LSM_ALL (0x00000000U) /*!< Interface captures all received lines */
376 #define DCMI_LSM_ALTERNATE_2 ((uint32_t)DCMI_CR_LSM) /*!< Interface captures one line out of two */
379 * @}
382 /** @defgroup DCMI_Line_Select_Start DCMI Line Select Start
383 * @{
385 #define DCMI_OELS_ODD (0x00000000U) /*!< Interface captures first line from the frame start, second one being dropped */
386 #define DCMI_OELS_EVEN ((uint32_t)DCMI_CR_OELS) /*!< Interface captures second line from the frame start, first one being dropped */
389 * @}
393 * @}
396 /* Exported macro ------------------------------------------------------------*/
397 /** @defgroup DCMI_Exported_Macros DCMI Exported Macros
398 * @{
401 /** @brief Reset DCMI handle state
402 * @param __HANDLE__ specifies the DCMI handle.
403 * @retval None
405 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
406 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) do{ \
407 (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \
408 (__HANDLE__)->MspInitCallback = NULL; \
409 (__HANDLE__)->MspDeInitCallback = NULL; \
410 } while(0)
411 #else
412 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DCMI_STATE_RESET)
413 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
416 * @brief Enable the DCMI.
417 * @param __HANDLE__ DCMI handle
418 * @retval None
420 #define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE)
423 * @brief Disable the DCMI.
424 * @param __HANDLE__ DCMI handle
425 * @retval None
427 #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE))
429 /* Interrupt & Flag management */
431 * @brief Get the DCMI pending flag.
432 * @param __HANDLE__ DCMI handle
433 * @param __FLAG__ Get the specified flag.
434 * This parameter can be one of the following values (no combination allowed)
435 * @arg DCMI_FLAG_HSYNC: HSYNC pin state (active line / synchronization between lines)
436 * @arg DCMI_FLAG_VSYNC: VSYNC pin state (active frame / synchronization between frames)
437 * @arg DCMI_FLAG_FNE: FIFO empty flag
438 * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask
439 * @arg DCMI_FLAG_OVRRI: Overrun flag mask
440 * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask
441 * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask
442 * @arg DCMI_FLAG_LINERI: Line flag mask
443 * @arg DCMI_FLAG_FRAMEMI: DCMI Capture complete masked interrupt status
444 * @arg DCMI_FLAG_OVRMI: DCMI Overrun masked interrupt status
445 * @arg DCMI_FLAG_ERRMI: DCMI Synchronization error masked interrupt status
446 * @arg DCMI_FLAG_VSYNCMI: DCMI VSYNC masked interrupt status
447 * @arg DCMI_FLAG_LINEMI: DCMI Line masked interrupt status
448 * @retval The state of FLAG.
450 #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\
451 ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0)? ((__HANDLE__)->Instance->RIS & (__FLAG__)) :\
452 (((__FLAG__) & DCMI_SR_INDEX) == 0x0)? ((__HANDLE__)->Instance->MIS & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__)))
455 * @brief Clear the DCMI pending flags.
456 * @param __HANDLE__ DCMI handle
457 * @param __FLAG__ specifies the flag to clear.
458 * This parameter can be any combination of the following values:
459 * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask
460 * @arg DCMI_FLAG_OVFRI: Overflow flag mask
461 * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask
462 * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask
463 * @arg DCMI_FLAG_LINERI: Line flag mask
464 * @retval None
466 #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
469 * @brief Enable the specified DCMI interrupts.
470 * @param __HANDLE__ DCMI handle
471 * @param __INTERRUPT__ specifies the DCMI interrupt sources to be enabled.
472 * This parameter can be any combination of the following values:
473 * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask
474 * @arg DCMI_IT_OVF: Overflow interrupt mask
475 * @arg DCMI_IT_ERR: Synchronization error interrupt mask
476 * @arg DCMI_IT_VSYNC: VSYNC interrupt mask
477 * @arg DCMI_IT_LINE: Line interrupt mask
478 * @retval None
480 #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
483 * @brief Disable the specified DCMI interrupts.
484 * @param __HANDLE__ DCMI handle
485 * @param __INTERRUPT__ specifies the DCMI interrupt sources to be enabled.
486 * This parameter can be any combination of the following values:
487 * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask
488 * @arg DCMI_IT_OVF: Overflow interrupt mask
489 * @arg DCMI_IT_ERR: Synchronization error interrupt mask
490 * @arg DCMI_IT_VSYNC: VSYNC interrupt mask
491 * @arg DCMI_IT_LINE: Line interrupt mask
492 * @retval None
494 #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
497 * @brief Check whether the specified DCMI interrupt has occurred or not.
498 * @param __HANDLE__ DCMI handle
499 * @param __INTERRUPT__ specifies the DCMI interrupt source to check.
500 * This parameter can be one of the following values:
501 * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask
502 * @arg DCMI_IT_OVF: Overflow interrupt mask
503 * @arg DCMI_IT_ERR: Synchronization error interrupt mask
504 * @arg DCMI_IT_VSYNC: VSYNC interrupt mask
505 * @arg DCMI_IT_LINE: Line interrupt mask
506 * @retval The state of INTERRUPT.
508 #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__))
511 * @}
514 /* Exported functions --------------------------------------------------------*/
515 /** @addtogroup DCMI_Exported_Functions DCMI Exported Functions
516 * @{
519 /** @addtogroup DCMI_Exported_Functions_Group1 Initialization and Configuration functions
520 * @{
522 /* Initialization and de-initialization functions *****************************/
523 HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi);
524 HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi);
525 void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi);
526 void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi);
528 /* Callbacks Register/UnRegister functions ***********************************/
529 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
530 HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback);
531 HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID);
532 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
535 * @}
538 /** @addtogroup DCMI_Exported_Functions_Group2 IO operation functions
539 * @{
541 /* IO operation functions *****************************************************/
542 HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length);
543 HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef* hdcmi);
544 HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef* hdcmi);
545 HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef* hdcmi);
546 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi);
547 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi);
548 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi);
549 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi);
550 void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi);
552 * @}
555 /** @addtogroup DCMI_Exported_Functions_Group3 Peripheral Control functions
556 * @{
558 /* Peripheral Control functions ***********************************************/
559 HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize);
560 HAL_StatusTypeDef HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi);
561 HAL_StatusTypeDef HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi);
562 HAL_StatusTypeDef HAL_DCMI_ConfigSyncUnmask(DCMI_HandleTypeDef *hdcmi, DCMI_SyncUnmaskTypeDef *SyncUnmask);
565 * @}
568 /** @addtogroup DCMI_Exported_Functions_Group4 Peripheral State functions
569 * @{
571 /* Peripheral State functions *************************************************/
572 HAL_DCMI_StateTypeDef HAL_DCMI_GetState(const DCMI_HandleTypeDef *hdcmi);
573 uint32_t HAL_DCMI_GetError(const DCMI_HandleTypeDef *hdcmi);
575 * @}
579 * @}
582 /* Private types -------------------------------------------------------------*/
583 /* Private defines -----------------------------------------------------------*/
584 /** @defgroup DCMI_Private_Defines DCMI Private Defines
585 * @{
588 * @}
590 /* Private variables ---------------------------------------------------------*/
591 /* Private constants ---------------------------------------------------------*/
592 /** @defgroup DCMI_Private_Constants DCMI Private Constants
593 * @{
595 #define DCMI_MIS_INDEX ((uint32_t)0x1000) /*!< DCMI MIS register index */
596 #define DCMI_SR_INDEX ((uint32_t)0x2000) /*!< DCMI SR register index */
598 * @}
600 /* Private macro -------------------------------------------------------------*/
601 /** @defgroup DCMI_Private_Macros DCMI Private Macros
602 * @{
604 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \
605 ((MODE) == DCMI_MODE_SNAPSHOT))
607 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \
608 ((MODE) == DCMI_SYNCHRO_EMBEDDED))
610 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \
611 ((POLARITY) == DCMI_PCKPOLARITY_RISING))
613 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \
614 ((POLARITY) == DCMI_VSPOLARITY_HIGH))
616 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \
617 ((POLARITY) == DCMI_HSPOLARITY_HIGH))
619 #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \
620 ((JPEG_MODE) == DCMI_JPEG_ENABLE))
622 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \
623 ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \
624 ((RATE) == DCMI_CR_ALTERNATE_4_FRAME))
626 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \
627 ((DATA) == DCMI_EXTEND_DATA_10B) || \
628 ((DATA) == DCMI_EXTEND_DATA_12B) || \
629 ((DATA) == DCMI_EXTEND_DATA_14B))
631 #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE)
633 #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT)
635 #define IS_DCMI_BYTE_SELECT_MODE(MODE)(((MODE) == DCMI_BSM_ALL) || \
636 ((MODE) == DCMI_BSM_OTHER) || \
637 ((MODE) == DCMI_BSM_ALTERNATE_4) || \
638 ((MODE) == DCMI_BSM_ALTERNATE_2))
640 #define IS_DCMI_BYTE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OEBS_ODD) || \
641 ((POLARITY) == DCMI_OEBS_EVEN))
643 #define IS_DCMI_LINE_SELECT_MODE(MODE)(((MODE) == DCMI_LSM_ALL) || \
644 ((MODE) == DCMI_LSM_ALTERNATE_2))
646 #define IS_DCMI_LINE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OELS_ODD) || \
647 ((POLARITY) == DCMI_OELS_EVEN))
650 * @}
653 /* Private functions ---------------------------------------------------------*/
654 /** @addtogroup DCMI_Private_Functions DCMI Private Functions
655 * @{
659 * @}
663 * @}
666 * @}
669 #endif /* DCMI */
671 #ifdef __cplusplus
673 #endif
675 #endif /* STM32H7xx_HAL_DCMI_H */