stm32f4xx_hal_dcmi.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_hal_dcmi.h
  4. * @author MCD Application Team
  5. * @brief Header file of DCMI HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F4xx_HAL_DCMI_H
  37. #define __STM32F4xx_HAL_DCMI_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. #if defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) ||\
  42. defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  43. defined(STM32F479xx)
  44. /* Includes ------------------------------------------------------------------*/
  45. #include "stm32f4xx_hal_def.h"
  46. /* Include DCMI HAL Extended module */
  47. /* (include on top of file since DCMI structures are defined in extended file) */
  48. #include "stm32f4xx_hal_dcmi_ex.h"
  49. /** @addtogroup STM32F4xx_HAL_Driver
  50. * @{
  51. */
  52. /** @addtogroup DCMI DCMI
  53. * @brief DCMI HAL module driver
  54. * @{
  55. */
  56. /* Exported types ------------------------------------------------------------*/
  57. /** @defgroup DCMI_Exported_Types DCMI Exported Types
  58. * @{
  59. */
  60. /**
  61. * @brief HAL DCMI State structures definition
  62. */
  63. typedef enum
  64. {
  65. HAL_DCMI_STATE_RESET = 0x00U, /*!< DCMI not yet initialized or disabled */
  66. HAL_DCMI_STATE_READY = 0x01U, /*!< DCMI initialized and ready for use */
  67. HAL_DCMI_STATE_BUSY = 0x02U, /*!< DCMI internal processing is ongoing */
  68. HAL_DCMI_STATE_TIMEOUT = 0x03U, /*!< DCMI timeout state */
  69. HAL_DCMI_STATE_ERROR = 0x04U, /*!< DCMI error state */
  70. HAL_DCMI_STATE_SUSPENDED = 0x05U /*!< DCMI suspend state */
  71. }HAL_DCMI_StateTypeDef;
  72. /**
  73. * @brief DCMI handle Structure definition
  74. */
  75. typedef struct
  76. {
  77. DCMI_TypeDef *Instance; /*!< DCMI Register base address */
  78. DCMI_InitTypeDef Init; /*!< DCMI parameters */
  79. HAL_LockTypeDef Lock; /*!< DCMI locking object */
  80. __IO HAL_DCMI_StateTypeDef State; /*!< DCMI state */
  81. __IO uint32_t XferCount; /*!< DMA transfer counter */
  82. __IO uint32_t XferSize; /*!< DMA transfer size */
  83. uint32_t XferTransferNumber; /*!< DMA transfer number */
  84. uint32_t pBuffPtr; /*!< Pointer to DMA output buffer */
  85. DMA_HandleTypeDef *DMA_Handle; /*!< Pointer to the DMA handler */
  86. __IO uint32_t ErrorCode; /*!< DCMI Error code */
  87. }DCMI_HandleTypeDef;
  88. /**
  89. * @}
  90. */
  91. /* Exported constants --------------------------------------------------------*/
  92. /** @defgroup DCMI_Exported_Constants DCMI Exported Constants
  93. * @{
  94. */
  95. /** @defgroup DCMI_Error_Code DCMI Error Code
  96. * @{
  97. */
  98. #define HAL_DCMI_ERROR_NONE 0x00000000U /*!< No error */
  99. #define HAL_DCMI_ERROR_OVR 0x00000001U /*!< Overrun error */
  100. #define HAL_DCMI_ERROR_SYNC 0x00000002U /*!< Synchronization error */
  101. #define HAL_DCMI_ERROR_TIMEOUT 0x00000020U /*!< Timeout error */
  102. #define HAL_DCMI_ERROR_DMA 0x00000040U /*!< DMA error */
  103. /**
  104. * @}
  105. */
  106. /** @defgroup DCMI_Capture_Mode DCMI Capture Mode
  107. * @{
  108. */
  109. #define DCMI_MODE_CONTINUOUS 0x00000000U /*!< The received data are transferred continuously
  110. into the destination memory through the DMA */
  111. #define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM) /*!< Once activated, the interface waits for the start of
  112. frame and then transfers a single frame through the DMA */
  113. /**
  114. * @}
  115. */
  116. /** @defgroup DCMI_Synchronization_Mode DCMI Synchronization Mode
  117. * @{
  118. */
  119. #define DCMI_SYNCHRO_HARDWARE 0x00000000U /*!< Hardware synchronization data capture (frame/line start/stop)
  120. is synchronized with the HSYNC/VSYNC signals */
  121. #define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS) /*!< Embedded synchronization data capture is synchronized with
  122. synchronization codes embedded in the data flow */
  123. /**
  124. * @}
  125. */
  126. /** @defgroup DCMI_PIXCK_Polarity DCMI PIXCK Polarity
  127. * @{
  128. */
  129. #define DCMI_PCKPOLARITY_FALLING 0x00000000U /*!< Pixel clock active on Falling edge */
  130. #define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL) /*!< Pixel clock active on Rising edge */
  131. /**
  132. * @}
  133. */
  134. /** @defgroup DCMI_VSYNC_Polarity DCMI VSYNC Polarity
  135. * @{
  136. */
  137. #define DCMI_VSPOLARITY_LOW 0x00000000U /*!< Vertical synchronization active Low */
  138. #define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL) /*!< Vertical synchronization active High */
  139. /**
  140. * @}
  141. */
  142. /** @defgroup DCMI_HSYNC_Polarity DCMI HSYNC Polarity
  143. * @{
  144. */
  145. #define DCMI_HSPOLARITY_LOW 0x00000000U /*!< Horizontal synchronization active Low */
  146. #define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL) /*!< Horizontal synchronization active High */
  147. /**
  148. * @}
  149. */
  150. /** @defgroup DCMI_MODE_JPEG DCMI MODE JPEG
  151. * @{
  152. */
  153. #define DCMI_JPEG_DISABLE 0x00000000U /*!< Mode JPEG Disabled */
  154. #define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG) /*!< Mode JPEG Enabled */
  155. /**
  156. * @}
  157. */
  158. /** @defgroup DCMI_Capture_Rate DCMI Capture Rate
  159. * @{
  160. */
  161. #define DCMI_CR_ALL_FRAME 0x00000000U /*!< All frames are captured */
  162. #define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0) /*!< Every alternate frame captured */
  163. #define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1) /*!< One frame in 4 frames captured */
  164. /**
  165. * @}
  166. */
  167. /** @defgroup DCMI_Extended_Data_Mode DCMI Extended Data Mode
  168. * @{
  169. */
  170. #define DCMI_EXTEND_DATA_8B 0x00000000U /*!< Interface captures 8-bit data on every pixel clock */
  171. #define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0) /*!< Interface captures 10-bit data on every pixel clock */
  172. #define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1) /*!< Interface captures 12-bit data on every pixel clock */
  173. #define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1)) /*!< Interface captures 14-bit data on every pixel clock */
  174. /**
  175. * @}
  176. */
  177. /** @defgroup DCMI_Window_Coordinate DCMI Window Coordinate
  178. * @{
  179. */
  180. #define DCMI_WINDOW_COORDINATE 0x3FFFU /*!< Window coordinate */
  181. /**
  182. * @}
  183. */
  184. /** @defgroup DCMI_Window_Height DCMI Window Height
  185. * @{
  186. */
  187. #define DCMI_WINDOW_HEIGHT 0x1FFFU /*!< Window Height */
  188. /**
  189. * @}
  190. */
  191. /** @defgroup DCMI_Window_Vertical_Line DCMI Window Vertical Line
  192. * @{
  193. */
  194. #define DCMI_POSITION_CWSIZE_VLINE (uint32_t)DCMI_CWSIZE_VLINE_Pos /*!< Required left shift to set crop window vertical line count */
  195. #define DCMI_POSITION_CWSTRT_VST (uint32_t)DCMI_CWSTRT_VST_Pos /*!< Required left shift to set crop window vertical start line count */
  196. /**
  197. * @}
  198. */
  199. /** @defgroup DCMI_interrupt_sources DCMI interrupt sources
  200. * @{
  201. */
  202. #define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE) /*!< Capture complete interrupt */
  203. #define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE) /*!< Overrun interrupt */
  204. #define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE) /*!< Synchronization error interrupt */
  205. #define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE) /*!< VSYNC interrupt */
  206. #define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE) /*!< Line interrupt */
  207. /**
  208. * @}
  209. */
  210. /** @defgroup DCMI_Flags DCMI Flags
  211. * @{
  212. */
  213. /**
  214. * @brief DCMI SR register
  215. */
  216. #define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC) /*!< HSYNC pin state (active line / synchronization between lines) */
  217. #define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC) /*!< VSYNC pin state (active frame / synchronization between frames) */
  218. #define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE) /*!< FIFO not empty flag */
  219. /**
  220. * @brief DCMI RIS register
  221. */
  222. #define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RISR_FRAME_RIS) /*!< Frame capture complete interrupt flag */
  223. #define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RISR_OVR_RIS) /*!< Overrun interrupt flag */
  224. #define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RISR_ERR_RIS) /*!< Synchronization error interrupt flag */
  225. #define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RISR_VSYNC_RIS) /*!< VSYNC interrupt flag */
  226. #define DCMI_FLAG_LINERI ((uint32_t)DCMI_RISR_LINE_RIS) /*!< Line interrupt flag */
  227. /**
  228. * @brief DCMI MIS register
  229. */
  230. #define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS) /*!< DCMI Frame capture complete masked interrupt status */
  231. #define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS ) /*!< DCMI Overrun masked interrupt status */
  232. #define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS ) /*!< DCMI Synchronization error masked interrupt status */
  233. #define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS) /*!< DCMI VSYNC masked interrupt status */
  234. #define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS ) /*!< DCMI Line masked interrupt status */
  235. /**
  236. * @}
  237. */
  238. /**
  239. * @}
  240. */
  241. /* Exported macro ------------------------------------------------------------*/
  242. /** @defgroup DCMI_Exported_Macros DCMI Exported Macros
  243. * @{
  244. */
  245. /** @brief Reset DCMI handle state
  246. * @param __HANDLE__ specifies the DCMI handle.
  247. * @retval None
  248. */
  249. #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DCMI_STATE_RESET)
  250. /**
  251. * @brief Enable the DCMI.
  252. * @param __HANDLE__ DCMI handle
  253. * @retval None
  254. */
  255. #define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE)
  256. /**
  257. * @brief Disable the DCMI.
  258. * @param __HANDLE__ DCMI handle
  259. * @retval None
  260. */
  261. #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE))
  262. /* Interrupt & Flag management */
  263. /**
  264. * @brief Get the DCMI pending flag.
  265. * @param __HANDLE__ DCMI handle
  266. * @param __FLAG__ Get the specified flag.
  267. * This parameter can be one of the following values (no combination allowed)
  268. * @arg DCMI_FLAG_HSYNC: HSYNC pin state (active line / synchronization between lines)
  269. * @arg DCMI_FLAG_VSYNC: VSYNC pin state (active frame / synchronization between frames)
  270. * @arg DCMI_FLAG_FNE: FIFO empty flag
  271. * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask
  272. * @arg DCMI_FLAG_OVRRI: Overrun flag mask
  273. * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask
  274. * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask
  275. * @arg DCMI_FLAG_LINERI: Line flag mask
  276. * @arg DCMI_FLAG_FRAMEMI: DCMI Capture complete masked interrupt status
  277. * @arg DCMI_FLAG_OVRMI: DCMI Overrun masked interrupt status
  278. * @arg DCMI_FLAG_ERRMI: DCMI Synchronization error masked interrupt status
  279. * @arg DCMI_FLAG_VSYNCMI: DCMI VSYNC masked interrupt status
  280. * @arg DCMI_FLAG_LINEMI: DCMI Line masked interrupt status
  281. * @retval The state of FLAG.
  282. */
  283. #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\
  284. ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0U)? ((__HANDLE__)->Instance->RISR & (__FLAG__)) :\
  285. (((__FLAG__) & DCMI_SR_INDEX) == 0x0U)? ((__HANDLE__)->Instance->MISR & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__)))
  286. /**
  287. * @brief Clear the DCMI pending flags.
  288. * @param __HANDLE__ DCMI handle
  289. * @param __FLAG__ specifies the flag to clear.
  290. * This parameter can be any combination of the following values:
  291. * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask
  292. * @arg DCMI_FLAG_OVRRI: Overrun flag mask
  293. * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask
  294. * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask
  295. * @arg DCMI_FLAG_LINERI: Line flag mask
  296. * @retval None
  297. */
  298. #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
  299. /**
  300. * @brief Enable the specified DCMI interrupts.
  301. * @param __HANDLE__ DCMI handle
  302. * @param __INTERRUPT__ specifies the DCMI interrupt sources to be enabled.
  303. * This parameter can be any combination of the following values:
  304. * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask
  305. * @arg DCMI_IT_OVR: Overrun interrupt mask
  306. * @arg DCMI_IT_ERR: Synchronization error interrupt mask
  307. * @arg DCMI_IT_VSYNC: VSYNC interrupt mask
  308. * @arg DCMI_IT_LINE: Line interrupt mask
  309. * @retval None
  310. */
  311. #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
  312. /**
  313. * @brief Disable the specified DCMI interrupts.
  314. * @param __HANDLE__ DCMI handle
  315. * @param __INTERRUPT__ specifies the DCMI interrupt sources to be enabled.
  316. * This parameter can be any combination of the following values:
  317. * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask
  318. * @arg DCMI_IT_OVR: Overrun interrupt mask
  319. * @arg DCMI_IT_ERR: Synchronization error interrupt mask
  320. * @arg DCMI_IT_VSYNC: VSYNC interrupt mask
  321. * @arg DCMI_IT_LINE: Line interrupt mask
  322. * @retval None
  323. */
  324. #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
  325. /**
  326. * @brief Check whether the specified DCMI interrupt has occurred or not.
  327. * @param __HANDLE__ DCMI handle
  328. * @param __INTERRUPT__ specifies the DCMI interrupt source to check.
  329. * This parameter can be one of the following values:
  330. * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask
  331. * @arg DCMI_IT_OVR: Overrun interrupt mask
  332. * @arg DCMI_IT_ERR: Synchronization error interrupt mask
  333. * @arg DCMI_IT_VSYNC: VSYNC interrupt mask
  334. * @arg DCMI_IT_LINE: Line interrupt mask
  335. * @retval The state of INTERRUPT.
  336. */
  337. #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__))
  338. /**
  339. * @}
  340. */
  341. /* Exported functions --------------------------------------------------------*/
  342. /** @addtogroup DCMI_Exported_Functions DCMI Exported Functions
  343. * @{
  344. */
  345. /** @addtogroup DCMI_Exported_Functions_Group1 Initialization and Configuration functions
  346. * @{
  347. */
  348. /* Initialization and de-initialization functions *****************************/
  349. HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi);
  350. HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi);
  351. void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi);
  352. void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi);
  353. /**
  354. * @}
  355. */
  356. /** @addtogroup DCMI_Exported_Functions_Group2 IO operation functions
  357. * @{
  358. */
  359. /* IO operation functions *****************************************************/
  360. HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length);
  361. HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef* hdcmi);
  362. HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef* hdcmi);
  363. HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef* hdcmi);
  364. void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi);
  365. void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi);
  366. void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi);
  367. void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi);
  368. void HAL_DCMI_VsyncCallback(DCMI_HandleTypeDef *hdcmi);
  369. void HAL_DCMI_HsyncCallback(DCMI_HandleTypeDef *hdcmi);
  370. void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi);
  371. /**
  372. * @}
  373. */
  374. /** @addtogroup DCMI_Exported_Functions_Group3 Peripheral Control functions
  375. * @{
  376. */
  377. /* Peripheral Control functions ***********************************************/
  378. HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize);
  379. HAL_StatusTypeDef HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi);
  380. HAL_StatusTypeDef HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi);
  381. /**
  382. * @}
  383. */
  384. /** @addtogroup DCMI_Exported_Functions_Group4 Peripheral State functions
  385. * @{
  386. */
  387. /* Peripheral State functions *************************************************/
  388. HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi);
  389. uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi);
  390. /**
  391. * @}
  392. */
  393. /**
  394. * @}
  395. */
  396. /* Private types -------------------------------------------------------------*/
  397. /* Private variables ---------------------------------------------------------*/
  398. /* Private constants ---------------------------------------------------------*/
  399. /** @defgroup DCMI_Private_Constants DCMI Private Constants
  400. * @{
  401. */
  402. #define DCMI_MIS_INDEX 0x1000U /*!< DCMI MIS register index */
  403. #define DCMI_SR_INDEX 0x2000U /*!< DCMI SR register index */
  404. /**
  405. * @}
  406. */
  407. /* Private macro -------------------------------------------------------------*/
  408. /** @defgroup DCMI_Private_Macros DCMI Private Macros
  409. * @{
  410. */
  411. #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \
  412. ((MODE) == DCMI_MODE_SNAPSHOT))
  413. #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \
  414. ((MODE) == DCMI_SYNCHRO_EMBEDDED))
  415. #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \
  416. ((POLARITY) == DCMI_PCKPOLARITY_RISING))
  417. #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \
  418. ((POLARITY) == DCMI_VSPOLARITY_HIGH))
  419. #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \
  420. ((POLARITY) == DCMI_HSPOLARITY_HIGH))
  421. #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \
  422. ((JPEG_MODE) == DCMI_JPEG_ENABLE))
  423. #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \
  424. ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \
  425. ((RATE) == DCMI_CR_ALTERNATE_4_FRAME))
  426. #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \
  427. ((DATA) == DCMI_EXTEND_DATA_10B) || \
  428. ((DATA) == DCMI_EXTEND_DATA_12B) || \
  429. ((DATA) == DCMI_EXTEND_DATA_14B))
  430. #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE)
  431. #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT)
  432. /**
  433. * @}
  434. */
  435. /* Private functions ---------------------------------------------------------*/
  436. /** @addtogroup DCMI_Private_Functions DCMI Private Functions
  437. * @{
  438. */
  439. /**
  440. * @}
  441. */
  442. #endif /* STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
  443. STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\
  444. STM32F479xx */
  445. /**
  446. * @}
  447. */
  448. /**
  449. * @}
  450. */
  451. #ifdef __cplusplus
  452. }
  453. #endif
  454. #endif /* __STM32F4xx_HAL_DCMI_H */
  455. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/