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