CARME-M4 BSP  V1.5
stm32f4xx_dcmi.h
Go to the documentation of this file.
1 
28 /* Define to prevent recursive inclusion -------------------------------------*/
29 #ifndef __STM32F4xx_DCMI_H
30 #define __STM32F4xx_DCMI_H
31 
32 #ifdef __cplusplus
33  extern "C" {
34 #endif
35 
36 /* Includes ------------------------------------------------------------------*/
37 #include "stm32f4xx.h"
38 
47 /* Exported types ------------------------------------------------------------*/
51 typedef struct
52 {
53  uint16_t DCMI_CaptureMode;
56  uint16_t DCMI_SynchroMode;
59  uint16_t DCMI_PCKPolarity;
62  uint16_t DCMI_VSPolarity;
65  uint16_t DCMI_HSPolarity;
68  uint16_t DCMI_CaptureRate;
74 
78 typedef struct
79 {
89  uint16_t DCMI_CaptureCount;
93 
97 typedef struct
98 {
104 
105 /* Exported constants --------------------------------------------------------*/
106 
114 #define DCMI_CaptureMode_Continuous ((uint16_t)0x0000)
116 #define DCMI_CaptureMode_SnapShot ((uint16_t)0x0002)
118 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_CaptureMode_Continuous) || \
119  ((MODE) == DCMI_CaptureMode_SnapShot))
120 
128 #define DCMI_SynchroMode_Hardware ((uint16_t)0x0000)
130 #define DCMI_SynchroMode_Embedded ((uint16_t)0x0010)
132 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SynchroMode_Hardware) || \
133  ((MODE) == DCMI_SynchroMode_Embedded))
134 
142 #define DCMI_PCKPolarity_Falling ((uint16_t)0x0000)
143 #define DCMI_PCKPolarity_Rising ((uint16_t)0x0020)
144 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPolarity_Falling) || \
145  ((POLARITY) == DCMI_PCKPolarity_Rising))
154 #define DCMI_VSPolarity_Low ((uint16_t)0x0000)
155 #define DCMI_VSPolarity_High ((uint16_t)0x0080)
156 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPolarity_Low) || \
157  ((POLARITY) == DCMI_VSPolarity_High))
166 #define DCMI_HSPolarity_Low ((uint16_t)0x0000)
167 #define DCMI_HSPolarity_High ((uint16_t)0x0040)
168 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPolarity_Low) || \
169  ((POLARITY) == DCMI_HSPolarity_High))
178 #define DCMI_CaptureRate_All_Frame ((uint16_t)0x0000)
179 #define DCMI_CaptureRate_1of2_Frame ((uint16_t)0x0100)
180 #define DCMI_CaptureRate_1of4_Frame ((uint16_t)0x0200)
181 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CaptureRate_All_Frame) || \
182  ((RATE) == DCMI_CaptureRate_1of2_Frame) ||\
183  ((RATE) == DCMI_CaptureRate_1of4_Frame))
192 #define DCMI_ExtendedDataMode_8b ((uint16_t)0x0000)
193 #define DCMI_ExtendedDataMode_10b ((uint16_t)0x0400)
194 #define DCMI_ExtendedDataMode_12b ((uint16_t)0x0800)
195 #define DCMI_ExtendedDataMode_14b ((uint16_t)0x0C00)
196 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_ExtendedDataMode_8b) || \
197  ((DATA) == DCMI_ExtendedDataMode_10b) ||\
198  ((DATA) == DCMI_ExtendedDataMode_12b) ||\
199  ((DATA) == DCMI_ExtendedDataMode_14b))
200 
208 #define DCMI_IT_FRAME ((uint16_t)0x0001)
209 #define DCMI_IT_OVF ((uint16_t)0x0002)
210 #define DCMI_IT_ERR ((uint16_t)0x0004)
211 #define DCMI_IT_VSYNC ((uint16_t)0x0008)
212 #define DCMI_IT_LINE ((uint16_t)0x0010)
213 #define IS_DCMI_CONFIG_IT(IT) ((((IT) & (uint16_t)0xFFE0) == 0x0000) && ((IT) != 0x0000))
214 #define IS_DCMI_GET_IT(IT) (((IT) == DCMI_IT_FRAME) || \
215  ((IT) == DCMI_IT_OVF) || \
216  ((IT) == DCMI_IT_ERR) || \
217  ((IT) == DCMI_IT_VSYNC) || \
218  ((IT) == DCMI_IT_LINE))
219 
230 #define DCMI_FLAG_HSYNC ((uint16_t)0x2001)
231 #define DCMI_FLAG_VSYNC ((uint16_t)0x2002)
232 #define DCMI_FLAG_FNE ((uint16_t)0x2004)
233 
236 #define DCMI_FLAG_FRAMERI ((uint16_t)0x0001)
237 #define DCMI_FLAG_OVFRI ((uint16_t)0x0002)
238 #define DCMI_FLAG_ERRRI ((uint16_t)0x0004)
239 #define DCMI_FLAG_VSYNCRI ((uint16_t)0x0008)
240 #define DCMI_FLAG_LINERI ((uint16_t)0x0010)
241 
244 #define DCMI_FLAG_FRAMEMI ((uint16_t)0x1001)
245 #define DCMI_FLAG_OVFMI ((uint16_t)0x1002)
246 #define DCMI_FLAG_ERRMI ((uint16_t)0x1004)
247 #define DCMI_FLAG_VSYNCMI ((uint16_t)0x1008)
248 #define DCMI_FLAG_LINEMI ((uint16_t)0x1010)
249 #define IS_DCMI_GET_FLAG(FLAG) (((FLAG) == DCMI_FLAG_HSYNC) || \
250  ((FLAG) == DCMI_FLAG_VSYNC) || \
251  ((FLAG) == DCMI_FLAG_FNE) || \
252  ((FLAG) == DCMI_FLAG_FRAMERI) || \
253  ((FLAG) == DCMI_FLAG_OVFRI) || \
254  ((FLAG) == DCMI_FLAG_ERRRI) || \
255  ((FLAG) == DCMI_FLAG_VSYNCRI) || \
256  ((FLAG) == DCMI_FLAG_LINERI) || \
257  ((FLAG) == DCMI_FLAG_FRAMEMI) || \
258  ((FLAG) == DCMI_FLAG_OVFMI) || \
259  ((FLAG) == DCMI_FLAG_ERRMI) || \
260  ((FLAG) == DCMI_FLAG_VSYNCMI) || \
261  ((FLAG) == DCMI_FLAG_LINEMI))
262 
263 #define IS_DCMI_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFE0) == 0x0000) && ((FLAG) != 0x0000))
264 
272 /* Exported macro ------------------------------------------------------------*/
273 /* Exported functions --------------------------------------------------------*/
274 
275 /* Function used to set the DCMI configuration to the default reset state ****/
276 void DCMI_DeInit(void);
277 
278 /* Initialization and Configuration functions *********************************/
279 void DCMI_Init(DCMI_InitTypeDef* DCMI_InitStruct);
280 void DCMI_StructInit(DCMI_InitTypeDef* DCMI_InitStruct);
281 void DCMI_CROPConfig(DCMI_CROPInitTypeDef* DCMI_CROPInitStruct);
282 void DCMI_CROPCmd(FunctionalState NewState);
283 void DCMI_SetEmbeddedSynchroCodes(DCMI_CodesInitTypeDef* DCMI_CodesInitStruct);
284 void DCMI_JPEGCmd(FunctionalState NewState);
285 
286 /* Image capture functions ****************************************************/
287 void DCMI_Cmd(FunctionalState NewState);
288 void DCMI_CaptureCmd(FunctionalState NewState);
289 uint32_t DCMI_ReadData(void);
290 
291 /* Interrupts and flags management functions **********************************/
292 void DCMI_ITConfig(uint16_t DCMI_IT, FunctionalState NewState);
293 FlagStatus DCMI_GetFlagStatus(uint16_t DCMI_FLAG);
294 void DCMI_ClearFlag(uint16_t DCMI_FLAG);
295 ITStatus DCMI_GetITStatus(uint16_t DCMI_IT);
296 void DCMI_ClearITPendingBit(uint16_t DCMI_IT);
297 
298 #ifdef __cplusplus
299 }
300 #endif
301 
302 #endif /*__STM32F4xx_DCMI_H */
303 
312 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
uint16_t DCMI_CaptureRate
FlagStatus DCMI_GetFlagStatus(uint16_t DCMI_FLAG)
Checks whether the DCMI interface flag is set or not.
void DCMI_Cmd(FunctionalState NewState)
Enables or disables the DCMI interface.
DCMI Init structure definition.
uint16_t DCMI_VSPolarity
uint16_t DCMI_VerticalLineCount
uint16_t DCMI_SynchroMode
void DCMI_CROPConfig(DCMI_CROPInitTypeDef *DCMI_CROPInitStruct)
Initializes the DCMI peripheral CROP mode according to the specified parameters in the DCMI_CROPInitS...
uint32_t DCMI_ReadData(void)
Reads the data stored in the DR register.
DCMI Embedded Synchronisation CODE Init structure definition.
void DCMI_ClearFlag(uint16_t DCMI_FLAG)
Clears the DCMI's pending flags.
void DCMI_DeInit(void)
Deinitializes the DCMI registers to their default reset values.
void DCMI_SetEmbeddedSynchroCodes(DCMI_CodesInitTypeDef *DCMI_CodesInitStruct)
Sets the embedded synchronization codes.
ITStatus DCMI_GetITStatus(uint16_t DCMI_IT)
Checks whether the DCMI interrupt has occurred or not.
void DCMI_Init(DCMI_InitTypeDef *DCMI_InitStruct)
Initializes the DCMI according to the specified parameters in the DCMI_InitStruct.
uint16_t DCMI_PCKPolarity
void DCMI_StructInit(DCMI_InitTypeDef *DCMI_InitStruct)
Fills each DCMI_InitStruct member with its default value.
void DCMI_CaptureCmd(FunctionalState NewState)
Enables or disables the DCMI Capture.
void DCMI_JPEGCmd(FunctionalState NewState)
Enables or disables the DCMI JPEG format.
uint16_t DCMI_HSPolarity
uint16_t DCMI_CaptureMode
uint16_t DCMI_HorizontalOffsetCount
uint16_t DCMI_ExtendedDataMode
void DCMI_ClearITPendingBit(uint16_t DCMI_IT)
Clears the DCMI's interrupt pending bits.
uint16_t DCMI_VerticalStartLine
DCMI CROP Init structure definition.
void DCMI_ITConfig(uint16_t DCMI_IT, FunctionalState NewState)
Enables or disables the DCMI interface interrupts.
void DCMI_CROPCmd(FunctionalState NewState)
Enables or disables the DCMI Crop feature.