The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jul 02 13:22:23 2014 +0100
Revision:
86:04dd9b1680ae
Release 86 of the mbed library

Main changes:


- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets

Who changed what in which revision?

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