STM32H735xx HAL User Manual
stm32h7xx_hal_dcmi.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h7xx_hal_dcmi.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of DCMI HAL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2017 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32H7xx_HAL_DCMI_H
00021 #define STM32H7xx_HAL_DCMI_H
00022 
00023 #ifdef __cplusplus
00024  extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32h7xx_hal_def.h"
00029 
00030 #if defined (DCMI)
00031 /** @addtogroup STM32H7xx_HAL_Driver
00032   * @{
00033   */
00034 
00035 /** @addtogroup DCMI DCMI
00036   * @brief DCMI HAL module driver
00037   * @{
00038   */
00039 
00040 /* Exported types ------------------------------------------------------------*/
00041 /** @defgroup DCMI_Exported_Types DCMI Exported Types
00042   * @{
00043   */
00044 /**
00045   * @brief  HAL DCMI State structures definition
00046   */
00047 typedef enum
00048 {
00049   HAL_DCMI_STATE_RESET             = 0x00U,  /*!< DCMI not yet initialized or disabled  */
00050   HAL_DCMI_STATE_READY             = 0x01U,  /*!< DCMI initialized and ready for use    */
00051   HAL_DCMI_STATE_BUSY              = 0x02U,  /*!< DCMI internal processing is ongoing   */
00052   HAL_DCMI_STATE_TIMEOUT           = 0x03U,  /*!< DCMI timeout state                    */
00053   HAL_DCMI_STATE_ERROR             = 0x04U,  /*!< DCMI error state                      */
00054   HAL_DCMI_STATE_SUSPENDED         = 0x05U   /*!< DCMI suspend state                    */
00055 } HAL_DCMI_StateTypeDef;
00056 
00057 /**
00058   * @brief   DCMI Embedded Synchronisation CODE Init structure definition
00059   */
00060 typedef struct
00061 {
00062   uint8_t FrameStartCode; /*!< Specifies the code of the frame start delimiter. */
00063   uint8_t LineStartCode;  /*!< Specifies the code of the line start delimiter.  */
00064   uint8_t LineEndCode;    /*!< Specifies the code of the line end delimiter.    */
00065   uint8_t FrameEndCode;   /*!< Specifies the code of the frame end delimiter.   */
00066 } DCMI_CodesInitTypeDef;
00067 
00068 /**
00069   * @brief   DCMI Embedded Synchronisation UNMASK Init structure definition
00070   */
00071 typedef struct
00072 {
00073   uint8_t FrameStartUnmask; /*!< Specifies the frame start delimiter unmask. */
00074   uint8_t LineStartUnmask;  /*!< Specifies the line start delimiter unmask.  */
00075   uint8_t LineEndUnmask;    /*!< Specifies the line end delimiter unmask.    */
00076   uint8_t FrameEndUnmask;   /*!< Specifies the frame end delimiter unmask.   */
00077 } DCMI_SyncUnmaskTypeDef;
00078 /**
00079   * @brief   DCMI Init structure definition
00080   */
00081 typedef struct
00082 {
00083   uint32_t  SynchroMode;                /*!< Specifies the Synchronization Mode: Hardware or Embedded.
00084                                              This parameter can be a value of @ref DCMI_Synchronization_Mode */
00085 
00086   uint32_t  PCKPolarity;                /*!< Specifies the Pixel clock polarity: Falling or Rising.
00087                                              This parameter can be a value of @ref DCMI_PIXCK_Polarity       */
00088 
00089   uint32_t  VSPolarity;                 /*!< Specifies the Vertical synchronization polarity: High or Low.
00090                                              This parameter can be a value of @ref DCMI_VSYNC_Polarity       */
00091 
00092   uint32_t  HSPolarity;                 /*!< Specifies the Horizontal synchronization polarity: High or Low.
00093                                              This parameter can be a value of @ref DCMI_HSYNC_Polarity       */
00094 
00095   uint32_t  CaptureRate;                /*!< Specifies the frequency of frame capture: All, 1/2 or 1/4.
00096                                              This parameter can be a value of @ref DCMI_Capture_Rate         */
00097 
00098   uint32_t  ExtendedDataMode;           /*!< Specifies the data width: 8-bit, 10-bit, 12-bit or 14-bit.
00099                                              This parameter can be a value of @ref DCMI_Extended_Data_Mode   */
00100 
00101   DCMI_CodesInitTypeDef SyncroCode;     /*!< Specifies the code of the line/frame start delimiter and the
00102                                              line/frame end delimiter */
00103 
00104   uint32_t JPEGMode;                    /*!< Enable or Disable the JPEG mode.
00105                                              This parameter can be a value of @ref DCMI_MODE_JPEG            */
00106 
00107   uint32_t ByteSelectMode;              /*!< Specifies the data to be captured by the interface
00108                                             This parameter can be a value of @ref DCMI_Byte_Select_Mode      */
00109 
00110   uint32_t ByteSelectStart;             /*!< Specifies if the data to be captured by the interface is even or odd
00111                                             This parameter can be a value of @ref DCMI_Byte_Select_Start     */
00112 
00113   uint32_t LineSelectMode;              /*!< Specifies the line of data to be captured by the interface
00114                                             This parameter can be a value of @ref DCMI_Line_Select_Mode      */
00115 
00116   uint32_t LineSelectStart;             /*!< Specifies if the line of data to be captured by the interface is even or odd
00117                                             This parameter can be a value of @ref DCMI_Line_Select_Start     */
00118 } DCMI_InitTypeDef;
00119 
00120 /**
00121   * @brief  DCMI handle Structure definition
00122   */
00123 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
00124 typedef struct  __DCMI_HandleTypeDef
00125 #else
00126 typedef struct
00127 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
00128 {
00129   DCMI_TypeDef                  *Instance;           /*!< DCMI Register base address   */
00130 
00131   DCMI_InitTypeDef              Init;                /*!< DCMI parameters              */
00132 
00133   HAL_LockTypeDef               Lock;                /*!< DCMI locking object          */
00134 
00135   __IO HAL_DCMI_StateTypeDef    State;               /*!< DCMI state                   */
00136 
00137   __IO uint32_t                 XferCount;           /*!< DMA transfer counter         */
00138 
00139   __IO uint32_t                 XferSize;            /*!< DMA transfer size            */
00140 
00141   uint32_t                      XferTransferNumber;  /*!< DMA transfer number          */
00142 
00143   uint32_t                      pBuffPtr;            /*!< Pointer to DMA output buffer */
00144 
00145   DMA_HandleTypeDef             *DMA_Handle;         /*!< Pointer to the DMA handler   */
00146 
00147   __IO uint32_t                 ErrorCode;           /*!< DCMI Error code              */
00148 
00149 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
00150   void (* FrameEventCallback)(struct __DCMI_HandleTypeDef *hdcmi);       /*!< DCMI Frame Event Callback */
00151   void (* VsyncEventCallback)(struct __DCMI_HandleTypeDef *hdcmi);       /*!< DCMI Vsync Event Callback */
00152   void (* LineEventCallback)(struct __DCMI_HandleTypeDef *hdcmi);        /*!< DCMI Line Event Callback  */
00153   void (* ErrorCallback)(struct __DCMI_HandleTypeDef *hdcmi);            /*!< DCMI Error Callback       */
00154   void (* MspInitCallback)(struct __DCMI_HandleTypeDef *hdcmi);          /*!< DCMI Msp Init callback    */
00155   void (* MspDeInitCallback)(struct __DCMI_HandleTypeDef *hdcmi);        /*!< DCMI Msp DeInit callback  */
00156 #endif  /* USE_HAL_DCMI_REGISTER_CALLBACKS */
00157 } DCMI_HandleTypeDef;
00158 
00159 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
00160 /**
00161   * @brief  HAL DCMI Callback ID enumeration definition
00162   */
00163 typedef enum
00164 {
00165   HAL_DCMI_FRAME_EVENT_CB_ID    = 0x00U,    /*!< DCMI Frame Event Callback ID */
00166   HAL_DCMI_VSYNC_EVENT_CB_ID    = 0x01U,    /*!< DCMI Vsync Event Callback ID */
00167   HAL_DCMI_LINE_EVENT_CB_ID     = 0x02U,    /*!< DCMI Line Event Callback ID  */
00168   HAL_DCMI_ERROR_CB_ID          = 0x03U,    /*!< DCMI Error Callback ID       */
00169   HAL_DCMI_MSPINIT_CB_ID        = 0x04U,    /*!< DCMI MspInit callback ID     */
00170   HAL_DCMI_MSPDEINIT_CB_ID      = 0x05U     /*!< DCMI MspDeInit callback ID   */
00171 
00172 } HAL_DCMI_CallbackIDTypeDef;
00173 
00174 /**
00175   * @brief  HAL DCMI Callback pointer definition
00176   */
00177 typedef  void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef * hdcmi); /*!< pointer to a DCMI callback function */
00178 
00179 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
00180 /**
00181   * @}
00182   */
00183 /* Exported constants --------------------------------------------------------*/
00184 
00185 /** @defgroup DCMI_Exported_Constants DCMI Exported Constants
00186   * @{
00187   */
00188 
00189 /** @defgroup DCMI_Error_Code DCMI Error Code
00190   * @{
00191   */
00192 #define HAL_DCMI_ERROR_NONE             (0x00000000U)  /*!< No error              */
00193 #define HAL_DCMI_ERROR_OVR              (0x00000001U)  /*!< Overrun error         */
00194 #define HAL_DCMI_ERROR_SYNC             (0x00000002U)  /*!< Synchronization error */
00195 #define HAL_DCMI_ERROR_TIMEOUT          (0x00000020U)  /*!< Timeout error         */
00196 #define HAL_DCMI_ERROR_DMA              (0x00000040U)  /*!< DMA error             */
00197 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
00198 #define  HAL_DCMI_ERROR_INVALID_CALLBACK (0x00000080U)    /*!< Invalid Callback error  */
00199 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
00200 /**
00201   * @}
00202   */
00203 
00204 /** @defgroup DCMI_Capture_Mode DCMI Capture Mode
00205   * @{
00206   */
00207 #define DCMI_MODE_CONTINUOUS           (0x00000000U)  /*!< The received data are transferred continuously
00208                                                                     into the destination memory through the DMA             */
00209 #define DCMI_MODE_SNAPSHOT             ((uint32_t)DCMI_CR_CM)  /*!< Once activated, the interface waits for the start of
00210                                                                     frame and then transfers a single frame through the DMA */
00211 /**
00212   * @}
00213   */
00214 
00215 /** @defgroup DCMI_Synchronization_Mode DCMI Synchronization Mode
00216   * @{
00217   */
00218 #define DCMI_SYNCHRO_HARDWARE        (0x00000000U)   /*!< Hardware synchronization data capture (frame/line start/stop)
00219                                                                    is synchronized with the HSYNC/VSYNC signals                  */
00220 #define DCMI_SYNCHRO_EMBEDDED        ((uint32_t)DCMI_CR_ESS)  /*!< Embedded synchronization data capture is synchronized with
00221                                                                    synchronization codes embedded in the data flow               */
00222 
00223 /**
00224   * @}
00225   */
00226 
00227 /** @defgroup DCMI_PIXCK_Polarity DCMI PIXCK Polarity
00228   * @{
00229   */
00230 #define DCMI_PCKPOLARITY_FALLING    (0x00000000U)      /*!< Pixel clock active on Falling edge */
00231 #define DCMI_PCKPOLARITY_RISING     ((uint32_t)DCMI_CR_PCKPOL)  /*!< Pixel clock active on Rising edge  */
00232 
00233 /**
00234   * @}
00235   */
00236 
00237 /** @defgroup DCMI_VSYNC_Polarity DCMI VSYNC Polarity
00238   * @{
00239   */
00240 #define DCMI_VSPOLARITY_LOW     (0x00000000U)     /*!< Vertical synchronization active Low  */
00241 #define DCMI_VSPOLARITY_HIGH    ((uint32_t)DCMI_CR_VSPOL)  /*!< Vertical synchronization active High */
00242 
00243 /**
00244   * @}
00245   */
00246 
00247 /** @defgroup DCMI_HSYNC_Polarity DCMI HSYNC Polarity
00248   * @{
00249   */
00250 #define DCMI_HSPOLARITY_LOW     (0x00000000U)     /*!< Horizontal synchronization active Low  */
00251 #define DCMI_HSPOLARITY_HIGH    ((uint32_t)DCMI_CR_HSPOL)  /*!< Horizontal synchronization active High */
00252 
00253 /**
00254   * @}
00255   */
00256 
00257 /** @defgroup DCMI_MODE_JPEG DCMI MODE JPEG
00258   * @{
00259   */
00260 #define DCMI_JPEG_DISABLE   (0x00000000U)    /*!< Mode JPEG Disabled  */
00261 #define DCMI_JPEG_ENABLE    ((uint32_t)DCMI_CR_JPEG)  /*!< Mode JPEG Enabled   */
00262 
00263 /**
00264   * @}
00265   */
00266 
00267 /** @defgroup DCMI_Capture_Rate DCMI Capture Rate
00268   * @{
00269   */
00270 #define DCMI_CR_ALL_FRAME            (0x00000000U)      /*!< All frames are captured        */
00271 #define DCMI_CR_ALTERNATE_2_FRAME    ((uint32_t)DCMI_CR_FCRC_0)  /*!< Every alternate frame captured */
00272 #define DCMI_CR_ALTERNATE_4_FRAME    ((uint32_t)DCMI_CR_FCRC_1)  /*!< One frame in 4 frames captured */
00273 
00274 /**
00275   * @}
00276   */
00277 
00278 /** @defgroup DCMI_Extended_Data_Mode DCMI Extended Data Mode
00279   * @{
00280   */
00281 #define DCMI_EXTEND_DATA_8B     (0x00000000U)                       /*!< Interface captures 8-bit data on every pixel clock  */
00282 #define DCMI_EXTEND_DATA_10B    ((uint32_t)DCMI_CR_EDM_0)                    /*!< Interface captures 10-bit data on every pixel clock */
00283 #define DCMI_EXTEND_DATA_12B    ((uint32_t)DCMI_CR_EDM_1)                    /*!< Interface captures 12-bit data on every pixel clock */
00284 #define DCMI_EXTEND_DATA_14B    ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1))  /*!< Interface captures 14-bit data on every pixel clock */
00285 
00286 /**
00287   * @}
00288   */
00289 
00290 /** @defgroup DCMI_Window_Coordinate DCMI Window Coordinate
00291   * @{
00292   */
00293 #define DCMI_WINDOW_COORDINATE    (0x3FFFU)  /*!< Window coordinate */
00294 
00295 /**
00296   * @}
00297   */
00298 
00299 /** @defgroup DCMI_Window_Height DCMI Window Height
00300   * @{
00301   */
00302 #define DCMI_WINDOW_HEIGHT    (0x1FFFU)  /*!< Window Height */
00303 
00304 /**
00305   * @}
00306   */
00307 
00308 /** @defgroup DCMI_interrupt_sources  DCMI interrupt sources
00309   * @{
00310   */
00311 #define DCMI_IT_FRAME    ((uint32_t)DCMI_IER_FRAME_IE)    /*!< Capture complete interrupt      */
00312 #define DCMI_IT_OVR      ((uint32_t)DCMI_IER_OVR_IE)      /*!< Overrun interrupt               */
00313 #define DCMI_IT_ERR      ((uint32_t)DCMI_IER_ERR_IE)      /*!< Synchronization error interrupt */
00314 #define DCMI_IT_VSYNC    ((uint32_t)DCMI_IER_VSYNC_IE)    /*!< VSYNC interrupt                 */
00315 #define DCMI_IT_LINE     ((uint32_t)DCMI_IER_LINE_IE)     /*!< Line interrupt                  */
00316 /**
00317   * @}
00318   */
00319 
00320 /** @defgroup DCMI_Flags DCMI Flags
00321   * @{
00322   */
00323 
00324 /**
00325   * @brief   DCMI SR register
00326   */
00327 #define DCMI_FLAG_HSYNC     ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC) /*!< HSYNC pin state (active line / synchronization between lines)   */
00328 #define DCMI_FLAG_VSYNC     ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC) /*!< VSYNC pin state (active frame / synchronization between frames) */
00329 #define DCMI_FLAG_FNE       ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE)   /*!< FIFO not empty flag                                                 */
00330 /**
00331   * @brief   DCMI RIS register
00332   */
00333 #define DCMI_FLAG_FRAMERI    ((uint32_t)DCMI_RIS_FRAME_RIS)  /*!< Frame capture complete interrupt flag */
00334 #define DCMI_FLAG_OVRRI      ((uint32_t)DCMI_RIS_OVR_RIS)    /*!< Overrun interrupt flag                */
00335 #define DCMI_FLAG_ERRRI      ((uint32_t)DCMI_RIS_ERR_RIS)    /*!< Synchronization error interrupt flag  */
00336 #define DCMI_FLAG_VSYNCRI    ((uint32_t)DCMI_RIS_VSYNC_RIS)  /*!< VSYNC interrupt flag                  */
00337 #define DCMI_FLAG_LINERI     ((uint32_t)DCMI_RIS_LINE_RIS)   /*!< Line interrupt flag                   */
00338 /**
00339   * @brief   DCMI MIS register
00340   */
00341 #define DCMI_FLAG_FRAMEMI    ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS)  /*!< DCMI Frame capture complete masked interrupt status */
00342 #define DCMI_FLAG_OVRMI      ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS  )  /*!< DCMI Overrun masked interrupt status                */
00343 #define DCMI_FLAG_ERRMI      ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS  )  /*!< DCMI Synchronization error masked interrupt status  */
00344 #define DCMI_FLAG_VSYNCMI    ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS)  /*!< DCMI VSYNC masked interrupt status                  */
00345 #define DCMI_FLAG_LINEMI     ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS )  /*!< DCMI Line masked interrupt status                   */
00346 /**
00347   * @}
00348   */
00349 
00350 /** @defgroup DCMI_Byte_Select_Mode DCMI Byte Select Mode
00351   * @{
00352   */
00353 #define DCMI_BSM_ALL                 (0x00000000U) /*!< Interface captures all received data */
00354 #define DCMI_BSM_OTHER               ((uint32_t)DCMI_CR_BSM_0) /*!< Interface captures every other byte from the received data */
00355 #define DCMI_BSM_ALTERNATE_4         ((uint32_t)DCMI_CR_BSM_1) /*!< Interface captures one byte out of four */
00356 #define DCMI_BSM_ALTERNATE_2         ((uint32_t)(DCMI_CR_BSM_0 | DCMI_CR_BSM_1)) /*!< Interface captures two bytes out of four */
00357 
00358 /**
00359   * @}
00360   */
00361 
00362 /** @defgroup DCMI_Byte_Select_Start DCMI Byte Select Start
00363   * @{
00364   */
00365 #define DCMI_OEBS_ODD               (0x00000000U) /*!< Interface captures first data from the frame/line start, second one being dropped */
00366 #define DCMI_OEBS_EVEN              ((uint32_t)DCMI_CR_OEBS) /*!< Interface captures second data from the frame/line start, first one being dropped */
00367 
00368 /**
00369   * @}
00370   */
00371 
00372 /** @defgroup DCMI_Line_Select_Mode DCMI Line Select Mode
00373   * @{
00374   */
00375 #define DCMI_LSM_ALL                 (0x00000000U) /*!< Interface captures all received lines */
00376 #define DCMI_LSM_ALTERNATE_2         ((uint32_t)DCMI_CR_LSM) /*!< Interface captures one line out of two */
00377 
00378 /**
00379   * @}
00380   */
00381 
00382 /** @defgroup DCMI_Line_Select_Start DCMI Line Select Start
00383   * @{
00384   */
00385 #define DCMI_OELS_ODD               (0x00000000U) /*!< Interface captures first line from the frame start, second one being dropped */
00386 #define DCMI_OELS_EVEN              ((uint32_t)DCMI_CR_OELS) /*!< Interface captures second line from the frame start, first one being dropped */
00387 
00388 /**
00389   * @}
00390   */
00391 
00392 /**
00393   * @}
00394   */
00395 
00396 /* Exported macro ------------------------------------------------------------*/
00397 /** @defgroup DCMI_Exported_Macros DCMI Exported Macros
00398   * @{
00399   */
00400 
00401 /** @brief Reset DCMI handle state
00402   * @param  __HANDLE__ specifies the DCMI handle.
00403   * @retval None
00404   */
00405 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
00406 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__)  do{                                             \
00407                                                        (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \
00408                                                        (__HANDLE__)->MspInitCallback = NULL;       \
00409                                                        (__HANDLE__)->MspDeInitCallback = NULL;     \
00410                                                      } while(0)
00411 #else
00412 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DCMI_STATE_RESET)
00413 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
00414 
00415 /**
00416   * @brief  Enable the DCMI.
00417   * @param  __HANDLE__ DCMI handle
00418   * @retval None
00419   */
00420 #define __HAL_DCMI_ENABLE(__HANDLE__)    ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE)
00421 
00422 /**
00423   * @brief  Disable the DCMI.
00424   * @param  __HANDLE__ DCMI handle
00425   * @retval None
00426   */
00427 #define __HAL_DCMI_DISABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE))
00428 
00429 /* Interrupt & Flag management */
00430 /**
00431   * @brief  Get the DCMI pending flag.
00432   * @param  __HANDLE__ DCMI handle
00433   * @param  __FLAG__ Get the specified flag.
00434   *         This parameter can be one of the following values (no combination allowed)
00435   *            @arg DCMI_FLAG_HSYNC: HSYNC pin state (active line / synchronization between lines)
00436   *            @arg DCMI_FLAG_VSYNC: VSYNC pin state (active frame / synchronization between frames)
00437   *            @arg DCMI_FLAG_FNE: FIFO empty flag
00438   *            @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask
00439   *            @arg DCMI_FLAG_OVRRI: Overrun flag mask
00440   *            @arg DCMI_FLAG_ERRRI: Synchronization error flag mask
00441   *            @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask
00442   *            @arg DCMI_FLAG_LINERI: Line flag mask
00443   *            @arg DCMI_FLAG_FRAMEMI: DCMI Capture complete masked interrupt status
00444   *            @arg DCMI_FLAG_OVRMI: DCMI Overrun masked interrupt status
00445   *            @arg DCMI_FLAG_ERRMI: DCMI Synchronization error masked interrupt status
00446   *            @arg DCMI_FLAG_VSYNCMI: DCMI VSYNC masked interrupt status
00447   *            @arg DCMI_FLAG_LINEMI: DCMI Line masked interrupt status
00448   * @retval The state of FLAG.
00449   */
00450 #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\
00451 ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0)? ((__HANDLE__)->Instance->RIS & (__FLAG__)) :\
00452  (((__FLAG__) & DCMI_SR_INDEX) == 0x0)? ((__HANDLE__)->Instance->MIS & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__)))
00453 
00454 /**
00455   * @brief  Clear the DCMI pending flags.
00456   * @param  __HANDLE__ DCMI handle
00457   * @param  __FLAG__ specifies the flag to clear.
00458   *         This parameter can be any combination of the following values:
00459   *            @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask
00460   *            @arg DCMI_FLAG_OVFRI: Overflow flag mask
00461   *            @arg DCMI_FLAG_ERRRI: Synchronization error flag mask
00462   *            @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask
00463   *            @arg DCMI_FLAG_LINERI: Line flag mask
00464   * @retval None
00465   */
00466 #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
00467 
00468 /**
00469   * @brief  Enable the specified DCMI interrupts.
00470   * @param  __HANDLE__    DCMI handle
00471   * @param  __INTERRUPT__ specifies the DCMI interrupt sources to be enabled.
00472   *         This parameter can be any combination of the following values:
00473   *            @arg DCMI_IT_FRAME: Frame capture complete interrupt mask
00474   *            @arg DCMI_IT_OVF: Overflow interrupt mask
00475   *            @arg DCMI_IT_ERR: Synchronization error interrupt mask
00476   *            @arg DCMI_IT_VSYNC: VSYNC interrupt mask
00477   *            @arg DCMI_IT_LINE: Line interrupt mask
00478   * @retval None
00479   */
00480 #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
00481 
00482 /**
00483   * @brief  Disable the specified DCMI interrupts.
00484   * @param  __HANDLE__ DCMI handle
00485   * @param  __INTERRUPT__ specifies the DCMI interrupt sources to be enabled.
00486   *         This parameter can be any combination of the following values:
00487   *            @arg DCMI_IT_FRAME: Frame capture complete interrupt mask
00488   *            @arg DCMI_IT_OVF: Overflow interrupt mask
00489   *            @arg DCMI_IT_ERR: Synchronization error interrupt mask
00490   *            @arg DCMI_IT_VSYNC: VSYNC interrupt mask
00491   *            @arg DCMI_IT_LINE: Line interrupt mask
00492   * @retval None
00493   */
00494 #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
00495 
00496 /**
00497   * @brief  Check whether the specified DCMI interrupt has occurred or not.
00498   * @param  __HANDLE__ DCMI handle
00499   * @param  __INTERRUPT__ specifies the DCMI interrupt source to check.
00500   *         This parameter can be one of the following values:
00501   *            @arg DCMI_IT_FRAME: Frame capture complete interrupt mask
00502   *            @arg DCMI_IT_OVF: Overflow interrupt mask
00503   *            @arg DCMI_IT_ERR: Synchronization error interrupt mask
00504   *            @arg DCMI_IT_VSYNC: VSYNC interrupt mask
00505   *            @arg DCMI_IT_LINE: Line interrupt mask
00506   * @retval The state of INTERRUPT.
00507   */
00508 #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__))
00509 
00510 /**
00511   * @}
00512   */
00513 
00514 /* Exported functions --------------------------------------------------------*/
00515 /** @addtogroup DCMI_Exported_Functions DCMI Exported Functions
00516   * @{
00517   */
00518 
00519 /** @addtogroup DCMI_Exported_Functions_Group1 Initialization and Configuration functions
00520  * @{
00521  */
00522 /* Initialization and de-initialization functions *****************************/
00523 HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi);
00524 HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi);
00525 void       HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi);
00526 void       HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi);
00527 
00528 /* Callbacks Register/UnRegister functions  ***********************************/
00529 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
00530 HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback);
00531 HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID);
00532 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
00533 
00534 /**
00535   * @}
00536   */
00537 
00538 /** @addtogroup DCMI_Exported_Functions_Group2 IO operation functions
00539  * @{
00540  */
00541 /* IO operation functions *****************************************************/
00542 HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length);
00543 HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef* hdcmi);
00544 HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef* hdcmi);
00545 HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef* hdcmi);
00546 void       HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi);
00547 void       HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi);
00548 void       HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi);
00549 void       HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi);
00550 void       HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi);
00551 /**
00552   * @}
00553   */
00554 
00555 /** @addtogroup DCMI_Exported_Functions_Group3 Peripheral Control functions
00556  * @{
00557  */
00558 /* Peripheral Control functions ***********************************************/
00559 HAL_StatusTypeDef     HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize);
00560 HAL_StatusTypeDef     HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi);
00561 HAL_StatusTypeDef     HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi);
00562 HAL_StatusTypeDef     HAL_DCMI_ConfigSyncUnmask(DCMI_HandleTypeDef *hdcmi, DCMI_SyncUnmaskTypeDef *SyncUnmask);
00563 
00564 /**
00565   * @}
00566   */
00567 
00568 /** @addtogroup DCMI_Exported_Functions_Group4 Peripheral State functions
00569  * @{
00570  */
00571 /* Peripheral State functions *************************************************/
00572 HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi);
00573 uint32_t              HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi);
00574 /**
00575   * @}
00576   */
00577 
00578 /**
00579   * @}
00580   */
00581 
00582 /* Private types -------------------------------------------------------------*/
00583 /* Private variables ---------------------------------------------------------*/
00584 /* Private constants ---------------------------------------------------------*/
00585 /** @defgroup DCMI_Private_Constants DCMI Private Constants
00586   * @{
00587   */
00588 #define DCMI_MIS_INDEX        ((uint32_t)0x1000) /*!< DCMI MIS register index */
00589 #define DCMI_SR_INDEX         ((uint32_t)0x2000) /*!< DCMI SR register index  */
00590 /**
00591   * @}
00592   */
00593 /* Private macro -------------------------------------------------------------*/
00594 /** @defgroup DCMI_Private_Macros DCMI Private Macros
00595   * @{
00596   */
00597 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \
00598                                    ((MODE) == DCMI_MODE_SNAPSHOT))
00599 
00600 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \
00601                               ((MODE) == DCMI_SYNCHRO_EMBEDDED))
00602 
00603 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \
00604                                       ((POLARITY) == DCMI_PCKPOLARITY_RISING))
00605 
00606 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \
00607                                      ((POLARITY) == DCMI_VSPOLARITY_HIGH))
00608 
00609 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \
00610                                      ((POLARITY) == DCMI_HSPOLARITY_HIGH))
00611 
00612 #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \
00613                                      ((JPEG_MODE) == DCMI_JPEG_ENABLE))
00614 
00615 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME)         || \
00616                                     ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \
00617                                     ((RATE) == DCMI_CR_ALTERNATE_4_FRAME))
00618 
00619 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B)  || \
00620                                     ((DATA) == DCMI_EXTEND_DATA_10B) || \
00621                                     ((DATA) == DCMI_EXTEND_DATA_12B) || \
00622                                     ((DATA) == DCMI_EXTEND_DATA_14B))
00623 
00624 #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE)
00625 
00626 #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT)
00627 
00628 #define IS_DCMI_BYTE_SELECT_MODE(MODE)(((MODE) == DCMI_BSM_ALL) || \
00629                                        ((MODE) == DCMI_BSM_OTHER) || \
00630                                        ((MODE) == DCMI_BSM_ALTERNATE_4) || \
00631                                        ((MODE) == DCMI_BSM_ALTERNATE_2))
00632 
00633 #define IS_DCMI_BYTE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OEBS_ODD) || \
00634                                             ((POLARITY) == DCMI_OEBS_EVEN))
00635 
00636 #define IS_DCMI_LINE_SELECT_MODE(MODE)(((MODE) == DCMI_LSM_ALL) || \
00637                                        ((MODE) == DCMI_LSM_ALTERNATE_2))
00638 
00639 #define IS_DCMI_LINE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OELS_ODD) || \
00640                                             ((POLARITY) == DCMI_OELS_EVEN))
00641 
00642 /**
00643   * @}
00644   */
00645 
00646 /* Private functions ---------------------------------------------------------*/
00647 /** @addtogroup DCMI_Private_Functions DCMI Private Functions
00648   * @{
00649   */
00650 
00651 /**
00652   * @}
00653   */
00654 
00655 /**
00656   * @}
00657   */
00658 /**
00659   * @}
00660   */
00661 
00662 #endif /* DCMI */
00663 
00664 #ifdef __cplusplus
00665 }
00666 #endif
00667 
00668 #endif /* STM32H7xx_HAL_DCMI_H */
00669