1 /** 2 ****************************************************************************** 3 * @file stm32f2xx_hal_dcmi.h 4 * @author MCD Application Team 5 * @brief Header file of DCMI HAL module. 6 ****************************************************************************** 7 * @attention 8 * 9 * <h2><center>© Copyright (c) 2016 STMicroelectronics. 10 * All rights reserved.</center></h2> 11 * 12 * This software component is licensed by ST under BSD 3-Clause license, 13 * the "License"; You may not use this file except in compliance with the 14 * License. You may obtain a copy of the License at: 15 * opensource.org/licenses/BSD-3-Clause 16 * 17 ****************************************************************************** 18 */ 19 20 /* Define to prevent recursive inclusion -------------------------------------*/ 21 #ifndef STM32F2xx_HAL_DCMI_H 22 #define STM32F2xx_HAL_DCMI_H 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Includes ------------------------------------------------------------------*/ 29 #include "stm32f2xx_hal_def.h" 30 31 #if defined (DCMI) 32 33 /** @addtogroup STM32F2xx_HAL_Driver 34 * @{ 35 */ 36 37 /** @addtogroup DCMI DCMI 38 * @brief DCMI HAL module driver 39 * @{ 40 */ 41 42 /* Exported types ------------------------------------------------------------*/ 43 /** @defgroup DCMI_Exported_Types DCMI Exported Types 44 * @{ 45 */ 46 /** 47 * @brief HAL DCMI State structures definition 48 */ 49 typedef enum 50 { 51 HAL_DCMI_STATE_RESET = 0x00U, /*!< DCMI not yet initialized or disabled */ 52 HAL_DCMI_STATE_READY = 0x01U, /*!< DCMI initialized and ready for use */ 53 HAL_DCMI_STATE_BUSY = 0x02U, /*!< DCMI internal processing is ongoing */ 54 HAL_DCMI_STATE_TIMEOUT = 0x03U, /*!< DCMI timeout state */ 55 HAL_DCMI_STATE_ERROR = 0x04U, /*!< DCMI error state */ 56 HAL_DCMI_STATE_SUSPENDED = 0x05U /*!< DCMI suspend state */ 57 } HAL_DCMI_StateTypeDef; 58 59 /** 60 * @brief DCMIEx Embedded Synchronisation CODE Init structure definition 61 */ 62 typedef struct 63 { 64 uint8_t FrameStartCode; /*!< Specifies the code of the frame start delimiter. */ 65 uint8_t LineStartCode; /*!< Specifies the code of the line start delimiter. */ 66 uint8_t LineEndCode; /*!< Specifies the code of the line end delimiter. */ 67 uint8_t FrameEndCode; /*!< Specifies the code of the frame end delimiter. */ 68 } DCMI_CodesInitTypeDef; 69 70 /** 71 * @brief DCMI Embedded Synchronisation CODE Init structure definition 72 */ 73 typedef struct 74 { 75 uint8_t FrameStartUnmask; /*!< Specifies the frame start delimiter unmask. */ 76 uint8_t LineStartUnmask; /*!< Specifies the line start delimiter unmask. */ 77 uint8_t LineEndUnmask; /*!< Specifies the line end delimiter unmask. */ 78 uint8_t FrameEndUnmask; /*!< Specifies the frame end delimiter unmask. */ 79 } DCMI_SyncUnmaskTypeDef; 80 /** 81 * @brief DCMI Init structure definition 82 */ 83 typedef struct 84 { 85 uint32_t SynchroMode; /*!< Specifies the Synchronization Mode: Hardware or Embedded. 86 This parameter can be a value of @ref DCMI_Synchronization_Mode */ 87 88 uint32_t PCKPolarity; /*!< Specifies the Pixel clock polarity: Falling or Rising. 89 This parameter can be a value of @ref DCMI_PIXCK_Polarity */ 90 91 uint32_t VSPolarity; /*!< Specifies the Vertical synchronization polarity: High or Low. 92 This parameter can be a value of @ref DCMI_VSYNC_Polarity */ 93 94 uint32_t HSPolarity; /*!< Specifies the Horizontal synchronization polarity: High or Low. 95 This parameter can be a value of @ref DCMI_HSYNC_Polarity */ 96 97 uint32_t CaptureRate; /*!< Specifies the frequency of frame capture: All, 1/2 or 1/4. 98 This parameter can be a value of @ref DCMI_Capture_Rate */ 99 100 uint32_t ExtendedDataMode; /*!< Specifies the data width: 8-bit, 10-bit, 12-bit or 14-bit. 101 This parameter can be a value of @ref DCMI_Extended_Data_Mode */ 102 103 DCMI_CodesInitTypeDef SyncroCode; /*!< Specifies the code of the line/frame start delimiter and the 104 line/frame end delimiter */ 105 106 uint32_t JPEGMode; /*!< Enable or Disable the JPEG mode. 107 This parameter can be a value of @ref DCMI_MODE_JPEG */ 108 } DCMI_InitTypeDef; 109 110 /** 111 * @brief DCMI handle Structure definition 112 */ 113 typedef struct __DCMI_HandleTypeDef 114 { 115 DCMI_TypeDef *Instance; /*!< DCMI Register base address */ 116 117 DCMI_InitTypeDef Init; /*!< DCMI parameters */ 118 119 HAL_LockTypeDef Lock; /*!< DCMI locking object */ 120 121 __IO HAL_DCMI_StateTypeDef State; /*!< DCMI state */ 122 123 __IO uint32_t XferCount; /*!< DMA transfer counter */ 124 125 __IO uint32_t XferSize; /*!< DMA transfer size */ 126 127 uint32_t XferTransferNumber; /*!< DMA transfer number */ 128 129 uint32_t pBuffPtr; /*!< Pointer to DMA output buffer */ 130 131 DMA_HandleTypeDef *DMA_Handle; /*!< Pointer to the DMA handler */ 132 133 __IO uint32_t ErrorCode; /*!< DCMI Error code */ 134 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 135 void (* FrameEventCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Frame Event Callback */ 136 void (* VsyncEventCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Vsync Event Callback */ 137 void (* LineEventCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Line Event Callback */ 138 void (* ErrorCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Error Callback */ 139 void (* MspInitCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Msp Init callback */ 140 void (* MspDeInitCallback)(struct __DCMI_HandleTypeDef *hdcmi); /*!< DCMI Msp DeInit callback */ 141 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ 142 } DCMI_HandleTypeDef; 143 144 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 145 typedef enum 146 { 147 HAL_DCMI_FRAME_EVENT_CB_ID = 0x00U, /*!< DCMI Frame Event Callback ID */ 148 HAL_DCMI_VSYNC_EVENT_CB_ID = 0x01U, /*!< DCMI Vsync Event Callback ID */ 149 HAL_DCMI_LINE_EVENT_CB_ID = 0x02U, /*!< DCMI Line Event Callback ID */ 150 HAL_DCMI_ERROR_CB_ID = 0x03U, /*!< DCMI Error Callback ID */ 151 HAL_DCMI_MSPINIT_CB_ID = 0x04U, /*!< DCMI MspInit callback ID */ 152 HAL_DCMI_MSPDEINIT_CB_ID = 0x05U /*!< DCMI MspDeInit callback ID */ 153 154 } HAL_DCMI_CallbackIDTypeDef; 155 156 typedef void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef *hdcmi); 157 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ 158 159 160 /** 161 * @} 162 */ 163 /* Exported constants --------------------------------------------------------*/ 164 165 /** @defgroup DCMI_Exported_Constants DCMI Exported Constants 166 * @{ 167 */ 168 169 /** @defgroup DCMI_Error_Code DCMI Error Code 170 * @{ 171 */ 172 #define HAL_DCMI_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ 173 #define HAL_DCMI_ERROR_OVR ((uint32_t)0x00000001U) /*!< Overrun error */ 174 #define HAL_DCMI_ERROR_SYNC ((uint32_t)0x00000002U) /*!< Synchronization error */ 175 #define HAL_DCMI_ERROR_TIMEOUT ((uint32_t)0x00000020U) /*!< Timeout error */ 176 #define HAL_DCMI_ERROR_DMA ((uint32_t)0x00000040U) /*!< DMA error */ 177 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 178 #define HAL_DCMI_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U) /*!< Invalid callback error */ 179 #endif 180 /** 181 * @} 182 */ 183 184 /** @defgroup DCMI_Capture_Mode DCMI Capture Mode 185 * @{ 186 */ 187 #define DCMI_MODE_CONTINUOUS ((uint32_t)0x00000000U) /*!< The received data are transferred continuously 188 into the destination memory through the DMA */ 189 #define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM) /*!< Once activated, the interface waits for the start of 190 frame and then transfers a single frame through the DMA */ 191 /** 192 * @} 193 */ 194 195 /** @defgroup DCMI_Synchronization_Mode DCMI Synchronization Mode 196 * @{ 197 */ 198 #define DCMI_SYNCHRO_HARDWARE ((uint32_t)0x00000000U) /*!< Hardware synchronization data capture (frame/line start/stop) 199 is synchronized with the HSYNC/VSYNC signals */ 200 #define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS) /*!< Embedded synchronization data capture is synchronized with 201 synchronization codes embedded in the data flow */ 202 203 /** 204 * @} 205 */ 206 207 /** @defgroup DCMI_PIXCK_Polarity DCMI PIXCK Polarity 208 * @{ 209 */ 210 #define DCMI_PCKPOLARITY_FALLING ((uint32_t)0x00000000U) /*!< Pixel clock active on Falling edge */ 211 #define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL) /*!< Pixel clock active on Rising edge */ 212 213 /** 214 * @} 215 */ 216 217 /** @defgroup DCMI_VSYNC_Polarity DCMI VSYNC Polarity 218 * @{ 219 */ 220 #define DCMI_VSPOLARITY_LOW ((uint32_t)0x00000000U) /*!< Vertical synchronization active Low */ 221 #define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL) /*!< Vertical synchronization active High */ 222 223 /** 224 * @} 225 */ 226 227 /** @defgroup DCMI_HSYNC_Polarity DCMI HSYNC Polarity 228 * @{ 229 */ 230 #define DCMI_HSPOLARITY_LOW ((uint32_t)0x00000000U) /*!< Horizontal synchronization active Low */ 231 #define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL) /*!< Horizontal synchronization active High */ 232 233 /** 234 * @} 235 */ 236 237 /** @defgroup DCMI_MODE_JPEG DCMI MODE JPEG 238 * @{ 239 */ 240 #define DCMI_JPEG_DISABLE ((uint32_t)0x00000000U) /*!< Mode JPEG Disabled */ 241 #define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG) /*!< Mode JPEG Enabled */ 242 243 /** 244 * @} 245 */ 246 247 /** @defgroup DCMI_Capture_Rate DCMI Capture Rate 248 * @{ 249 */ 250 #define DCMI_CR_ALL_FRAME ((uint32_t)0x00000000U) /*!< All frames are captured */ 251 #define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0) /*!< Every alternate frame captured */ 252 #define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1) /*!< One frame in 4 frames captured */ 253 254 /** 255 * @} 256 */ 257 258 /** @defgroup DCMI_Extended_Data_Mode DCMI Extended Data Mode 259 * @{ 260 */ 261 #define DCMI_EXTEND_DATA_8B ((uint32_t)0x00000000U) /*!< Interface captures 8-bit data on every pixel clock */ 262 #define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0) /*!< Interface captures 10-bit data on every pixel clock */ 263 #define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1) /*!< Interface captures 12-bit data on every pixel clock */ 264 #define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1)) /*!< Interface captures 14-bit data on every pixel clock */ 265 266 /** 267 * @} 268 */ 269 270 /** @defgroup DCMI_Window_Coordinate DCMI Window Coordinate 271 * @{ 272 */ 273 #define DCMI_WINDOW_COORDINATE ((uint32_t)0x3FFFU) /*!< Window coordinate */ 274 275 /** 276 * @} 277 */ 278 279 /** @defgroup DCMI_Window_Height DCMI Window Height 280 * @{ 281 */ 282 #define DCMI_WINDOW_HEIGHT ((uint32_t)0x1FFFU) /*!< Window Height */ 283 284 /** 285 * @} 286 */ 287 288 /** @defgroup DCMI_interrupt_sources DCMI interrupt sources 289 * @{ 290 */ 291 #define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE) /*!< Capture complete interrupt */ 292 #define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE) /*!< Overrun interrupt */ 293 #define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE) /*!< Synchronization error interrupt */ 294 #define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE) /*!< VSYNC interrupt */ 295 #define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE) /*!< Line interrupt */ 296 /** 297 * @} 298 */ 299 300 /** @defgroup DCMI_Flags DCMI Flags 301 * @{ 302 */ 303 304 /** 305 * @brief DCMI SR register 306 */ 307 #define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC) /*!< HSYNC pin state (active line / synchronization between lines) */ 308 #define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC) /*!< VSYNC pin state (active frame / synchronization between frames) */ 309 #define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE) /*!< FIFO not empty flag */ 310 /** 311 * @brief DCMI RIS register 312 */ 313 #define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RIS_FRAME_RIS) /*!< Frame capture complete interrupt flag */ 314 #define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RIS_OVR_RIS) /*!< Overrun interrupt flag */ 315 #define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RIS_ERR_RIS) /*!< Synchronization error interrupt flag */ 316 #define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RIS_VSYNC_RIS) /*!< VSYNC interrupt flag */ 317 #define DCMI_FLAG_LINERI ((uint32_t)DCMI_RIS_LINE_RIS) /*!< Line interrupt flag */ 318 /** 319 * @brief DCMI MIS register 320 */ 321 #define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS) /*!< DCMI Frame capture complete masked interrupt status */ 322 #define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS ) /*!< DCMI Overrun masked interrupt status */ 323 #define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS ) /*!< DCMI Synchronization error masked interrupt status */ 324 #define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS) /*!< DCMI VSYNC masked interrupt status */ 325 #define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS ) /*!< DCMI Line masked interrupt status */ 326 /** 327 * @} 328 */ 329 330 /** 331 * @} 332 */ 333 334 /* Exported macro ------------------------------------------------------------*/ 335 /** @defgroup DCMI_Exported_Macros DCMI Exported Macros 336 * @{ 337 */ 338 339 /** @brief Reset DCMI handle state 340 * @param __HANDLE__ specifies the DCMI handle. 341 * @retval None 342 */ 343 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) do{ \ 344 (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \ 345 (__HANDLE__)->MspInitCallback = NULL; \ 346 (__HANDLE__)->MspDeInitCallback = NULL; \ 347 } while(0) 348 349 /** 350 * @brief Enable the DCMI. 351 * @param __HANDLE__ DCMI handle 352 * @retval None 353 */ 354 #define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE) 355 356 /** 357 * @brief Disable the DCMI. 358 * @param __HANDLE__ DCMI handle 359 * @retval None 360 */ 361 #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE)) 362 363 /* Interrupt & Flag management */ 364 /** 365 * @brief Get the DCMI pending flag. 366 * @param __HANDLE__ DCMI handle 367 * @param __FLAG__ Get the specified flag. 368 * This parameter can be one of the following values (no combination allowed) 369 * @arg DCMI_FLAG_HSYNC: HSYNC pin state (active line / synchronization between lines) 370 * @arg DCMI_FLAG_VSYNC: VSYNC pin state (active frame / synchronization between frames) 371 * @arg DCMI_FLAG_FNE: FIFO empty flag 372 * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask 373 * @arg DCMI_FLAG_OVRRI: Overrun flag mask 374 * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask 375 * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask 376 * @arg DCMI_FLAG_LINERI: Line flag mask 377 * @arg DCMI_FLAG_FRAMEMI: DCMI Capture complete masked interrupt status 378 * @arg DCMI_FLAG_OVRMI: DCMI Overrun masked interrupt status 379 * @arg DCMI_FLAG_ERRMI: DCMI Synchronization error masked interrupt status 380 * @arg DCMI_FLAG_VSYNCMI: DCMI VSYNC masked interrupt status 381 * @arg DCMI_FLAG_LINEMI: DCMI Line masked interrupt status 382 * @retval The state of FLAG. 383 */ 384 #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\ 385 ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0)? ((__HANDLE__)->Instance->RIS & (__FLAG__)) :\ 386 (((__FLAG__) & DCMI_SR_INDEX) == 0x0)? ((__HANDLE__)->Instance->MIS & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__))) 387 388 /** 389 * @brief Clear the DCMI pending flags. 390 * @param __HANDLE__ DCMI handle 391 * @param __FLAG__ specifies the flag to clear. 392 * This parameter can be any combination of the following values: 393 * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask 394 * @arg DCMI_FLAG_OVFRI: Overflow flag mask 395 * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask 396 * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask 397 * @arg DCMI_FLAG_LINERI: Line flag mask 398 * @retval None 399 */ 400 #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) 401 402 /** 403 * @brief Enable the specified DCMI interrupts. 404 * @param __HANDLE__ DCMI handle 405 * @param __INTERRUPT__ specifies the DCMI interrupt sources to be enabled. 406 * This parameter can be any combination of the following values: 407 * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask 408 * @arg DCMI_IT_OVF: Overflow interrupt mask 409 * @arg DCMI_IT_ERR: Synchronization error interrupt mask 410 * @arg DCMI_IT_VSYNC: VSYNC interrupt mask 411 * @arg DCMI_IT_LINE: Line interrupt mask 412 * @retval None 413 */ 414 #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) 415 416 /** 417 * @brief Disable the specified DCMI interrupts. 418 * @param __HANDLE__ DCMI handle 419 * @param __INTERRUPT__ specifies the DCMI interrupt sources to be enabled. 420 * This parameter can be any combination of the following values: 421 * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask 422 * @arg DCMI_IT_OVF: Overflow interrupt mask 423 * @arg DCMI_IT_ERR: Synchronization error interrupt mask 424 * @arg DCMI_IT_VSYNC: VSYNC interrupt mask 425 * @arg DCMI_IT_LINE: Line interrupt mask 426 * @retval None 427 */ 428 #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__)) 429 430 /** 431 * @brief Check whether the specified DCMI interrupt has occurred or not. 432 * @param __HANDLE__ DCMI handle 433 * @param __INTERRUPT__ specifies the DCMI interrupt source to check. 434 * This parameter can be one of the following values: 435 * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask 436 * @arg DCMI_IT_OVF: Overflow interrupt mask 437 * @arg DCMI_IT_ERR: Synchronization error interrupt mask 438 * @arg DCMI_IT_VSYNC: VSYNC interrupt mask 439 * @arg DCMI_IT_LINE: Line interrupt mask 440 * @retval The state of INTERRUPT. 441 */ 442 #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__)) 443 444 /** 445 * @} 446 */ 447 448 /* Exported functions --------------------------------------------------------*/ 449 /** @addtogroup DCMI_Exported_Functions DCMI Exported Functions 450 * @{ 451 */ 452 453 /** @addtogroup DCMI_Exported_Functions_Group1 Initialization and Configuration functions 454 * @{ 455 */ 456 /* Initialization and de-initialization functions *****************************/ 457 HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi); 458 HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi); 459 void HAL_DCMI_MspInit(DCMI_HandleTypeDef *hdcmi); 460 void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef *hdcmi); 461 462 /* Callbacks Register/UnRegister functions ***********************************/ 463 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) 464 HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback); 465 HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID); 466 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ 467 /** 468 * @} 469 */ 470 471 /** @addtogroup DCMI_Exported_Functions_Group2 IO operation functions 472 * @{ 473 */ 474 /* IO operation functions *****************************************************/ 475 HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef *hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length); 476 HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef *hdcmi); 477 HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef *hdcmi); 478 HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef *hdcmi); 479 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi); 480 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi); 481 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi); 482 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi); 483 void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi); 484 /** 485 * @} 486 */ 487 488 /** @addtogroup DCMI_Exported_Functions_Group3 Peripheral Control functions 489 * @{ 490 */ 491 /* Peripheral Control functions ***********************************************/ 492 HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize); 493 HAL_StatusTypeDef HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi); 494 HAL_StatusTypeDef HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi); 495 HAL_StatusTypeDef HAL_DCMI_ConfigSyncUnmask(DCMI_HandleTypeDef *hdcmi, DCMI_SyncUnmaskTypeDef *SyncUnmask); 496 497 /** 498 * @} 499 */ 500 501 /** @addtogroup DCMI_Exported_Functions_Group4 Peripheral State functions 502 * @{ 503 */ 504 /* Peripheral State functions *************************************************/ 505 HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi); 506 uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi); 507 /** 508 * @} 509 */ 510 511 /** 512 * @} 513 */ 514 515 /* Private types -------------------------------------------------------------*/ 516 /* Private variables ---------------------------------------------------------*/ 517 /* Private constants ---------------------------------------------------------*/ 518 /** @defgroup DCMI_Private_Constants DCMI Private Constants 519 * @{ 520 */ 521 #define DCMI_MIS_INDEX ((uint32_t)0x1000) /*!< DCMI MIS register index */ 522 #define DCMI_SR_INDEX ((uint32_t)0x2000) /*!< DCMI SR register index */ 523 /** 524 * @} 525 */ 526 /* Private macro -------------------------------------------------------------*/ 527 /** @defgroup DCMI_Private_Macros DCMI Private Macros 528 * @{ 529 */ 530 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \ 531 ((MODE) == DCMI_MODE_SNAPSHOT)) 532 533 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \ 534 ((MODE) == DCMI_SYNCHRO_EMBEDDED)) 535 536 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \ 537 ((POLARITY) == DCMI_PCKPOLARITY_RISING)) 538 539 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \ 540 ((POLARITY) == DCMI_VSPOLARITY_HIGH)) 541 542 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \ 543 ((POLARITY) == DCMI_HSPOLARITY_HIGH)) 544 545 #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \ 546 ((JPEG_MODE) == DCMI_JPEG_ENABLE)) 547 548 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \ 549 ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \ 550 ((RATE) == DCMI_CR_ALTERNATE_4_FRAME)) 551 552 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \ 553 ((DATA) == DCMI_EXTEND_DATA_10B) || \ 554 ((DATA) == DCMI_EXTEND_DATA_12B) || \ 555 ((DATA) == DCMI_EXTEND_DATA_14B)) 556 557 #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE) 558 559 #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT) 560 561 /** 562 * @} 563 */ 564 565 /* Private functions ---------------------------------------------------------*/ 566 /** @addtogroup DCMI_Private_Functions DCMI Private Functions 567 * @{ 568 */ 569 570 /** 571 * @} 572 */ 573 574 /** 575 * @} 576 */ 577 /** 578 * @} 579 */ 580 #endif /* DCMI */ 581 582 #ifdef __cplusplus 583 } 584 #endif 585 586 #endif /* STM32F2xx_HAL_DCMI_H */ 587 588 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 589