21 #ifndef STM32H7xx_HAL_DCMI_H
22 #define STM32H7xx_HAL_DCMI_H
50 HAL_DCMI_STATE_RESET = 0x00U,
51 HAL_DCMI_STATE_READY = 0x01U,
52 HAL_DCMI_STATE_BUSY = 0x02U,
53 HAL_DCMI_STATE_TIMEOUT = 0x03U,
54 HAL_DCMI_STATE_ERROR = 0x04U,
55 HAL_DCMI_STATE_SUSPENDED = 0x05U
56 } HAL_DCMI_StateTypeDef;
63 uint8_t FrameStartCode;
64 uint8_t LineStartCode;
67 } DCMI_CodesInitTypeDef;
74 uint8_t FrameStartUnmask;
75 uint8_t LineStartUnmask;
76 uint8_t LineEndUnmask;
77 uint8_t FrameEndUnmask;
78 } DCMI_SyncUnmaskTypeDef;
99 uint32_t ExtendedDataMode;
102 DCMI_CodesInitTypeDef SyncroCode;
108 uint32_t ByteSelectMode;
111 uint32_t ByteSelectStart;
114 uint32_t LineSelectMode;
117 uint32_t LineSelectStart;
124 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
125 typedef struct __DCMI_HandleTypeDef
132 DCMI_InitTypeDef
Init;
136 __IO HAL_DCMI_StateTypeDef State;
138 __IO uint32_t XferCount;
140 __IO uint32_t XferSize;
142 uint32_t XferTransferNumber;
148 __IO uint32_t ErrorCode;
150 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
151 void (* FrameEventCallback)(
struct __DCMI_HandleTypeDef *hdcmi);
152 void (* VsyncEventCallback)(
struct __DCMI_HandleTypeDef *hdcmi);
153 void (* LineEventCallback)(
struct __DCMI_HandleTypeDef *hdcmi);
154 void (* ErrorCallback)(
struct __DCMI_HandleTypeDef *hdcmi);
155 void (* MspInitCallback)(
struct __DCMI_HandleTypeDef *hdcmi);
156 void (* MspDeInitCallback)(
struct __DCMI_HandleTypeDef *hdcmi);
158 } DCMI_HandleTypeDef;
160 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
166 HAL_DCMI_FRAME_EVENT_CB_ID = 0x00U,
167 HAL_DCMI_VSYNC_EVENT_CB_ID = 0x01U,
168 HAL_DCMI_LINE_EVENT_CB_ID = 0x02U,
169 HAL_DCMI_ERROR_CB_ID = 0x03U,
170 HAL_DCMI_MSPINIT_CB_ID = 0x04U,
171 HAL_DCMI_MSPDEINIT_CB_ID = 0x05U
173 } HAL_DCMI_CallbackIDTypeDef;
178 typedef void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef * hdcmi);
193 #define HAL_DCMI_ERROR_NONE (0x00000000U)
194 #define HAL_DCMI_ERROR_OVR (0x00000001U)
195 #define HAL_DCMI_ERROR_SYNC (0x00000002U)
196 #define HAL_DCMI_ERROR_TIMEOUT (0x00000020U)
197 #define HAL_DCMI_ERROR_DMA (0x00000040U)
198 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
199 #define HAL_DCMI_ERROR_INVALID_CALLBACK (0x00000080U)
208 #define DCMI_MODE_CONTINUOUS (0x00000000U)
210 #define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM)
219 #define DCMI_SYNCHRO_HARDWARE (0x00000000U)
221 #define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS)
231 #define DCMI_PCKPOLARITY_FALLING (0x00000000U)
232 #define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL)
241 #define DCMI_VSPOLARITY_LOW (0x00000000U)
242 #define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL)
251 #define DCMI_HSPOLARITY_LOW (0x00000000U)
252 #define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL)
261 #define DCMI_JPEG_DISABLE (0x00000000U)
262 #define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG)
271 #define DCMI_CR_ALL_FRAME (0x00000000U)
272 #define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0)
273 #define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1)
282 #define DCMI_EXTEND_DATA_8B (0x00000000U)
283 #define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0)
284 #define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1)
285 #define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1))
294 #define DCMI_WINDOW_COORDINATE (0x3FFFU)
303 #define DCMI_WINDOW_HEIGHT (0x1FFFU)
312 #define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE)
313 #define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE)
314 #define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE)
315 #define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE)
316 #define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE)
328 #define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC)
329 #define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC)
330 #define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE)
334 #define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RIS_FRAME_RIS)
335 #define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RIS_OVR_RIS)
336 #define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RIS_ERR_RIS)
337 #define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RIS_VSYNC_RIS)
338 #define DCMI_FLAG_LINERI ((uint32_t)DCMI_RIS_LINE_RIS)
342 #define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS)
343 #define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS )
344 #define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS )
345 #define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS)
346 #define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS )
354 #define DCMI_BSM_ALL (0x00000000U)
355 #define DCMI_BSM_OTHER ((uint32_t)DCMI_CR_BSM_0)
356 #define DCMI_BSM_ALTERNATE_4 ((uint32_t)DCMI_CR_BSM_1)
357 #define DCMI_BSM_ALTERNATE_2 ((uint32_t)(DCMI_CR_BSM_0 | DCMI_CR_BSM_1))
366 #define DCMI_OEBS_ODD (0x00000000U)
367 #define DCMI_OEBS_EVEN ((uint32_t)DCMI_CR_OEBS)
376 #define DCMI_LSM_ALL (0x00000000U)
377 #define DCMI_LSM_ALTERNATE_2 ((uint32_t)DCMI_CR_LSM)
386 #define DCMI_OELS_ODD (0x00000000U)
387 #define DCMI_OELS_EVEN ((uint32_t)DCMI_CR_OELS)
406 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
407 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) do{ \
408 (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \
409 (__HANDLE__)->MspInitCallback = NULL; \
410 (__HANDLE__)->MspDeInitCallback = NULL; \
413 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DCMI_STATE_RESET)
421 #define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE)
428 #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE))
451 #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\
452 ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0)? ((__HANDLE__)->Instance->RIS & (__FLAG__)) :\
453 (((__FLAG__) & DCMI_SR_INDEX) == 0x0)? ((__HANDLE__)->Instance->MIS & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__)))
467 #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
481 #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
495 #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
509 #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__))
526 void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi);
527 void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi);
530 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
531 HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback);
532 HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID);
543 HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length);
547 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi);
548 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi);
549 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi);
550 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi);
551 void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi);
560 HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize);
563 HAL_StatusTypeDef HAL_DCMI_ConfigSyncUnmask(DCMI_HandleTypeDef *hdcmi, DCMI_SyncUnmaskTypeDef *SyncUnmask);
573 HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi);
574 uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi);
589 #define DCMI_MIS_INDEX ((uint32_t)0x1000)
590 #define DCMI_SR_INDEX ((uint32_t)0x2000)
598 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \
599 ((MODE) == DCMI_MODE_SNAPSHOT))
601 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \
602 ((MODE) == DCMI_SYNCHRO_EMBEDDED))
604 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \
605 ((POLARITY) == DCMI_PCKPOLARITY_RISING))
607 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \
608 ((POLARITY) == DCMI_VSPOLARITY_HIGH))
610 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \
611 ((POLARITY) == DCMI_HSPOLARITY_HIGH))
613 #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \
614 ((JPEG_MODE) == DCMI_JPEG_ENABLE))
616 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \
617 ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \
618 ((RATE) == DCMI_CR_ALTERNATE_4_FRAME))
620 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \
621 ((DATA) == DCMI_EXTEND_DATA_10B) || \
622 ((DATA) == DCMI_EXTEND_DATA_12B) || \
623 ((DATA) == DCMI_EXTEND_DATA_14B))
625 #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE)
627 #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT)
629 #define IS_DCMI_BYTE_SELECT_MODE(MODE)(((MODE) == DCMI_BSM_ALL) || \
630 ((MODE) == DCMI_BSM_OTHER) || \
631 ((MODE) == DCMI_BSM_ALTERNATE_4) || \
632 ((MODE) == DCMI_BSM_ALTERNATE_2))
634 #define IS_DCMI_BYTE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OEBS_ODD) || \
635 ((POLARITY) == DCMI_OEBS_EVEN))
637 #define IS_DCMI_LINE_SELECT_MODE(MODE)(((MODE) == DCMI_LSM_ALL) || \
638 ((MODE) == DCMI_LSM_ALTERNATE_2))
640 #define IS_DCMI_LINE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OELS_ODD) || \
641 ((POLARITY) == DCMI_OELS_EVEN))