![]() |
|
|||
File indexing completed on 2025-05-11 08:23:35
0001 /** 0002 ****************************************************************************** 0003 * @file stm32h7xx_hal_dcmi.h 0004 * @author MCD Application Team 0005 * @brief Header file of DCMI HAL module. 0006 ****************************************************************************** 0007 * @attention 0008 * 0009 * Copyright (c) 2017 STMicroelectronics. 0010 * All rights reserved. 0011 * 0012 * This software is licensed under terms that can be found in the LICENSE file 0013 * in the root directory of this software component. 0014 * If no LICENSE file comes with this software, it is provided AS-IS. 0015 * 0016 ****************************************************************************** 0017 */ 0018 0019 /* Define to prevent recursive inclusion -------------------------------------*/ 0020 #ifndef STM32H7xx_HAL_DCMI_H 0021 #define STM32H7xx_HAL_DCMI_H 0022 0023 #ifdef __cplusplus 0024 extern "C" { 0025 #endif 0026 0027 /* Includes ------------------------------------------------------------------*/ 0028 #include "stm32h7xx_hal_def.h" 0029 0030 #if defined (DCMI) 0031 /** @addtogroup STM32H7xx_HAL_Driver 0032 * @{ 0033 */ 0034 0035 /** @addtogroup DCMI DCMI 0036 * @brief DCMI HAL module driver 0037 * @{ 0038 */ 0039 0040 /* Exported types ------------------------------------------------------------*/ 0041 /** @defgroup DCMI_Exported_Types DCMI Exported Types 0042 * @ingroup RTEMSBSPsARMSTM32H7 0043 * @{ 0044 */ 0045 /** 0046 * @brief HAL DCMI State structures definition 0047 */ 0048 typedef enum 0049 { 0050 HAL_DCMI_STATE_RESET = 0x00U, /*!< DCMI not yet initialized or disabled */ 0051 HAL_DCMI_STATE_READY = 0x01U, /*!< DCMI initialized and ready for use */ 0052 HAL_DCMI_STATE_BUSY = 0x02U, /*!< DCMI internal processing is ongoing */ 0053 HAL_DCMI_STATE_TIMEOUT = 0x03U, /*!< DCMI timeout state */ 0054 HAL_DCMI_STATE_ERROR = 0x04U, /*!< DCMI error state */ 0055 HAL_DCMI_STATE_SUSPENDED = 0x05U /*!< DCMI suspend state */ 0056 } HAL_DCMI_StateTypeDef; 0057 0058 /** 0059 * @brief DCMI Embedded Synchronisation CODE Init structure definition 0060 */ 0061 typedef struct 0062 { 0063 uint8_t FrameStartCode; /*!< Specifies the code of the frame start delimiter. */ 0064 uint8_t LineStartCode; /*!< Specifies the code of the line start delimiter. */ 0065 uint8_t LineEndCode; /*!< Specifies the code of the line end delimiter. */ 0066 uint8_t FrameEndCode; /*!< Specifies the code of the frame end delimiter. */ 0067 } DCMI_CodesInitTypeDef; 0068 0069 /** 0070 * @brief DCMI Embedded Synchronisation UNMASK Init structure definition 0071 */ 0072 typedef struct 0073 { 0074 uint8_t FrameStartUnmask; /*!< Specifies the frame start delimiter unmask. */ 0075 uint8_t LineStartUnmask; /*!< Specifies the line start delimiter unmask. */ 0076 uint8_t LineEndUnmask; /*!< Specifies the line end delimiter unmask. */ 0077 uint8_t FrameEndUnmask; /*!< Specifies the frame end delimiter unmask. */ 0078 } DCMI_SyncUnmaskTypeDef; 0079 /** 0080 * @brief DCMI Init structure definition 0081 */ 0082 typedef struct 0083 { 0084 uint32_t SynchroMode; /*!< Specifies the Synchronization Mode: Hardware or Embedded. 0085 This parameter can be a value of @ref DCMI_Synchronization_Mode */ 0086 0087 uint32_t PCKPolarity; /*!< Specifies the Pixel clock polarity: Falling or Rising. 0088 This parameter can be a value of @ref DCMI_PIXCK_Polarity */ 0089 0090 uint32_t VSPolarity; /*!< Specifies the Vertical synchronization polarity: High or Low. 0091 This parameter can be a value of @ref DCMI_VSYNC_Polarity */ 0092 0093 uint32_t HSPolarity; /*!< Specifies the Horizontal synchronization polarity: High or Low. 0094 This parameter can be a value of @ref DCMI_HSYNC_Polarity */ 0095 0096 uint32_t CaptureRate; /*!< Specifies the frequency of frame capture: All, 1/2 or 1/4. 0097 This parameter can be a value of @ref DCMI_Capture_Rate */ 0098 0099 uint32_t ExtendedDataMode; /*!< Specifies the data width: 8-bit, 10-bit, 12-bit or 14-bit. 0100 This parameter can be a value of @ref DCMI_Extended_Data_Mode */ 0101 0102 DCMI_CodesInitTypeDef SyncroCode; /*!< Specifies the code of the line/frame start delimiter and the 0103 line/frame end delimiter */ 0104 0105 uint32_t JPEGMode; /*!< Enable or Disable the JPEG mode. 0106 This parameter can be a value of @ref DCMI_MODE_JPEG */ 0107 0108 uint32_t ByteSelectMode; /*!< Specifies the data to be captured by the interface 0109 This parameter can be a value of @ref DCMI_Byte_Select_Mode */ 0110 0111 uint32_t ByteSelectStart; /*!< Specifies if the data to be captured by the interface is even or odd 0112 This parameter can be a value of @ref DCMI_Byte_Select_Start */ 0113 0114 uint32_t LineSelectMode; /*!< Specifies the line of data to be captured by the interface 0115 This parameter can be a value of @ref DCMI_Line_Select_Mode */ 0116 0117 uint32_t LineSelectStart; /*!< Specifies if the line of data to be captured by the interface is even or odd 0118 This parameter can be a value of @ref DCMI_Line_Select_Start */ 0119 } DCMI_InitTypeDef; 0120 0121 /** 0122 * @brief DCMI handle Structure definition 0123 */ 0124 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 0125 typedef struct __DCMI_HandleTypeDef 0126 #else 0127 typedef struct 0128 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ 0129 { 0130 DCMI_TypeDef *Instance; /*!< DCMI Register base address */ 0131 0132 DCMI_InitTypeDef Init; /*!< DCMI parameters */ 0133 0134 HAL_LockTypeDef Lock; /*!< DCMI locking object */ 0135 0136 __IO HAL_DCMI_StateTypeDef State; /*!< DCMI state */ 0137 0138 __IO uint32_t XferCount; /*!< DMA transfer counter */ 0139 0140 __IO uint32_t XferSize; /*!< DMA transfer size */ 0141 0142 uint32_t XferTransferNumber; /*!< DMA transfer number */ 0143 0144 uint32_t pBuffPtr; /*!< Pointer to DMA output buffer */ 0145 0146 DMA_HandleTypeDef *DMA_Handle; /*!< Pointer to the DMA handler */ 0147 0148 __IO uint32_t ErrorCode; /*!< DCMI Error code */ 0149 0150 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 0151 void (* FrameEventCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Frame Event Callback */ 0152 void (* VsyncEventCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Vsync Event Callback */ 0153 void (* LineEventCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Line Event Callback */ 0154 void (* ErrorCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Error Callback */ 0155 void (* MspInitCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Msp Init callback */ 0156 void (* MspDeInitCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Msp DeInit callback */ 0157 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ 0158 } DCMI_HandleTypeDef; 0159 0160 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 0161 /** 0162 * @brief HAL DCMI Callback ID enumeration definition 0163 */ 0164 typedef enum 0165 { 0166 HAL_DCMI_FRAME_EVENT_CB_ID = 0x00U, /*!< DCMI Frame Event Callback ID */ 0167 HAL_DCMI_VSYNC_EVENT_CB_ID = 0x01U, /*!< DCMI Vsync Event Callback ID */ 0168 HAL_DCMI_LINE_EVENT_CB_ID = 0x02U, /*!< DCMI Line Event Callback ID */ 0169 HAL_DCMI_ERROR_CB_ID = 0x03U, /*!< DCMI Error Callback ID */ 0170 HAL_DCMI_MSPINIT_CB_ID = 0x04U, /*!< DCMI MspInit callback ID */ 0171 HAL_DCMI_MSPDEINIT_CB_ID = 0x05U /*!< DCMI MspDeInit callback ID */ 0172 0173 } HAL_DCMI_CallbackIDTypeDef; 0174 0175 /** 0176 * @brief HAL DCMI Callback pointer definition 0177 */ 0178 typedef void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef * hdcmi); /*!< pointer to a DCMI callback function */ 0179 0180 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ 0181 /** 0182 * @} 0183 */ 0184 /* Exported constants --------------------------------------------------------*/ 0185 0186 /** @defgroup DCMI_Exported_Constants DCMI Exported Constants 0187 * @ingroup RTEMSBSPsARMSTM32H7 0188 * @{ 0189 */ 0190 0191 /** @defgroup DCMI_Error_Code DCMI Error Code 0192 * @ingroup RTEMSBSPsARMSTM32H7 0193 * @{ 0194 */ 0195 #define HAL_DCMI_ERROR_NONE (0x00000000U) /*!< No error */ 0196 #define HAL_DCMI_ERROR_OVR (0x00000001U) /*!< Overrun error */ 0197 #define HAL_DCMI_ERROR_SYNC (0x00000002U) /*!< Synchronization error */ 0198 #define HAL_DCMI_ERROR_TIMEOUT (0x00000020U) /*!< Timeout error */ 0199 #define HAL_DCMI_ERROR_DMA (0x00000040U) /*!< DMA error */ 0200 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 0201 #define HAL_DCMI_ERROR_INVALID_CALLBACK (0x00000080U) /*!< Invalid Callback error */ 0202 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ 0203 /** 0204 * @} 0205 */ 0206 0207 /** @defgroup DCMI_Capture_Mode DCMI Capture Mode 0208 * @ingroup RTEMSBSPsARMSTM32H7 0209 * @{ 0210 */ 0211 #define DCMI_MODE_CONTINUOUS (0x00000000U) /*!< The received data are transferred continuously 0212 into the destination memory through the DMA */ 0213 #define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM) /*!< Once activated, the interface waits for the start of 0214 frame and then transfers a single frame through the DMA */ 0215 /** 0216 * @} 0217 */ 0218 0219 /** @defgroup DCMI_Synchronization_Mode DCMI Synchronization Mode 0220 * @ingroup RTEMSBSPsARMSTM32H7 0221 * @{ 0222 */ 0223 #define DCMI_SYNCHRO_HARDWARE (0x00000000U) /*!< Hardware synchronization data capture (frame/line start/stop) 0224 is synchronized with the HSYNC/VSYNC signals */ 0225 #define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS) /*!< Embedded synchronization data capture is synchronized with 0226 synchronization codes embedded in the data flow */ 0227 0228 /** 0229 * @} 0230 */ 0231 0232 /** @defgroup DCMI_PIXCK_Polarity DCMI PIXCK Polarity 0233 * @ingroup RTEMSBSPsARMSTM32H7 0234 * @{ 0235 */ 0236 #define DCMI_PCKPOLARITY_FALLING (0x00000000U) /*!< Pixel clock active on Falling edge */ 0237 #define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL) /*!< Pixel clock active on Rising edge */ 0238 0239 /** 0240 * @} 0241 */ 0242 0243 /** @defgroup DCMI_VSYNC_Polarity DCMI VSYNC Polarity 0244 * @ingroup RTEMSBSPsARMSTM32H7 0245 * @{ 0246 */ 0247 #define DCMI_VSPOLARITY_LOW (0x00000000U) /*!< Vertical synchronization active Low */ 0248 #define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL) /*!< Vertical synchronization active High */ 0249 0250 /** 0251 * @} 0252 */ 0253 0254 /** @defgroup DCMI_HSYNC_Polarity DCMI HSYNC Polarity 0255 * @ingroup RTEMSBSPsARMSTM32H7 0256 * @{ 0257 */ 0258 #define DCMI_HSPOLARITY_LOW (0x00000000U) /*!< Horizontal synchronization active Low */ 0259 #define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL) /*!< Horizontal synchronization active High */ 0260 0261 /** 0262 * @} 0263 */ 0264 0265 /** @defgroup DCMI_MODE_JPEG DCMI MODE JPEG 0266 * @ingroup RTEMSBSPsARMSTM32H7 0267 * @{ 0268 */ 0269 #define DCMI_JPEG_DISABLE (0x00000000U) /*!< Mode JPEG Disabled */ 0270 #define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG) /*!< Mode JPEG Enabled */ 0271 0272 /** 0273 * @} 0274 */ 0275 0276 /** @defgroup DCMI_Capture_Rate DCMI Capture Rate 0277 * @ingroup RTEMSBSPsARMSTM32H7 0278 * @{ 0279 */ 0280 #define DCMI_CR_ALL_FRAME (0x00000000U) /*!< All frames are captured */ 0281 #define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0) /*!< Every alternate frame captured */ 0282 #define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1) /*!< One frame in 4 frames captured */ 0283 0284 /** 0285 * @} 0286 */ 0287 0288 /** @defgroup DCMI_Extended_Data_Mode DCMI Extended Data Mode 0289 * @ingroup RTEMSBSPsARMSTM32H7 0290 * @{ 0291 */ 0292 #define DCMI_EXTEND_DATA_8B (0x00000000U) /*!< Interface captures 8-bit data on every pixel clock */ 0293 #define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0) /*!< Interface captures 10-bit data on every pixel clock */ 0294 #define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1) /*!< Interface captures 12-bit data on every pixel clock */ 0295 #define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1)) /*!< Interface captures 14-bit data on every pixel clock */ 0296 0297 /** 0298 * @} 0299 */ 0300 0301 /** @defgroup DCMI_Window_Coordinate DCMI Window Coordinate 0302 * @ingroup RTEMSBSPsARMSTM32H7 0303 * @{ 0304 */ 0305 #define DCMI_WINDOW_COORDINATE (0x3FFFU) /*!< Window coordinate */ 0306 0307 /** 0308 * @} 0309 */ 0310 0311 /** @defgroup DCMI_Window_Height DCMI Window Height 0312 * @ingroup RTEMSBSPsARMSTM32H7 0313 * @{ 0314 */ 0315 #define DCMI_WINDOW_HEIGHT (0x1FFFU) /*!< Window Height */ 0316 0317 /** 0318 * @} 0319 */ 0320 0321 /** @defgroup DCMI_interrupt_sources DCMI interrupt sources 0322 * @ingroup RTEMSBSPsARMSTM32H7 0323 * @{ 0324 */ 0325 #define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE) /*!< Capture complete interrupt */ 0326 #define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE) /*!< Overrun interrupt */ 0327 #define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE) /*!< Synchronization error interrupt */ 0328 #define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE) /*!< VSYNC interrupt */ 0329 #define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE) /*!< Line interrupt */ 0330 /** 0331 * @} 0332 */ 0333 0334 /** @defgroup DCMI_Flags DCMI Flags 0335 * @ingroup RTEMSBSPsARMSTM32H7 0336 * @{ 0337 */ 0338 0339 /** 0340 * @brief DCMI SR register 0341 */ 0342 #define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC) /*!< HSYNC pin state (active line / synchronization between lines) */ 0343 #define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC) /*!< VSYNC pin state (active frame / synchronization between frames) */ 0344 #define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE) /*!< FIFO not empty flag */ 0345 /** 0346 * @brief DCMI RIS register 0347 */ 0348 #define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RIS_FRAME_RIS) /*!< Frame capture complete interrupt flag */ 0349 #define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RIS_OVR_RIS) /*!< Overrun interrupt flag */ 0350 #define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RIS_ERR_RIS) /*!< Synchronization error interrupt flag */ 0351 #define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RIS_VSYNC_RIS) /*!< VSYNC interrupt flag */ 0352 #define DCMI_FLAG_LINERI ((uint32_t)DCMI_RIS_LINE_RIS) /*!< Line interrupt flag */ 0353 /** 0354 * @brief DCMI MIS register 0355 */ 0356 #define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS) /*!< DCMI Frame capture complete masked interrupt status */ 0357 #define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS ) /*!< DCMI Overrun masked interrupt status */ 0358 #define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS ) /*!< DCMI Synchronization error masked interrupt status */ 0359 #define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS) /*!< DCMI VSYNC masked interrupt status */ 0360 #define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS ) /*!< DCMI Line masked interrupt status */ 0361 /** 0362 * @} 0363 */ 0364 0365 /** @defgroup DCMI_Byte_Select_Mode DCMI Byte Select Mode 0366 * @ingroup RTEMSBSPsARMSTM32H7 0367 * @{ 0368 */ 0369 #define DCMI_BSM_ALL (0x00000000U) /*!< Interface captures all received data */ 0370 #define DCMI_BSM_OTHER ((uint32_t)DCMI_CR_BSM_0) /*!< Interface captures every other byte from the received data */ 0371 #define DCMI_BSM_ALTERNATE_4 ((uint32_t)DCMI_CR_BSM_1) /*!< Interface captures one byte out of four */ 0372 #define DCMI_BSM_ALTERNATE_2 ((uint32_t)(DCMI_CR_BSM_0 | DCMI_CR_BSM_1)) /*!< Interface captures two bytes out of four */ 0373 0374 /** 0375 * @} 0376 */ 0377 0378 /** @defgroup DCMI_Byte_Select_Start DCMI Byte Select Start 0379 * @ingroup RTEMSBSPsARMSTM32H7 0380 * @{ 0381 */ 0382 #define DCMI_OEBS_ODD (0x00000000U) /*!< Interface captures first data from the frame/line start, second one being dropped */ 0383 #define DCMI_OEBS_EVEN ((uint32_t)DCMI_CR_OEBS) /*!< Interface captures second data from the frame/line start, first one being dropped */ 0384 0385 /** 0386 * @} 0387 */ 0388 0389 /** @defgroup DCMI_Line_Select_Mode DCMI Line Select Mode 0390 * @ingroup RTEMSBSPsARMSTM32H7 0391 * @{ 0392 */ 0393 #define DCMI_LSM_ALL (0x00000000U) /*!< Interface captures all received lines */ 0394 #define DCMI_LSM_ALTERNATE_2 ((uint32_t)DCMI_CR_LSM) /*!< Interface captures one line out of two */ 0395 0396 /** 0397 * @} 0398 */ 0399 0400 /** @defgroup DCMI_Line_Select_Start DCMI Line Select Start 0401 * @ingroup RTEMSBSPsARMSTM32H7 0402 * @{ 0403 */ 0404 #define DCMI_OELS_ODD (0x00000000U) /*!< Interface captures first line from the frame start, second one being dropped */ 0405 #define DCMI_OELS_EVEN ((uint32_t)DCMI_CR_OELS) /*!< Interface captures second line from the frame start, first one being dropped */ 0406 0407 /** 0408 * @} 0409 */ 0410 0411 /** 0412 * @} 0413 */ 0414 0415 /* Exported macro ------------------------------------------------------------*/ 0416 /** @defgroup DCMI_Exported_Macros DCMI Exported Macros 0417 * @ingroup RTEMSBSPsARMSTM32H7 0418 * @{ 0419 */ 0420 0421 /** @brief Reset DCMI handle state 0422 * @param __HANDLE__ specifies the DCMI handle. 0423 * @retval None 0424 */ 0425 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 0426 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) do{ \ 0427 (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \ 0428 (__HANDLE__)->MspInitCallback = NULL; \ 0429 (__HANDLE__)->MspDeInitCallback = NULL; \ 0430 } while(0) 0431 #else 0432 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DCMI_STATE_RESET) 0433 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ 0434 0435 /** 0436 * @brief Enable the DCMI. 0437 * @param __HANDLE__ DCMI handle 0438 * @retval None 0439 */ 0440 #define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE) 0441 0442 /** 0443 * @brief Disable the DCMI. 0444 * @param __HANDLE__ DCMI handle 0445 * @retval None 0446 */ 0447 #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE)) 0448 0449 /* Interrupt & Flag management */ 0450 /** 0451 * @brief Get the DCMI pending flag. 0452 * @param __HANDLE__ DCMI handle 0453 * @param __FLAG__ Get the specified flag. 0454 * This parameter can be one of the following values (no combination allowed) 0455 * @arg DCMI_FLAG_HSYNC: HSYNC pin state (active line / synchronization between lines) 0456 * @arg DCMI_FLAG_VSYNC: VSYNC pin state (active frame / synchronization between frames) 0457 * @arg DCMI_FLAG_FNE: FIFO empty flag 0458 * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask 0459 * @arg DCMI_FLAG_OVRRI: Overrun flag mask 0460 * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask 0461 * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask 0462 * @arg DCMI_FLAG_LINERI: Line flag mask 0463 * @arg DCMI_FLAG_FRAMEMI: DCMI Capture complete masked interrupt status 0464 * @arg DCMI_FLAG_OVRMI: DCMI Overrun masked interrupt status 0465 * @arg DCMI_FLAG_ERRMI: DCMI Synchronization error masked interrupt status 0466 * @arg DCMI_FLAG_VSYNCMI: DCMI VSYNC masked interrupt status 0467 * @arg DCMI_FLAG_LINEMI: DCMI Line masked interrupt status 0468 * @retval The state of FLAG. 0469 */ 0470 #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\ 0471 ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0)? ((__HANDLE__)->Instance->RIS & (__FLAG__)) :\ 0472 (((__FLAG__) & DCMI_SR_INDEX) == 0x0)? ((__HANDLE__)->Instance->MIS & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__))) 0473 0474 /** 0475 * @brief Clear the DCMI pending flags. 0476 * @param __HANDLE__ DCMI handle 0477 * @param __FLAG__ specifies the flag to clear. 0478 * This parameter can be any combination of the following values: 0479 * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask 0480 * @arg DCMI_FLAG_OVFRI: Overflow flag mask 0481 * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask 0482 * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask 0483 * @arg DCMI_FLAG_LINERI: Line flag mask 0484 * @retval None 0485 */ 0486 #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) 0487 0488 /** 0489 * @brief Enable the specified DCMI interrupts. 0490 * @param __HANDLE__ DCMI handle 0491 * @param __INTERRUPT__ specifies the DCMI interrupt sources to be enabled. 0492 * This parameter can be any combination of the following values: 0493 * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask 0494 * @arg DCMI_IT_OVF: Overflow interrupt mask 0495 * @arg DCMI_IT_ERR: Synchronization error interrupt mask 0496 * @arg DCMI_IT_VSYNC: VSYNC interrupt mask 0497 * @arg DCMI_IT_LINE: Line interrupt mask 0498 * @retval None 0499 */ 0500 #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) 0501 0502 /** 0503 * @brief Disable the specified DCMI interrupts. 0504 * @param __HANDLE__ DCMI handle 0505 * @param __INTERRUPT__ specifies the DCMI interrupt sources to be enabled. 0506 * This parameter can be any combination of the following values: 0507 * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask 0508 * @arg DCMI_IT_OVF: Overflow interrupt mask 0509 * @arg DCMI_IT_ERR: Synchronization error interrupt mask 0510 * @arg DCMI_IT_VSYNC: VSYNC interrupt mask 0511 * @arg DCMI_IT_LINE: Line interrupt mask 0512 * @retval None 0513 */ 0514 #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__)) 0515 0516 /** 0517 * @brief Check whether the specified DCMI interrupt has occurred or not. 0518 * @param __HANDLE__ DCMI handle 0519 * @param __INTERRUPT__ specifies the DCMI interrupt source to check. 0520 * This parameter can be one of the following values: 0521 * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask 0522 * @arg DCMI_IT_OVF: Overflow interrupt mask 0523 * @arg DCMI_IT_ERR: Synchronization error interrupt mask 0524 * @arg DCMI_IT_VSYNC: VSYNC interrupt mask 0525 * @arg DCMI_IT_LINE: Line interrupt mask 0526 * @retval The state of INTERRUPT. 0527 */ 0528 #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__)) 0529 0530 /** 0531 * @} 0532 */ 0533 0534 /* Exported functions --------------------------------------------------------*/ 0535 /** @addtogroup DCMI_Exported_Functions DCMI Exported Functions 0536 * @{ 0537 */ 0538 0539 /** @addtogroup DCMI_Exported_Functions_Group1 Initialization and Configuration functions 0540 * @{ 0541 */ 0542 /* Initialization and de-initialization functions *****************************/ 0543 HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi); 0544 HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi); 0545 void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi); 0546 void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi); 0547 0548 /* Callbacks Register/UnRegister functions ***********************************/ 0549 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 0550 HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback); 0551 HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID); 0552 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ 0553 0554 /** 0555 * @} 0556 */ 0557 0558 /** @addtogroup DCMI_Exported_Functions_Group2 IO operation functions 0559 * @{ 0560 */ 0561 /* IO operation functions *****************************************************/ 0562 HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length); 0563 HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef* hdcmi); 0564 HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef* hdcmi); 0565 HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef* hdcmi); 0566 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi); 0567 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi); 0568 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi); 0569 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi); 0570 void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi); 0571 /** 0572 * @} 0573 */ 0574 0575 /** @addtogroup DCMI_Exported_Functions_Group3 Peripheral Control functions 0576 * @{ 0577 */ 0578 /* Peripheral Control functions ***********************************************/ 0579 HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize); 0580 HAL_StatusTypeDef HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi); 0581 HAL_StatusTypeDef HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi); 0582 HAL_StatusTypeDef HAL_DCMI_ConfigSyncUnmask(DCMI_HandleTypeDef *hdcmi, DCMI_SyncUnmaskTypeDef *SyncUnmask); 0583 0584 /** 0585 * @} 0586 */ 0587 0588 /** @addtogroup DCMI_Exported_Functions_Group4 Peripheral State functions 0589 * @{ 0590 */ 0591 /* Peripheral State functions *************************************************/ 0592 HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi); 0593 uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi); 0594 /** 0595 * @} 0596 */ 0597 0598 /** 0599 * @} 0600 */ 0601 0602 /* Private types -------------------------------------------------------------*/ 0603 /* Private defines -----------------------------------------------------------*/ 0604 /** @defgroup DCMI_Private_Defines DCMI Private Defines 0605 * @ingroup RTEMSBSPsARMSTM32H7 0606 * @{ 0607 */ 0608 /** 0609 * @} 0610 */ 0611 /* Private variables ---------------------------------------------------------*/ 0612 /* Private constants ---------------------------------------------------------*/ 0613 /** @defgroup DCMI_Private_Constants DCMI Private Constants 0614 * @ingroup RTEMSBSPsARMSTM32H7 0615 * @{ 0616 */ 0617 #define DCMI_MIS_INDEX ((uint32_t)0x1000) /*!< DCMI MIS register index */ 0618 #define DCMI_SR_INDEX ((uint32_t)0x2000) /*!< DCMI SR register index */ 0619 /** 0620 * @} 0621 */ 0622 /* Private macro -------------------------------------------------------------*/ 0623 /** @defgroup DCMI_Private_Macros DCMI Private Macros 0624 * @ingroup RTEMSBSPsARMSTM32H7 0625 * @{ 0626 */ 0627 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \ 0628 ((MODE) == DCMI_MODE_SNAPSHOT)) 0629 0630 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \ 0631 ((MODE) == DCMI_SYNCHRO_EMBEDDED)) 0632 0633 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \ 0634 ((POLARITY) == DCMI_PCKPOLARITY_RISING)) 0635 0636 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \ 0637 ((POLARITY) == DCMI_VSPOLARITY_HIGH)) 0638 0639 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \ 0640 ((POLARITY) == DCMI_HSPOLARITY_HIGH)) 0641 0642 #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \ 0643 ((JPEG_MODE) == DCMI_JPEG_ENABLE)) 0644 0645 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \ 0646 ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \ 0647 ((RATE) == DCMI_CR_ALTERNATE_4_FRAME)) 0648 0649 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \ 0650 ((DATA) == DCMI_EXTEND_DATA_10B) || \ 0651 ((DATA) == DCMI_EXTEND_DATA_12B) || \ 0652 ((DATA) == DCMI_EXTEND_DATA_14B)) 0653 0654 #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE) 0655 0656 #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT) 0657 0658 #define IS_DCMI_BYTE_SELECT_MODE(MODE)(((MODE) == DCMI_BSM_ALL) || \ 0659 ((MODE) == DCMI_BSM_OTHER) || \ 0660 ((MODE) == DCMI_BSM_ALTERNATE_4) || \ 0661 ((MODE) == DCMI_BSM_ALTERNATE_2)) 0662 0663 #define IS_DCMI_BYTE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OEBS_ODD) || \ 0664 ((POLARITY) == DCMI_OEBS_EVEN)) 0665 0666 #define IS_DCMI_LINE_SELECT_MODE(MODE)(((MODE) == DCMI_LSM_ALL) || \ 0667 ((MODE) == DCMI_LSM_ALTERNATE_2)) 0668 0669 #define IS_DCMI_LINE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OELS_ODD) || \ 0670 ((POLARITY) == DCMI_OELS_EVEN)) 0671 0672 /** 0673 * @} 0674 */ 0675 0676 /* Private functions ---------------------------------------------------------*/ 0677 /** @addtogroup DCMI_Private_Functions DCMI Private Functions 0678 * @{ 0679 */ 0680 0681 /** 0682 * @} 0683 */ 0684 0685 /** 0686 * @} 0687 */ 0688 /** 0689 * @} 0690 */ 0691 0692 #endif /* DCMI */ 0693 0694 #ifdef __cplusplus 0695 } 0696 #endif 0697 0698 #endif /* STM32H7xx_HAL_DCMI_H */ 0699
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |