2 ******************************************************************************
\r
3 * @file stm32f4xx_dcmi.h
\r
4 * @author MCD Application Team
\r
6 * @date 30-September-2011
\r
7 * @brief This file contains all the functions prototypes for the DCMI firmware library.
\r
8 ******************************************************************************
\r
11 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
\r
12 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
\r
13 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
\r
14 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
\r
15 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
\r
16 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
18 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
\r
19 ******************************************************************************
\r
22 /* Define to prevent recursive inclusion -------------------------------------*/
\r
23 #ifndef __STM32F4xx_DCMI_H
\r
24 #define __STM32F4xx_DCMI_H
\r
30 /* Includes ------------------------------------------------------------------*/
\r
31 #include "stm32f4xx.h"
\r
33 /** @addtogroup STM32F4xx_StdPeriph_Driver
\r
37 /** @addtogroup DCMI
\r
41 /* Exported types ------------------------------------------------------------*/
\r
43 * @brief DCMI Init structure definition
\r
47 uint16_t DCMI_CaptureMode; /*!< Specifies the Capture Mode: Continuous or Snapshot.
\r
48 This parameter can be a value of @ref DCMI_Capture_Mode */
\r
50 uint16_t DCMI_SynchroMode; /*!< Specifies the Synchronization Mode: Hardware or Embedded.
\r
51 This parameter can be a value of @ref DCMI_Synchronization_Mode */
\r
53 uint16_t DCMI_PCKPolarity; /*!< Specifies the Pixel clock polarity: Falling or Rising.
\r
54 This parameter can be a value of @ref DCMI_PIXCK_Polarity */
\r
56 uint16_t DCMI_VSPolarity; /*!< Specifies the Vertical synchronization polarity: High or Low.
\r
57 This parameter can be a value of @ref DCMI_VSYNC_Polarity */
\r
59 uint16_t DCMI_HSPolarity; /*!< Specifies the Horizontal synchronization polarity: High or Low.
\r
60 This parameter can be a value of @ref DCMI_HSYNC_Polarity */
\r
62 uint16_t DCMI_CaptureRate; /*!< Specifies the frequency of frame capture: All, 1/2 or 1/4.
\r
63 This parameter can be a value of @ref DCMI_Capture_Rate */
\r
65 uint16_t DCMI_ExtendedDataMode; /*!< Specifies the data width: 8-bit, 10-bit, 12-bit or 14-bit.
\r
66 This parameter can be a value of @ref DCMI_Extended_Data_Mode */
\r
70 * @brief DCMI CROP Init structure definition
\r
74 uint16_t DCMI_VerticalStartLine; /*!< Specifies the Vertical start line count from which the image capture
\r
75 will start. This parameter can be a value between 0x00 and 0x1FFF */
\r
77 uint16_t DCMI_HorizontalOffsetCount; /*!< Specifies the number of pixel clocks to count before starting a capture.
\r
78 This parameter can be a value between 0x00 and 0x3FFF */
\r
80 uint16_t DCMI_VerticalLineCount; /*!< Specifies the number of lines to be captured from the starting point.
\r
81 This parameter can be a value between 0x00 and 0x3FFF */
\r
83 uint16_t DCMI_CaptureCount; /*!< Specifies the number of pixel clocks to be captured from the starting
\r
84 point on the same line.
\r
85 This parameter can be a value between 0x00 and 0x3FFF */
\r
86 } DCMI_CROPInitTypeDef;
\r
89 * @brief DCMI Embedded Synchronisation CODE Init structure definition
\r
93 uint8_t DCMI_FrameStartCode; /*!< Specifies the code of the frame start delimiter. */
\r
94 uint8_t DCMI_LineStartCode; /*!< Specifies the code of the line start delimiter. */
\r
95 uint8_t DCMI_LineEndCode; /*!< Specifies the code of the line end delimiter. */
\r
96 uint8_t DCMI_FrameEndCode; /*!< Specifies the code of the frame end delimiter. */
\r
97 } DCMI_CodesInitTypeDef;
\r
99 /* Exported constants --------------------------------------------------------*/
\r
101 /** @defgroup DCMI_Exported_Constants
\r
105 /** @defgroup DCMI_Capture_Mode
\r
108 #define DCMI_CaptureMode_Continuous ((uint16_t)0x0000) /*!< The received data are transferred continuously
\r
109 into the destination memory through the DMA */
\r
110 #define DCMI_CaptureMode_SnapShot ((uint16_t)0x0002) /*!< Once activated, the interface waits for the start of
\r
111 frame and then transfers a single frame through the DMA */
\r
112 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_CaptureMode_Continuous) || \
\r
113 ((MODE) == DCMI_CaptureMode_SnapShot))
\r
119 /** @defgroup DCMI_Synchronization_Mode
\r
122 #define DCMI_SynchroMode_Hardware ((uint16_t)0x0000) /*!< Hardware synchronization data capture (frame/line start/stop)
\r
123 is synchronized with the HSYNC/VSYNC signals */
\r
124 #define DCMI_SynchroMode_Embedded ((uint16_t)0x0010) /*!< Embedded synchronization data capture is synchronized with
\r
125 synchronization codes embedded in the data flow */
\r
126 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SynchroMode_Hardware) || \
\r
127 ((MODE) == DCMI_SynchroMode_Embedded))
\r
133 /** @defgroup DCMI_PIXCK_Polarity
\r
136 #define DCMI_PCKPolarity_Falling ((uint16_t)0x0000) /*!< Pixel clock active on Falling edge */
\r
137 #define DCMI_PCKPolarity_Rising ((uint16_t)0x0020) /*!< Pixel clock active on Rising edge */
\r
138 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPolarity_Falling) || \
\r
139 ((POLARITY) == DCMI_PCKPolarity_Rising))
\r
145 /** @defgroup DCMI_VSYNC_Polarity
\r
148 #define DCMI_VSPolarity_Low ((uint16_t)0x0000) /*!< Vertical synchronization active Low */
\r
149 #define DCMI_VSPolarity_High ((uint16_t)0x0080) /*!< Vertical synchronization active High */
\r
150 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPolarity_Low) || \
\r
151 ((POLARITY) == DCMI_VSPolarity_High))
\r
157 /** @defgroup DCMI_HSYNC_Polarity
\r
160 #define DCMI_HSPolarity_Low ((uint16_t)0x0000) /*!< Horizontal synchronization active Low */
\r
161 #define DCMI_HSPolarity_High ((uint16_t)0x0040) /*!< Horizontal synchronization active High */
\r
162 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPolarity_Low) || \
\r
163 ((POLARITY) == DCMI_HSPolarity_High))
\r
169 /** @defgroup DCMI_Capture_Rate
\r
172 #define DCMI_CaptureRate_All_Frame ((uint16_t)0x0000) /*!< All frames are captured */
\r
173 #define DCMI_CaptureRate_1of2_Frame ((uint16_t)0x0100) /*!< Every alternate frame captured */
\r
174 #define DCMI_CaptureRate_1of4_Frame ((uint16_t)0x0200) /*!< One frame in 4 frames captured */
\r
175 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CaptureRate_All_Frame) || \
\r
176 ((RATE) == DCMI_CaptureRate_1of2_Frame) ||\
\r
177 ((RATE) == DCMI_CaptureRate_1of4_Frame))
\r
183 /** @defgroup DCMI_Extended_Data_Mode
\r
186 #define DCMI_ExtendedDataMode_8b ((uint16_t)0x0000) /*!< Interface captures 8-bit data on every pixel clock */
\r
187 #define DCMI_ExtendedDataMode_10b ((uint16_t)0x0400) /*!< Interface captures 10-bit data on every pixel clock */
\r
188 #define DCMI_ExtendedDataMode_12b ((uint16_t)0x0800) /*!< Interface captures 12-bit data on every pixel clock */
\r
189 #define DCMI_ExtendedDataMode_14b ((uint16_t)0x0C00) /*!< Interface captures 14-bit data on every pixel clock */
\r
190 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_ExtendedDataMode_8b) || \
\r
191 ((DATA) == DCMI_ExtendedDataMode_10b) ||\
\r
192 ((DATA) == DCMI_ExtendedDataMode_12b) ||\
\r
193 ((DATA) == DCMI_ExtendedDataMode_14b))
\r
199 /** @defgroup DCMI_interrupt_sources
\r
202 #define DCMI_IT_FRAME ((uint16_t)0x0001)
\r
203 #define DCMI_IT_OVF ((uint16_t)0x0002)
\r
204 #define DCMI_IT_ERR ((uint16_t)0x0004)
\r
205 #define DCMI_IT_VSYNC ((uint16_t)0x0008)
\r
206 #define DCMI_IT_LINE ((uint16_t)0x0010)
\r
207 #define IS_DCMI_CONFIG_IT(IT) ((((IT) & (uint16_t)0xFFE0) == 0x0000) && ((IT) != 0x0000))
\r
208 #define IS_DCMI_GET_IT(IT) (((IT) == DCMI_IT_FRAME) || \
\r
209 ((IT) == DCMI_IT_OVF) || \
\r
210 ((IT) == DCMI_IT_ERR) || \
\r
211 ((IT) == DCMI_IT_VSYNC) || \
\r
212 ((IT) == DCMI_IT_LINE))
\r
218 /** @defgroup DCMI_Flags
\r
222 * @brief DCMI SR register
\r
224 #define DCMI_FLAG_HSYNC ((uint16_t)0x2001)
\r
225 #define DCMI_FLAG_VSYNC ((uint16_t)0x2002)
\r
226 #define DCMI_FLAG_FNE ((uint16_t)0x2004)
\r
228 * @brief DCMI RISR register
\r
230 #define DCMI_FLAG_FRAMERI ((uint16_t)0x0001)
\r
231 #define DCMI_FLAG_OVFRI ((uint16_t)0x0002)
\r
232 #define DCMI_FLAG_ERRRI ((uint16_t)0x0004)
\r
233 #define DCMI_FLAG_VSYNCRI ((uint16_t)0x0008)
\r
234 #define DCMI_FLAG_LINERI ((uint16_t)0x0010)
\r
236 * @brief DCMI MISR register
\r
238 #define DCMI_FLAG_FRAMEMI ((uint16_t)0x1001)
\r
239 #define DCMI_FLAG_OVFMI ((uint16_t)0x1002)
\r
240 #define DCMI_FLAG_ERRMI ((uint16_t)0x1004)
\r
241 #define DCMI_FLAG_VSYNCMI ((uint16_t)0x1008)
\r
242 #define DCMI_FLAG_LINEMI ((uint16_t)0x1010)
\r
243 #define IS_DCMI_GET_FLAG(FLAG) (((FLAG) == DCMI_FLAG_HSYNC) || \
\r
244 ((FLAG) == DCMI_FLAG_VSYNC) || \
\r
245 ((FLAG) == DCMI_FLAG_FNE) || \
\r
246 ((FLAG) == DCMI_FLAG_FRAMERI) || \
\r
247 ((FLAG) == DCMI_FLAG_OVFRI) || \
\r
248 ((FLAG) == DCMI_FLAG_ERRRI) || \
\r
249 ((FLAG) == DCMI_FLAG_VSYNCRI) || \
\r
250 ((FLAG) == DCMI_FLAG_LINERI) || \
\r
251 ((FLAG) == DCMI_FLAG_FRAMEMI) || \
\r
252 ((FLAG) == DCMI_FLAG_OVFMI) || \
\r
253 ((FLAG) == DCMI_FLAG_ERRMI) || \
\r
254 ((FLAG) == DCMI_FLAG_VSYNCMI) || \
\r
255 ((FLAG) == DCMI_FLAG_LINEMI))
\r
257 #define IS_DCMI_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFE0) == 0x0000) && ((FLAG) != 0x0000))
\r
266 /* Exported macro ------------------------------------------------------------*/
\r
267 /* Exported functions --------------------------------------------------------*/
\r
269 /* Function used to set the DCMI configuration to the default reset state ****/
\r
270 void DCMI_DeInit(void);
\r
272 /* Initialization and Configuration functions *********************************/
\r
273 void DCMI_Init(DCMI_InitTypeDef* DCMI_InitStruct);
\r
274 void DCMI_StructInit(DCMI_InitTypeDef* DCMI_InitStruct);
\r
275 void DCMI_CROPConfig(DCMI_CROPInitTypeDef* DCMI_CROPInitStruct);
\r
276 void DCMI_CROPCmd(FunctionalState NewState);
\r
277 void DCMI_SetEmbeddedSynchroCodes(DCMI_CodesInitTypeDef* DCMI_CodesInitStruct);
\r
278 void DCMI_JPEGCmd(FunctionalState NewState);
\r
280 /* Image capture functions ****************************************************/
\r
281 void DCMI_Cmd(FunctionalState NewState);
\r
282 void DCMI_CaptureCmd(FunctionalState NewState);
\r
283 uint32_t DCMI_ReadData(void);
\r
285 /* Interrupts and flags management functions **********************************/
\r
286 void DCMI_ITConfig(uint16_t DCMI_IT, FunctionalState NewState);
\r
287 FlagStatus DCMI_GetFlagStatus(uint16_t DCMI_FLAG);
\r
288 void DCMI_ClearFlag(uint16_t DCMI_FLAG);
\r
289 ITStatus DCMI_GetITStatus(uint16_t DCMI_IT);
\r
290 void DCMI_ClearITPendingBit(uint16_t DCMI_IT);
\r
296 #endif /*__STM32F4xx_DCMI_H */
\r
306 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
\r