Without definitions for BSP_CAMERA_IRQHandler and BSP_CAMERA_DMA_IRQHandler methods, DCMI IRQs were not being serviced by HAL_DCMI_IRQHandler. This broke the IRQ-based DCMI API.

Committer:
njeffrie
Date:
Thu Jun 06 00:07:56 2019 +0000
Revision:
10:b70ba9b9345e
Parent:
9:df2ea349c37a
Add DCMI IRQ Handlers; ; Without definitions for BSP_CAMERA_IRQHandler and BSP_CAMERA_DMA_IRQHandler; methods, DCMI IRQs were not being serviced by HAL_DCMI_IRQHandler.  This broke; the IRQ-based DCMI API.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 6:e1d9da7fe856 1 /**
bcostm 6:e1d9da7fe856 2 ******************************************************************************
bcostm 6:e1d9da7fe856 3 * @file stm32746g_discovery_camera.c
bcostm 6:e1d9da7fe856 4 * @author MCD Application Team
Jerome Coutant 8:56384bddaba5 5 * @version V2.0.0
Jerome Coutant 8:56384bddaba5 6 * @date 30-December-2016
bcostm 6:e1d9da7fe856 7 * @brief This file includes the driver for Camera modules mounted on
bcostm 6:e1d9da7fe856 8 * STM32746G-Discovery board.
bcostm 6:e1d9da7fe856 9 @verbatim
bcostm 6:e1d9da7fe856 10 How to use this driver:
bcostm 6:e1d9da7fe856 11 ------------------------
bcostm 6:e1d9da7fe856 12 - This driver is used to drive the camera.
bcostm 6:e1d9da7fe856 13 - The OV9655 component driver MUST be included with this driver.
bcostm 6:e1d9da7fe856 14
bcostm 6:e1d9da7fe856 15 Driver description:
bcostm 6:e1d9da7fe856 16 -------------------
bcostm 6:e1d9da7fe856 17 + Initialization steps:
bcostm 6:e1d9da7fe856 18 o Initialize the camera using the BSP_CAMERA_Init() function.
bcostm 6:e1d9da7fe856 19 o Start the camera capture/snapshot using the CAMERA_Start() function.
bcostm 6:e1d9da7fe856 20 o Suspend, resume or stop the camera capture using the following functions:
bcostm 6:e1d9da7fe856 21 - BSP_CAMERA_Suspend()
bcostm 6:e1d9da7fe856 22 - BSP_CAMERA_Resume()
bcostm 6:e1d9da7fe856 23 - BSP_CAMERA_Stop()
bcostm 6:e1d9da7fe856 24
bcostm 6:e1d9da7fe856 25 + Options
bcostm 6:e1d9da7fe856 26 o Increase or decrease on the fly the brightness and/or contrast
bcostm 6:e1d9da7fe856 27 using the following function:
bcostm 6:e1d9da7fe856 28 - BSP_CAMERA_ContrastBrightnessConfig
bcostm 6:e1d9da7fe856 29 o Add a special effect on the fly using the following functions:
bcostm 6:e1d9da7fe856 30 - BSP_CAMERA_BlackWhiteConfig()
bcostm 6:e1d9da7fe856 31 - BSP_CAMERA_ColorEffectConfig()
bcostm 6:e1d9da7fe856 32 @endverbatim
bcostm 6:e1d9da7fe856 33 ******************************************************************************
bcostm 6:e1d9da7fe856 34 * @attention
bcostm 6:e1d9da7fe856 35 *
bcostm 6:e1d9da7fe856 36 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
bcostm 6:e1d9da7fe856 37 *
bcostm 6:e1d9da7fe856 38 * Redistribution and use in source and binary forms, with or without modification,
bcostm 6:e1d9da7fe856 39 * are permitted provided that the following conditions are met:
bcostm 6:e1d9da7fe856 40 * 1. Redistributions of source code must retain the above copyright notice,
bcostm 6:e1d9da7fe856 41 * this list of conditions and the following disclaimer.
bcostm 6:e1d9da7fe856 42 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 6:e1d9da7fe856 43 * this list of conditions and the following disclaimer in the documentation
bcostm 6:e1d9da7fe856 44 * and/or other materials provided with the distribution.
bcostm 6:e1d9da7fe856 45 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bcostm 6:e1d9da7fe856 46 * may be used to endorse or promote products derived from this software
bcostm 6:e1d9da7fe856 47 * without specific prior written permission.
bcostm 6:e1d9da7fe856 48 *
bcostm 6:e1d9da7fe856 49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bcostm 6:e1d9da7fe856 50 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bcostm 6:e1d9da7fe856 51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bcostm 6:e1d9da7fe856 52 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bcostm 6:e1d9da7fe856 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bcostm 6:e1d9da7fe856 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bcostm 6:e1d9da7fe856 55 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bcostm 6:e1d9da7fe856 56 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bcostm 6:e1d9da7fe856 57 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bcostm 6:e1d9da7fe856 58 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 6:e1d9da7fe856 59 *
bcostm 6:e1d9da7fe856 60 ******************************************************************************
bcostm 6:e1d9da7fe856 61 */
bcostm 6:e1d9da7fe856 62
bcostm 6:e1d9da7fe856 63 /* Includes ------------------------------------------------------------------*/
bcostm 6:e1d9da7fe856 64 #include "stm32746g_discovery_camera.h"
bcostm 6:e1d9da7fe856 65 #include "stm32746g_discovery.h"
bcostm 6:e1d9da7fe856 66
Jerome Coutant 9:df2ea349c37a 67 void wait_ms(int ms); // MBED to replace HAL_Delay function
Jerome Coutant 9:df2ea349c37a 68
bcostm 6:e1d9da7fe856 69 /** @addtogroup BSP
bcostm 6:e1d9da7fe856 70 * @{
bcostm 6:e1d9da7fe856 71 */
bcostm 6:e1d9da7fe856 72
bcostm 6:e1d9da7fe856 73 /** @addtogroup STM32746G_DISCOVERY
bcostm 6:e1d9da7fe856 74 * @{
bcostm 6:e1d9da7fe856 75 */
bcostm 6:e1d9da7fe856 76
bcostm 6:e1d9da7fe856 77 /** @addtogroup STM32746G_DISCOVERY_CAMERA
bcostm 6:e1d9da7fe856 78 * @{
bcostm 6:e1d9da7fe856 79 */
bcostm 6:e1d9da7fe856 80
bcostm 6:e1d9da7fe856 81 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_TypesDefinitions STM32746G_DISCOVERY_CAMERA Private Types Definitions
bcostm 6:e1d9da7fe856 82 * @{
bcostm 6:e1d9da7fe856 83 */
bcostm 6:e1d9da7fe856 84 /**
bcostm 6:e1d9da7fe856 85 * @}
bcostm 6:e1d9da7fe856 86 */
bcostm 6:e1d9da7fe856 87
bcostm 6:e1d9da7fe856 88 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_Defines STM32746G_DISCOVERY_CAMERA Private Defines
bcostm 6:e1d9da7fe856 89 * @{
bcostm 6:e1d9da7fe856 90 */
bcostm 6:e1d9da7fe856 91 #define CAMERA_VGA_RES_X 640
bcostm 6:e1d9da7fe856 92 #define CAMERA_VGA_RES_Y 480
bcostm 6:e1d9da7fe856 93 #define CAMERA_480x272_RES_X 480
bcostm 6:e1d9da7fe856 94 #define CAMERA_480x272_RES_Y 272
bcostm 6:e1d9da7fe856 95 #define CAMERA_QVGA_RES_X 320
bcostm 6:e1d9da7fe856 96 #define CAMERA_QVGA_RES_Y 240
bcostm 6:e1d9da7fe856 97 #define CAMERA_QQVGA_RES_X 160
bcostm 6:e1d9da7fe856 98 #define CAMERA_QQVGA_RES_Y 120
bcostm 6:e1d9da7fe856 99 /**
bcostm 6:e1d9da7fe856 100 * @}
bcostm 6:e1d9da7fe856 101 */
bcostm 6:e1d9da7fe856 102
bcostm 6:e1d9da7fe856 103 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_Macros STM32746G_DISCOVERY_CAMERA Private Macros
bcostm 6:e1d9da7fe856 104 * @{
bcostm 6:e1d9da7fe856 105 */
bcostm 6:e1d9da7fe856 106 /**
bcostm 6:e1d9da7fe856 107 * @}
bcostm 6:e1d9da7fe856 108 */
bcostm 6:e1d9da7fe856 109
bcostm 6:e1d9da7fe856 110 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_Variables STM32746G_DISCOVERY_CAMERA Private Variables
bcostm 6:e1d9da7fe856 111 * @{
bcostm 6:e1d9da7fe856 112 */
bcostm 6:e1d9da7fe856 113 DCMI_HandleTypeDef hDcmiHandler;
bcostm 6:e1d9da7fe856 114 CAMERA_DrvTypeDef *camera_drv;
bcostm 6:e1d9da7fe856 115 /* Camera current resolution naming (QQVGA, VGA, ...) */
bcostm 6:e1d9da7fe856 116 static uint32_t CameraCurrentResolution;
bcostm 6:e1d9da7fe856 117
bcostm 6:e1d9da7fe856 118 /* Camera module I2C HW address */
bcostm 6:e1d9da7fe856 119 static uint32_t CameraHwAddress;
bcostm 6:e1d9da7fe856 120 /**
bcostm 6:e1d9da7fe856 121 * @}
bcostm 6:e1d9da7fe856 122 */
bcostm 6:e1d9da7fe856 123
bcostm 6:e1d9da7fe856 124 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_FunctionPrototypes STM32746G_DISCOVERY_CAMERA Private Function Prototypes
bcostm 6:e1d9da7fe856 125 * @{
bcostm 6:e1d9da7fe856 126 */
bcostm 6:e1d9da7fe856 127 static uint32_t GetSize(uint32_t resolution);
bcostm 6:e1d9da7fe856 128 /**
bcostm 6:e1d9da7fe856 129 * @}
bcostm 6:e1d9da7fe856 130 */
bcostm 6:e1d9da7fe856 131
bcostm 6:e1d9da7fe856 132 /** @defgroup STM32746G_DISCOVERY_CAMERA_Exported_Functions STM32746G_DISCOVERY_CAMERA Exported Functions
bcostm 6:e1d9da7fe856 133 * @{
bcostm 6:e1d9da7fe856 134 */
bcostm 6:e1d9da7fe856 135
bcostm 6:e1d9da7fe856 136 /**
bcostm 6:e1d9da7fe856 137 * @brief Initializes the camera.
bcostm 6:e1d9da7fe856 138 * @param Resolution : camera sensor requested resolution (x, y) : standard resolution
bcostm 6:e1d9da7fe856 139 * naming QQVGA, QVGA, VGA ...
bcostm 6:e1d9da7fe856 140 * @retval Camera status
bcostm 6:e1d9da7fe856 141 */
bcostm 6:e1d9da7fe856 142 uint8_t BSP_CAMERA_Init(uint32_t Resolution)
bcostm 6:e1d9da7fe856 143 {
bcostm 6:e1d9da7fe856 144 DCMI_HandleTypeDef *phdcmi;
bcostm 6:e1d9da7fe856 145 uint8_t status = CAMERA_ERROR;
bcostm 6:e1d9da7fe856 146
bcostm 6:e1d9da7fe856 147 /* Get the DCMI handle structure */
bcostm 6:e1d9da7fe856 148 phdcmi = &hDcmiHandler;
bcostm 6:e1d9da7fe856 149
bcostm 6:e1d9da7fe856 150 /*** Configures the DCMI to interface with the camera module ***/
bcostm 6:e1d9da7fe856 151 /* DCMI configuration */
bcostm 6:e1d9da7fe856 152 phdcmi->Init.CaptureRate = DCMI_CR_ALL_FRAME;
bcostm 6:e1d9da7fe856 153 phdcmi->Init.HSPolarity = DCMI_HSPOLARITY_LOW;
bcostm 6:e1d9da7fe856 154 phdcmi->Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
bcostm 6:e1d9da7fe856 155 phdcmi->Init.VSPolarity = DCMI_VSPOLARITY_HIGH;
bcostm 6:e1d9da7fe856 156 phdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
bcostm 6:e1d9da7fe856 157 phdcmi->Init.PCKPolarity = DCMI_PCKPOLARITY_RISING;
bcostm 6:e1d9da7fe856 158 phdcmi->Instance = DCMI;
bcostm 6:e1d9da7fe856 159
bcostm 6:e1d9da7fe856 160 /* Power up camera */
bcostm 6:e1d9da7fe856 161 BSP_CAMERA_PwrUp();
bcostm 6:e1d9da7fe856 162
bcostm 6:e1d9da7fe856 163 /* Read ID of Camera module via I2C */
bcostm 6:e1d9da7fe856 164 if(ov9655_ReadID(CAMERA_I2C_ADDRESS) == OV9655_ID)
bcostm 6:e1d9da7fe856 165 {
bcostm 6:e1d9da7fe856 166 /* Initialize the camera driver structure */
bcostm 6:e1d9da7fe856 167 camera_drv = &ov9655_drv;
bcostm 6:e1d9da7fe856 168 CameraHwAddress = CAMERA_I2C_ADDRESS;
bcostm 6:e1d9da7fe856 169
bcostm 6:e1d9da7fe856 170 /* DCMI Initialization */
bcostm 6:e1d9da7fe856 171 BSP_CAMERA_MspInit(&hDcmiHandler, NULL);
bcostm 6:e1d9da7fe856 172 HAL_DCMI_Init(phdcmi);
bcostm 6:e1d9da7fe856 173
bcostm 6:e1d9da7fe856 174 /* Camera Module Initialization via I2C to the wanted 'Resolution' */
bcostm 6:e1d9da7fe856 175 if (Resolution == CAMERA_R480x272)
bcostm 6:e1d9da7fe856 176 { /* For 480x272 resolution, the OV9655 sensor is set to VGA resolution
bcostm 6:e1d9da7fe856 177 * as OV9655 doesn't supports 480x272 resolution,
bcostm 6:e1d9da7fe856 178 * then DCMI is configured to output a 480x272 cropped window */
bcostm 6:e1d9da7fe856 179 camera_drv->Init(CameraHwAddress, CAMERA_R640x480);
bcostm 6:e1d9da7fe856 180 HAL_DCMI_ConfigCROP(phdcmi, /* Crop in the middle of the VGA picture */
bcostm 6:e1d9da7fe856 181 (CAMERA_VGA_RES_X - CAMERA_480x272_RES_X)/2,
bcostm 6:e1d9da7fe856 182 (CAMERA_VGA_RES_Y - CAMERA_480x272_RES_Y)/2,
bcostm 6:e1d9da7fe856 183 (CAMERA_480x272_RES_X * 2) - 1,
bcostm 6:e1d9da7fe856 184 CAMERA_480x272_RES_Y - 1);
bcostm 6:e1d9da7fe856 185 HAL_DCMI_EnableCROP(phdcmi);
bcostm 6:e1d9da7fe856 186 }
bcostm 6:e1d9da7fe856 187 else
bcostm 6:e1d9da7fe856 188 {
bcostm 6:e1d9da7fe856 189 camera_drv->Init(CameraHwAddress, Resolution);
bcostm 6:e1d9da7fe856 190 HAL_DCMI_DisableCROP(phdcmi);
bcostm 6:e1d9da7fe856 191 }
bcostm 6:e1d9da7fe856 192
bcostm 6:e1d9da7fe856 193 CameraCurrentResolution = Resolution;
bcostm 6:e1d9da7fe856 194
bcostm 6:e1d9da7fe856 195 /* Return CAMERA_OK status */
bcostm 6:e1d9da7fe856 196 status = CAMERA_OK;
bcostm 6:e1d9da7fe856 197 }
bcostm 6:e1d9da7fe856 198 else
bcostm 6:e1d9da7fe856 199 {
bcostm 6:e1d9da7fe856 200 /* Return CAMERA_NOT_SUPPORTED status */
bcostm 6:e1d9da7fe856 201 status = CAMERA_NOT_SUPPORTED;
bcostm 6:e1d9da7fe856 202 }
bcostm 6:e1d9da7fe856 203
bcostm 6:e1d9da7fe856 204 return status;
bcostm 6:e1d9da7fe856 205 }
bcostm 6:e1d9da7fe856 206
bcostm 6:e1d9da7fe856 207 /**
bcostm 6:e1d9da7fe856 208 * @brief DeInitializes the camera.
bcostm 6:e1d9da7fe856 209 * @retval Camera status
bcostm 6:e1d9da7fe856 210 */
bcostm 6:e1d9da7fe856 211 uint8_t BSP_CAMERA_DeInit(void)
bcostm 6:e1d9da7fe856 212 {
bcostm 6:e1d9da7fe856 213 hDcmiHandler.Instance = DCMI;
bcostm 6:e1d9da7fe856 214
bcostm 6:e1d9da7fe856 215 HAL_DCMI_DeInit(&hDcmiHandler);
bcostm 6:e1d9da7fe856 216 BSP_CAMERA_MspDeInit(&hDcmiHandler, NULL);
bcostm 6:e1d9da7fe856 217 return CAMERA_OK;
bcostm 6:e1d9da7fe856 218 }
bcostm 6:e1d9da7fe856 219
bcostm 6:e1d9da7fe856 220 /**
bcostm 6:e1d9da7fe856 221 * @brief Starts the camera capture in continuous mode.
bcostm 6:e1d9da7fe856 222 * @param buff: pointer to the camera output buffer
bcostm 6:e1d9da7fe856 223 * @retval None
bcostm 6:e1d9da7fe856 224 */
bcostm 6:e1d9da7fe856 225 void BSP_CAMERA_ContinuousStart(uint8_t *buff)
bcostm 6:e1d9da7fe856 226 {
bcostm 6:e1d9da7fe856 227 /* Start the camera capture */
bcostm 6:e1d9da7fe856 228 HAL_DCMI_Start_DMA(&hDcmiHandler, DCMI_MODE_CONTINUOUS, (uint32_t)buff, GetSize(CameraCurrentResolution));
bcostm 6:e1d9da7fe856 229 }
bcostm 6:e1d9da7fe856 230
bcostm 6:e1d9da7fe856 231 /**
bcostm 6:e1d9da7fe856 232 * @brief Starts the camera capture in snapshot mode.
bcostm 6:e1d9da7fe856 233 * @param buff: pointer to the camera output buffer
bcostm 6:e1d9da7fe856 234 * @retval None
bcostm 6:e1d9da7fe856 235 */
bcostm 6:e1d9da7fe856 236 void BSP_CAMERA_SnapshotStart(uint8_t *buff)
bcostm 6:e1d9da7fe856 237 {
bcostm 6:e1d9da7fe856 238 /* Start the camera capture */
bcostm 6:e1d9da7fe856 239 HAL_DCMI_Start_DMA(&hDcmiHandler, DCMI_MODE_SNAPSHOT, (uint32_t)buff, GetSize(CameraCurrentResolution));
bcostm 6:e1d9da7fe856 240 }
bcostm 6:e1d9da7fe856 241
bcostm 6:e1d9da7fe856 242 /**
bcostm 6:e1d9da7fe856 243 * @brief Suspend the CAMERA capture
bcostm 6:e1d9da7fe856 244 * @retval None
bcostm 6:e1d9da7fe856 245 */
bcostm 6:e1d9da7fe856 246 void BSP_CAMERA_Suspend(void)
bcostm 6:e1d9da7fe856 247 {
bcostm 6:e1d9da7fe856 248 /* Suspend the Camera Capture */
bcostm 6:e1d9da7fe856 249 HAL_DCMI_Suspend(&hDcmiHandler);
bcostm 6:e1d9da7fe856 250 }
bcostm 6:e1d9da7fe856 251
bcostm 6:e1d9da7fe856 252 /**
bcostm 6:e1d9da7fe856 253 * @brief Resume the CAMERA capture
bcostm 6:e1d9da7fe856 254 * @retval None
bcostm 6:e1d9da7fe856 255 */
bcostm 6:e1d9da7fe856 256 void BSP_CAMERA_Resume(void)
bcostm 6:e1d9da7fe856 257 {
bcostm 6:e1d9da7fe856 258 /* Start the Camera Capture */
bcostm 6:e1d9da7fe856 259 HAL_DCMI_Resume(&hDcmiHandler);
bcostm 6:e1d9da7fe856 260 }
bcostm 6:e1d9da7fe856 261
bcostm 6:e1d9da7fe856 262 /**
bcostm 6:e1d9da7fe856 263 * @brief Stop the CAMERA capture
bcostm 6:e1d9da7fe856 264 * @retval Camera status
bcostm 6:e1d9da7fe856 265 */
bcostm 6:e1d9da7fe856 266 uint8_t BSP_CAMERA_Stop(void)
bcostm 6:e1d9da7fe856 267 {
bcostm 6:e1d9da7fe856 268 uint8_t status = CAMERA_ERROR;
bcostm 6:e1d9da7fe856 269
bcostm 6:e1d9da7fe856 270 if(HAL_DCMI_Stop(&hDcmiHandler) == HAL_OK)
bcostm 6:e1d9da7fe856 271 {
bcostm 6:e1d9da7fe856 272 status = CAMERA_OK;
bcostm 6:e1d9da7fe856 273 }
bcostm 6:e1d9da7fe856 274
bcostm 6:e1d9da7fe856 275 /* Set Camera in Power Down */
bcostm 6:e1d9da7fe856 276 BSP_CAMERA_PwrDown();
bcostm 6:e1d9da7fe856 277
bcostm 6:e1d9da7fe856 278 return status;
bcostm 6:e1d9da7fe856 279 }
bcostm 6:e1d9da7fe856 280
bcostm 6:e1d9da7fe856 281 /**
bcostm 6:e1d9da7fe856 282 * @brief CANERA power up
bcostm 6:e1d9da7fe856 283 * @retval None
bcostm 6:e1d9da7fe856 284 */
bcostm 6:e1d9da7fe856 285 void BSP_CAMERA_PwrUp(void)
bcostm 6:e1d9da7fe856 286 {
bcostm 6:e1d9da7fe856 287 GPIO_InitTypeDef gpio_init_structure;
bcostm 6:e1d9da7fe856 288
bcostm 6:e1d9da7fe856 289 /* Enable GPIO clock */
bcostm 6:e1d9da7fe856 290 __HAL_RCC_GPIOH_CLK_ENABLE();
bcostm 6:e1d9da7fe856 291
bcostm 6:e1d9da7fe856 292 /*** Configure the GPIO ***/
bcostm 6:e1d9da7fe856 293 /* Configure DCMI GPIO as alternate function */
bcostm 6:e1d9da7fe856 294 gpio_init_structure.Pin = GPIO_PIN_13;
bcostm 6:e1d9da7fe856 295 gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
bcostm 6:e1d9da7fe856 296 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 6:e1d9da7fe856 297 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
bcostm 6:e1d9da7fe856 298 HAL_GPIO_Init(GPIOH, &gpio_init_structure);
bcostm 6:e1d9da7fe856 299
bcostm 6:e1d9da7fe856 300 /* De-assert the camera POWER_DOWN pin (active high) */
bcostm 6:e1d9da7fe856 301 HAL_GPIO_WritePin(GPIOH, GPIO_PIN_13, GPIO_PIN_RESET);
bcostm 6:e1d9da7fe856 302
Jerome Coutant 9:df2ea349c37a 303 wait_ms(3); /* POWER_DOWN de-asserted during 3ms */
bcostm 6:e1d9da7fe856 304 }
bcostm 6:e1d9da7fe856 305
bcostm 6:e1d9da7fe856 306 /**
bcostm 6:e1d9da7fe856 307 * @brief CAMERA power down
bcostm 6:e1d9da7fe856 308 * @retval None
bcostm 6:e1d9da7fe856 309 */
bcostm 6:e1d9da7fe856 310 void BSP_CAMERA_PwrDown(void)
bcostm 6:e1d9da7fe856 311 {
bcostm 6:e1d9da7fe856 312 GPIO_InitTypeDef gpio_init_structure;
bcostm 6:e1d9da7fe856 313
bcostm 6:e1d9da7fe856 314 /* Enable GPIO clock */
bcostm 6:e1d9da7fe856 315 __HAL_RCC_GPIOH_CLK_ENABLE();
bcostm 6:e1d9da7fe856 316
bcostm 6:e1d9da7fe856 317 /*** Configure the GPIO ***/
bcostm 6:e1d9da7fe856 318 /* Configure DCMI GPIO as alternate function */
bcostm 6:e1d9da7fe856 319 gpio_init_structure.Pin = GPIO_PIN_13;
bcostm 6:e1d9da7fe856 320 gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
bcostm 6:e1d9da7fe856 321 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 6:e1d9da7fe856 322 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
bcostm 6:e1d9da7fe856 323 HAL_GPIO_Init(GPIOH, &gpio_init_structure);
bcostm 6:e1d9da7fe856 324
bcostm 6:e1d9da7fe856 325 /* Assert the camera POWER_DOWN pin (active high) */
bcostm 6:e1d9da7fe856 326 HAL_GPIO_WritePin(GPIOH, GPIO_PIN_13, GPIO_PIN_SET);
bcostm 6:e1d9da7fe856 327 }
bcostm 6:e1d9da7fe856 328
bcostm 6:e1d9da7fe856 329 /**
bcostm 6:e1d9da7fe856 330 * @brief Configures the camera contrast and brightness.
bcostm 6:e1d9da7fe856 331 * @param contrast_level: Contrast level
bcostm 6:e1d9da7fe856 332 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 333 * @arg CAMERA_CONTRAST_LEVEL4: for contrast +2
bcostm 6:e1d9da7fe856 334 * @arg CAMERA_CONTRAST_LEVEL3: for contrast +1
bcostm 6:e1d9da7fe856 335 * @arg CAMERA_CONTRAST_LEVEL2: for contrast 0
bcostm 6:e1d9da7fe856 336 * @arg CAMERA_CONTRAST_LEVEL1: for contrast -1
bcostm 6:e1d9da7fe856 337 * @arg CAMERA_CONTRAST_LEVEL0: for contrast -2
bcostm 6:e1d9da7fe856 338 * @param brightness_level: Contrast level
bcostm 6:e1d9da7fe856 339 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 340 * @arg CAMERA_BRIGHTNESS_LEVEL4: for brightness +2
bcostm 6:e1d9da7fe856 341 * @arg CAMERA_BRIGHTNESS_LEVEL3: for brightness +1
bcostm 6:e1d9da7fe856 342 * @arg CAMERA_BRIGHTNESS_LEVEL2: for brightness 0
bcostm 6:e1d9da7fe856 343 * @arg CAMERA_BRIGHTNESS_LEVEL1: for brightness -1
bcostm 6:e1d9da7fe856 344 * @arg CAMERA_BRIGHTNESS_LEVEL0: for brightness -2
bcostm 6:e1d9da7fe856 345 * @retval None
bcostm 6:e1d9da7fe856 346 */
bcostm 6:e1d9da7fe856 347 void BSP_CAMERA_ContrastBrightnessConfig(uint32_t contrast_level, uint32_t brightness_level)
bcostm 6:e1d9da7fe856 348 {
bcostm 6:e1d9da7fe856 349 if(camera_drv->Config != NULL)
bcostm 6:e1d9da7fe856 350 {
bcostm 6:e1d9da7fe856 351 camera_drv->Config(CameraHwAddress, CAMERA_CONTRAST_BRIGHTNESS, contrast_level, brightness_level);
bcostm 6:e1d9da7fe856 352 }
bcostm 6:e1d9da7fe856 353 }
bcostm 6:e1d9da7fe856 354
bcostm 6:e1d9da7fe856 355 /**
bcostm 6:e1d9da7fe856 356 * @brief Configures the camera white balance.
bcostm 6:e1d9da7fe856 357 * @param Mode: black_white mode
bcostm 6:e1d9da7fe856 358 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 359 * @arg CAMERA_BLACK_WHITE_BW
bcostm 6:e1d9da7fe856 360 * @arg CAMERA_BLACK_WHITE_NEGATIVE
bcostm 6:e1d9da7fe856 361 * @arg CAMERA_BLACK_WHITE_BW_NEGATIVE
bcostm 6:e1d9da7fe856 362 * @arg CAMERA_BLACK_WHITE_NORMAL
bcostm 6:e1d9da7fe856 363 * @retval None
bcostm 6:e1d9da7fe856 364 */
bcostm 6:e1d9da7fe856 365 void BSP_CAMERA_BlackWhiteConfig(uint32_t Mode)
bcostm 6:e1d9da7fe856 366 {
bcostm 6:e1d9da7fe856 367 if(camera_drv->Config != NULL)
bcostm 6:e1d9da7fe856 368 {
bcostm 6:e1d9da7fe856 369 camera_drv->Config(CameraHwAddress, CAMERA_BLACK_WHITE, Mode, 0);
bcostm 6:e1d9da7fe856 370 }
bcostm 6:e1d9da7fe856 371 }
bcostm 6:e1d9da7fe856 372
bcostm 6:e1d9da7fe856 373 /**
bcostm 6:e1d9da7fe856 374 * @brief Configures the camera color effect.
bcostm 6:e1d9da7fe856 375 * @param Effect: Color effect
bcostm 6:e1d9da7fe856 376 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 377 * @arg CAMERA_COLOR_EFFECT_ANTIQUE
bcostm 6:e1d9da7fe856 378 * @arg CAMERA_COLOR_EFFECT_BLUE
bcostm 6:e1d9da7fe856 379 * @arg CAMERA_COLOR_EFFECT_GREEN
bcostm 6:e1d9da7fe856 380 * @arg CAMERA_COLOR_EFFECT_RED
bcostm 6:e1d9da7fe856 381 * @retval None
bcostm 6:e1d9da7fe856 382 */
bcostm 6:e1d9da7fe856 383 void BSP_CAMERA_ColorEffectConfig(uint32_t Effect)
bcostm 6:e1d9da7fe856 384 {
bcostm 6:e1d9da7fe856 385 if(camera_drv->Config != NULL)
bcostm 6:e1d9da7fe856 386 {
bcostm 6:e1d9da7fe856 387 camera_drv->Config(CameraHwAddress, CAMERA_COLOR_EFFECT, Effect, 0);
bcostm 6:e1d9da7fe856 388 }
bcostm 6:e1d9da7fe856 389 }
bcostm 6:e1d9da7fe856 390
njeffrie 10:b70ba9b9345e 391
njeffrie 10:b70ba9b9345e 392 /**
njeffrie 10:b70ba9b9345e 393 * @brief Handles DCMI interrupt request.
njeffrie 10:b70ba9b9345e 394 * @retval None
njeffrie 10:b70ba9b9345e 395 */
njeffrie 10:b70ba9b9345e 396 void BSP_CAMERA_IRQHandler(void)
njeffrie 10:b70ba9b9345e 397 {
njeffrie 10:b70ba9b9345e 398 HAL_DCMI_IRQHandler(&hDcmiHandler);
njeffrie 10:b70ba9b9345e 399 }
njeffrie 10:b70ba9b9345e 400
njeffrie 10:b70ba9b9345e 401 /**
njeffrie 10:b70ba9b9345e 402 * @brief Handles DMA interrupt request.
njeffrie 10:b70ba9b9345e 403 * @retval None
njeffrie 10:b70ba9b9345e 404 */
njeffrie 10:b70ba9b9345e 405 void BSP_CAMERA_DMA_IRQHandler(void)
njeffrie 10:b70ba9b9345e 406 {
njeffrie 10:b70ba9b9345e 407 HAL_DMA_IRQHandler(hDcmiHandler.DMA_Handle);
njeffrie 10:b70ba9b9345e 408 }
njeffrie 10:b70ba9b9345e 409
bcostm 6:e1d9da7fe856 410 /**
bcostm 6:e1d9da7fe856 411 * @brief Get the capture size in pixels unit.
bcostm 6:e1d9da7fe856 412 * @param resolution: the current resolution.
bcostm 6:e1d9da7fe856 413 * @retval capture size in pixels unit.
bcostm 6:e1d9da7fe856 414 */
bcostm 6:e1d9da7fe856 415 static uint32_t GetSize(uint32_t resolution)
bcostm 6:e1d9da7fe856 416 {
bcostm 6:e1d9da7fe856 417 uint32_t size = 0;
bcostm 6:e1d9da7fe856 418
bcostm 6:e1d9da7fe856 419 /* Get capture size */
bcostm 6:e1d9da7fe856 420 switch (resolution)
bcostm 6:e1d9da7fe856 421 {
bcostm 6:e1d9da7fe856 422 case CAMERA_R160x120:
bcostm 6:e1d9da7fe856 423 {
bcostm 6:e1d9da7fe856 424 size = 0x2580;
bcostm 6:e1d9da7fe856 425 }
bcostm 6:e1d9da7fe856 426 break;
bcostm 6:e1d9da7fe856 427 case CAMERA_R320x240:
bcostm 6:e1d9da7fe856 428 {
bcostm 6:e1d9da7fe856 429 size = 0x9600;
bcostm 6:e1d9da7fe856 430 }
bcostm 6:e1d9da7fe856 431 break;
bcostm 6:e1d9da7fe856 432 case CAMERA_R480x272:
bcostm 6:e1d9da7fe856 433 {
bcostm 6:e1d9da7fe856 434 size = 0xFF00;
bcostm 6:e1d9da7fe856 435 }
bcostm 6:e1d9da7fe856 436 break;
bcostm 6:e1d9da7fe856 437 case CAMERA_R640x480:
bcostm 6:e1d9da7fe856 438 {
bcostm 6:e1d9da7fe856 439 size = 0x25800;
bcostm 6:e1d9da7fe856 440 }
bcostm 6:e1d9da7fe856 441 break;
bcostm 6:e1d9da7fe856 442 default:
bcostm 6:e1d9da7fe856 443 {
bcostm 6:e1d9da7fe856 444 break;
bcostm 6:e1d9da7fe856 445 }
bcostm 6:e1d9da7fe856 446 }
bcostm 6:e1d9da7fe856 447
bcostm 6:e1d9da7fe856 448 return size;
bcostm 6:e1d9da7fe856 449 }
bcostm 6:e1d9da7fe856 450
bcostm 6:e1d9da7fe856 451 /**
bcostm 6:e1d9da7fe856 452 * @brief Initializes the DCMI MSP.
bcostm 6:e1d9da7fe856 453 * @param hdcmi: HDMI handle
bcostm 6:e1d9da7fe856 454 * @param Params
bcostm 6:e1d9da7fe856 455 * @retval None
bcostm 6:e1d9da7fe856 456 */
bcostm 6:e1d9da7fe856 457 __weak void BSP_CAMERA_MspInit(DCMI_HandleTypeDef *hdcmi, void *Params)
bcostm 6:e1d9da7fe856 458 {
bcostm 6:e1d9da7fe856 459 static DMA_HandleTypeDef hdma_handler;
bcostm 6:e1d9da7fe856 460 GPIO_InitTypeDef gpio_init_structure;
bcostm 6:e1d9da7fe856 461
bcostm 6:e1d9da7fe856 462 /*** Enable peripherals and GPIO clocks ***/
bcostm 6:e1d9da7fe856 463 /* Enable DCMI clock */
bcostm 6:e1d9da7fe856 464 __HAL_RCC_DCMI_CLK_ENABLE();
bcostm 6:e1d9da7fe856 465
bcostm 6:e1d9da7fe856 466 /* Enable DMA2 clock */
bcostm 6:e1d9da7fe856 467 __HAL_RCC_DMA2_CLK_ENABLE();
bcostm 6:e1d9da7fe856 468
bcostm 6:e1d9da7fe856 469 /* Enable GPIO clocks */
bcostm 6:e1d9da7fe856 470 __HAL_RCC_GPIOA_CLK_ENABLE();
bcostm 6:e1d9da7fe856 471 __HAL_RCC_GPIOD_CLK_ENABLE();
bcostm 6:e1d9da7fe856 472 __HAL_RCC_GPIOE_CLK_ENABLE();
bcostm 6:e1d9da7fe856 473 __HAL_RCC_GPIOG_CLK_ENABLE();
bcostm 6:e1d9da7fe856 474 __HAL_RCC_GPIOH_CLK_ENABLE();
bcostm 6:e1d9da7fe856 475
bcostm 6:e1d9da7fe856 476 /*** Configure the GPIO ***/
bcostm 6:e1d9da7fe856 477 /* Configure DCMI GPIO as alternate function */
bcostm 6:e1d9da7fe856 478 gpio_init_structure.Pin = GPIO_PIN_4 | GPIO_PIN_6;
bcostm 6:e1d9da7fe856 479 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
bcostm 6:e1d9da7fe856 480 gpio_init_structure.Pull = GPIO_PULLUP;
bcostm 6:e1d9da7fe856 481 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
bcostm 6:e1d9da7fe856 482 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
bcostm 6:e1d9da7fe856 483 HAL_GPIO_Init(GPIOA, &gpio_init_structure);
bcostm 6:e1d9da7fe856 484
bcostm 6:e1d9da7fe856 485 gpio_init_structure.Pin = GPIO_PIN_3;
bcostm 6:e1d9da7fe856 486 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
bcostm 6:e1d9da7fe856 487 gpio_init_structure.Pull = GPIO_PULLUP;
bcostm 6:e1d9da7fe856 488 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
bcostm 6:e1d9da7fe856 489 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
bcostm 6:e1d9da7fe856 490 HAL_GPIO_Init(GPIOD, &gpio_init_structure);
bcostm 6:e1d9da7fe856 491
bcostm 6:e1d9da7fe856 492 gpio_init_structure.Pin = GPIO_PIN_5 | GPIO_PIN_6;
bcostm 6:e1d9da7fe856 493 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
bcostm 6:e1d9da7fe856 494 gpio_init_structure.Pull = GPIO_PULLUP;
bcostm 6:e1d9da7fe856 495 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
bcostm 6:e1d9da7fe856 496 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
bcostm 6:e1d9da7fe856 497 HAL_GPIO_Init(GPIOE, &gpio_init_structure);
bcostm 6:e1d9da7fe856 498
bcostm 6:e1d9da7fe856 499 gpio_init_structure.Pin = GPIO_PIN_9;
bcostm 6:e1d9da7fe856 500 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
bcostm 6:e1d9da7fe856 501 gpio_init_structure.Pull = GPIO_PULLUP;
bcostm 6:e1d9da7fe856 502 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
bcostm 6:e1d9da7fe856 503 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
bcostm 6:e1d9da7fe856 504 HAL_GPIO_Init(GPIOG, &gpio_init_structure);
bcostm 6:e1d9da7fe856 505
bcostm 6:e1d9da7fe856 506 gpio_init_structure.Pin = GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 |\
bcostm 6:e1d9da7fe856 507 GPIO_PIN_12 | GPIO_PIN_14;
bcostm 6:e1d9da7fe856 508 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
bcostm 6:e1d9da7fe856 509 gpio_init_structure.Pull = GPIO_PULLUP;
bcostm 6:e1d9da7fe856 510 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
bcostm 6:e1d9da7fe856 511 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
bcostm 6:e1d9da7fe856 512 HAL_GPIO_Init(GPIOH, &gpio_init_structure);
bcostm 6:e1d9da7fe856 513
bcostm 6:e1d9da7fe856 514 /*** Configure the DMA ***/
bcostm 6:e1d9da7fe856 515 /* Set the parameters to be configured */
bcostm 6:e1d9da7fe856 516 hdma_handler.Init.Channel = DMA_CHANNEL_1;
bcostm 6:e1d9da7fe856 517 hdma_handler.Init.Direction = DMA_PERIPH_TO_MEMORY;
bcostm 6:e1d9da7fe856 518 hdma_handler.Init.PeriphInc = DMA_PINC_DISABLE;
bcostm 6:e1d9da7fe856 519 hdma_handler.Init.MemInc = DMA_MINC_ENABLE;
bcostm 6:e1d9da7fe856 520 hdma_handler.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
bcostm 6:e1d9da7fe856 521 hdma_handler.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
bcostm 6:e1d9da7fe856 522 hdma_handler.Init.Mode = DMA_CIRCULAR;
bcostm 6:e1d9da7fe856 523 hdma_handler.Init.Priority = DMA_PRIORITY_HIGH;
bcostm 6:e1d9da7fe856 524 hdma_handler.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
bcostm 6:e1d9da7fe856 525 hdma_handler.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
bcostm 6:e1d9da7fe856 526 hdma_handler.Init.MemBurst = DMA_MBURST_SINGLE;
bcostm 6:e1d9da7fe856 527 hdma_handler.Init.PeriphBurst = DMA_PBURST_SINGLE;
bcostm 6:e1d9da7fe856 528
bcostm 6:e1d9da7fe856 529 hdma_handler.Instance = DMA2_Stream1;
bcostm 6:e1d9da7fe856 530
bcostm 6:e1d9da7fe856 531 /* Associate the initialized DMA handle to the DCMI handle */
bcostm 6:e1d9da7fe856 532 __HAL_LINKDMA(hdcmi, DMA_Handle, hdma_handler);
bcostm 6:e1d9da7fe856 533
bcostm 6:e1d9da7fe856 534 /*** Configure the NVIC for DCMI and DMA ***/
bcostm 6:e1d9da7fe856 535 /* NVIC configuration for DCMI transfer complete interrupt */
bcostm 6:e1d9da7fe856 536 HAL_NVIC_SetPriority(DCMI_IRQn, 0x0F, 0);
bcostm 6:e1d9da7fe856 537 HAL_NVIC_EnableIRQ(DCMI_IRQn);
bcostm 6:e1d9da7fe856 538
bcostm 6:e1d9da7fe856 539 /* NVIC configuration for DMA2D transfer complete interrupt */
bcostm 6:e1d9da7fe856 540 HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 0x0F, 0);
bcostm 6:e1d9da7fe856 541 HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
bcostm 6:e1d9da7fe856 542
bcostm 6:e1d9da7fe856 543 /* Configure the DMA stream */
bcostm 6:e1d9da7fe856 544 HAL_DMA_Init(hdcmi->DMA_Handle);
bcostm 6:e1d9da7fe856 545 }
bcostm 6:e1d9da7fe856 546
bcostm 6:e1d9da7fe856 547
bcostm 6:e1d9da7fe856 548 /**
bcostm 6:e1d9da7fe856 549 * @brief DeInitializes the DCMI MSP.
bcostm 6:e1d9da7fe856 550 * @param hdcmi: HDMI handle
bcostm 6:e1d9da7fe856 551 * @param Params
bcostm 6:e1d9da7fe856 552 * @retval None
bcostm 6:e1d9da7fe856 553 */
bcostm 6:e1d9da7fe856 554 __weak void BSP_CAMERA_MspDeInit(DCMI_HandleTypeDef *hdcmi, void *Params)
bcostm 6:e1d9da7fe856 555 {
bcostm 6:e1d9da7fe856 556 /* Disable NVIC for DCMI transfer complete interrupt */
bcostm 6:e1d9da7fe856 557 HAL_NVIC_DisableIRQ(DCMI_IRQn);
bcostm 6:e1d9da7fe856 558
bcostm 6:e1d9da7fe856 559 /* Disable NVIC for DMA2 transfer complete interrupt */
bcostm 6:e1d9da7fe856 560 HAL_NVIC_DisableIRQ(DMA2_Stream1_IRQn);
bcostm 6:e1d9da7fe856 561
bcostm 6:e1d9da7fe856 562 /* Configure the DMA stream */
bcostm 6:e1d9da7fe856 563 HAL_DMA_DeInit(hdcmi->DMA_Handle);
bcostm 6:e1d9da7fe856 564
bcostm 6:e1d9da7fe856 565 /* Disable DCMI clock */
bcostm 6:e1d9da7fe856 566 __HAL_RCC_DCMI_CLK_DISABLE();
bcostm 6:e1d9da7fe856 567
bcostm 6:e1d9da7fe856 568 /* GPIO pins clock and DMA clock can be shut down in the application
bcostm 6:e1d9da7fe856 569 by surcharging this __weak function */
bcostm 6:e1d9da7fe856 570 }
bcostm 6:e1d9da7fe856 571
bcostm 6:e1d9da7fe856 572 /**
bcostm 6:e1d9da7fe856 573 * @brief Line event callback
bcostm 6:e1d9da7fe856 574 * @param hdcmi: pointer to the DCMI handle
bcostm 6:e1d9da7fe856 575 * @retval None
bcostm 6:e1d9da7fe856 576 */
bcostm 6:e1d9da7fe856 577 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi)
bcostm 6:e1d9da7fe856 578 {
bcostm 6:e1d9da7fe856 579 BSP_CAMERA_LineEventCallback();
bcostm 6:e1d9da7fe856 580 }
bcostm 6:e1d9da7fe856 581
bcostm 6:e1d9da7fe856 582 /**
bcostm 6:e1d9da7fe856 583 * @brief Line Event callback.
bcostm 6:e1d9da7fe856 584 * @retval None
bcostm 6:e1d9da7fe856 585 */
bcostm 6:e1d9da7fe856 586 __weak void BSP_CAMERA_LineEventCallback(void)
bcostm 6:e1d9da7fe856 587 {
bcostm 6:e1d9da7fe856 588 /* NOTE : This function Should not be modified, when the callback is needed,
bcostm 6:e1d9da7fe856 589 the HAL_DCMI_LineEventCallback could be implemented in the user file
bcostm 6:e1d9da7fe856 590 */
bcostm 6:e1d9da7fe856 591 }
bcostm 6:e1d9da7fe856 592
bcostm 6:e1d9da7fe856 593 /**
bcostm 6:e1d9da7fe856 594 * @brief VSYNC event callback
bcostm 6:e1d9da7fe856 595 * @param hdcmi: pointer to the DCMI handle
bcostm 6:e1d9da7fe856 596 * @retval None
bcostm 6:e1d9da7fe856 597 */
bcostm 6:e1d9da7fe856 598 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi)
bcostm 6:e1d9da7fe856 599 {
bcostm 6:e1d9da7fe856 600 BSP_CAMERA_VsyncEventCallback();
bcostm 6:e1d9da7fe856 601 }
bcostm 6:e1d9da7fe856 602
bcostm 6:e1d9da7fe856 603 /**
bcostm 6:e1d9da7fe856 604 * @brief VSYNC Event callback.
bcostm 6:e1d9da7fe856 605 * @retval None
bcostm 6:e1d9da7fe856 606 */
bcostm 6:e1d9da7fe856 607 __weak void BSP_CAMERA_VsyncEventCallback(void)
bcostm 6:e1d9da7fe856 608 {
bcostm 6:e1d9da7fe856 609 /* NOTE : This function Should not be modified, when the callback is needed,
bcostm 6:e1d9da7fe856 610 the HAL_DCMI_VsyncEventCallback could be implemented in the user file
bcostm 6:e1d9da7fe856 611 */
bcostm 6:e1d9da7fe856 612 }
bcostm 6:e1d9da7fe856 613
bcostm 6:e1d9da7fe856 614 /**
bcostm 6:e1d9da7fe856 615 * @brief Frame event callback
bcostm 6:e1d9da7fe856 616 * @param hdcmi: pointer to the DCMI handle
bcostm 6:e1d9da7fe856 617 * @retval None
bcostm 6:e1d9da7fe856 618 */
bcostm 6:e1d9da7fe856 619 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
bcostm 6:e1d9da7fe856 620 {
bcostm 6:e1d9da7fe856 621 BSP_CAMERA_FrameEventCallback();
bcostm 6:e1d9da7fe856 622 }
bcostm 6:e1d9da7fe856 623
bcostm 6:e1d9da7fe856 624 /**
bcostm 6:e1d9da7fe856 625 * @brief Frame Event callback.
bcostm 6:e1d9da7fe856 626 * @retval None
bcostm 6:e1d9da7fe856 627 */
bcostm 6:e1d9da7fe856 628 __weak void BSP_CAMERA_FrameEventCallback(void)
bcostm 6:e1d9da7fe856 629 {
bcostm 6:e1d9da7fe856 630 /* NOTE : This function Should not be modified, when the callback is needed,
bcostm 6:e1d9da7fe856 631 the HAL_DCMI_FrameEventCallback could be implemented in the user file
bcostm 6:e1d9da7fe856 632 */
bcostm 6:e1d9da7fe856 633 }
bcostm 6:e1d9da7fe856 634
bcostm 6:e1d9da7fe856 635 /**
bcostm 6:e1d9da7fe856 636 * @brief Error callback
bcostm 6:e1d9da7fe856 637 * @param hdcmi: pointer to the DCMI handle
bcostm 6:e1d9da7fe856 638 * @retval None
bcostm 6:e1d9da7fe856 639 */
bcostm 6:e1d9da7fe856 640 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi)
bcostm 6:e1d9da7fe856 641 {
bcostm 6:e1d9da7fe856 642 BSP_CAMERA_ErrorCallback();
bcostm 6:e1d9da7fe856 643 }
bcostm 6:e1d9da7fe856 644
bcostm 6:e1d9da7fe856 645 /**
bcostm 6:e1d9da7fe856 646 * @brief Error callback.
bcostm 6:e1d9da7fe856 647 * @retval None
bcostm 6:e1d9da7fe856 648 */
bcostm 6:e1d9da7fe856 649 __weak void BSP_CAMERA_ErrorCallback(void)
bcostm 6:e1d9da7fe856 650 {
bcostm 6:e1d9da7fe856 651 /* NOTE : This function Should not be modified, when the callback is needed,
bcostm 6:e1d9da7fe856 652 the HAL_DCMI_ErrorCallback could be implemented in the user file
bcostm 6:e1d9da7fe856 653 */
bcostm 6:e1d9da7fe856 654 }
bcostm 6:e1d9da7fe856 655
bcostm 6:e1d9da7fe856 656 /**
bcostm 6:e1d9da7fe856 657 * @}
bcostm 6:e1d9da7fe856 658 */
bcostm 6:e1d9da7fe856 659
bcostm 6:e1d9da7fe856 660 /**
bcostm 6:e1d9da7fe856 661 * @}
bcostm 6:e1d9da7fe856 662 */
bcostm 6:e1d9da7fe856 663
bcostm 6:e1d9da7fe856 664 /**
bcostm 6:e1d9da7fe856 665 * @}
bcostm 6:e1d9da7fe856 666 */
bcostm 6:e1d9da7fe856 667
bcostm 6:e1d9da7fe856 668 /**
bcostm 6:e1d9da7fe856 669 * @}
bcostm 6:e1d9da7fe856 670 */
bcostm 6:e1d9da7fe856 671
bcostm 6:e1d9da7fe856 672 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/