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

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Feb 03 15:31:20 2015 +0000
Revision:
93:e188a91d3eaa
Release 93 of the mbed library

Main changes:

- Renesas RZ_A1H bugfixes - i2c, ticker
- new targets - Nucleo F303RE, Nucleo F070RB, BLE SMURFS,
Dragonfly 411RE,
- BusXXX - is connected method, plus operators addition
- LPC8xx - I2c fixes
- timestamp_t reverted to uint32_t
- RTX - fixes regarding stack (alignment, magic word)

Who changed what in which revision?

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