BSP files for STM32H747I-Discovery Copy from ST Cube delivery

Dependents:   DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo

Committer:
Jerome Coutant
Date:
Wed Nov 06 11:32:01 2019 +0100
Revision:
3:bc403474b366
Parent:
0:146cf26a9bbb
Add PDM lib

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jerome Coutant 0:146cf26a9bbb 1 /**
Jerome Coutant 0:146cf26a9bbb 2 ******************************************************************************
Jerome Coutant 0:146cf26a9bbb 3 * @file stm32h747i_discovery.c
Jerome Coutant 0:146cf26a9bbb 4 * @author MCD Application Team
Jerome Coutant 0:146cf26a9bbb 5 * @brief This file includes the driver for Camera modules mounted on
Jerome Coutant 0:146cf26a9bbb 6 * STM32H747I-DISCOVERY board.
Jerome Coutant 0:146cf26a9bbb 7 ******************************************************************************
Jerome Coutant 0:146cf26a9bbb 8 * @attention
Jerome Coutant 0:146cf26a9bbb 9 *
Jerome Coutant 0:146cf26a9bbb 10 * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
Jerome Coutant 0:146cf26a9bbb 11 * All rights reserved.</center></h2>
Jerome Coutant 0:146cf26a9bbb 12 *
Jerome Coutant 0:146cf26a9bbb 13 * This software component is licensed by ST under BSD 3-Clause license,
Jerome Coutant 0:146cf26a9bbb 14 * the "License"; You may not use this file except in compliance with the
Jerome Coutant 0:146cf26a9bbb 15 * License. You may obtain a copy of the License at:
Jerome Coutant 0:146cf26a9bbb 16 * opensource.org/licenses/BSD-3-Clause
Jerome Coutant 0:146cf26a9bbb 17 *
Jerome Coutant 0:146cf26a9bbb 18 ******************************************************************************
Jerome Coutant 0:146cf26a9bbb 19 */
Jerome Coutant 0:146cf26a9bbb 20
Jerome Coutant 0:146cf26a9bbb 21 /* File Info: ------------------------------------------------------------------
Jerome Coutant 0:146cf26a9bbb 22 User NOTES
Jerome Coutant 0:146cf26a9bbb 23 1. How to use this driver:
Jerome Coutant 0:146cf26a9bbb 24 --------------------------
Jerome Coutant 0:146cf26a9bbb 25 - This driver is used to drive the camera.
Jerome Coutant 0:146cf26a9bbb 26 - The OV9655 component driver MUST be included with this driver.
Jerome Coutant 0:146cf26a9bbb 27
Jerome Coutant 0:146cf26a9bbb 28 2. Driver description:
Jerome Coutant 0:146cf26a9bbb 29 ---------------------
Jerome Coutant 0:146cf26a9bbb 30 + Initialization steps:
Jerome Coutant 0:146cf26a9bbb 31 o Initialize the camera using the BSP_CAMERA_Init() function.
Jerome Coutant 0:146cf26a9bbb 32 o Start the camera capture/snapshot using the CAMERA_Start() function.
Jerome Coutant 0:146cf26a9bbb 33 o Suspend, resume or stop the camera capture using the following functions:
Jerome Coutant 0:146cf26a9bbb 34 - BSP_CAMERA_Suspend()
Jerome Coutant 0:146cf26a9bbb 35 - BSP_CAMERA_Resume()
Jerome Coutant 0:146cf26a9bbb 36 - BSP_CAMERA_Stop()
Jerome Coutant 0:146cf26a9bbb 37
Jerome Coutant 0:146cf26a9bbb 38 + Options
Jerome Coutant 0:146cf26a9bbb 39 o Increase or decrease on the fly the brightness and/or contrast
Jerome Coutant 0:146cf26a9bbb 40 using the following function:
Jerome Coutant 0:146cf26a9bbb 41 - BSP_CAMERA_ContrastBrightnessConfig
Jerome Coutant 0:146cf26a9bbb 42 o Add a special effect on the fly using the following functions:
Jerome Coutant 0:146cf26a9bbb 43 - BSP_CAMERA_BlackWhiteConfig()
Jerome Coutant 0:146cf26a9bbb 44 - BSP_CAMERA_ColorEffectConfig()
Jerome Coutant 0:146cf26a9bbb 45
Jerome Coutant 0:146cf26a9bbb 46 ------------------------------------------------------------------------------*/
Jerome Coutant 0:146cf26a9bbb 47
Jerome Coutant 0:146cf26a9bbb 48 /* Includes ------------------------------------------------------------------*/
Jerome Coutant 0:146cf26a9bbb 49 #include "stm32h747i_discovery_camera.h"
Jerome Coutant 0:146cf26a9bbb 50
Jerome Coutant 0:146cf26a9bbb 51
Jerome Coutant 0:146cf26a9bbb 52 /** @addtogroup BSP
Jerome Coutant 0:146cf26a9bbb 53 * @{
Jerome Coutant 0:146cf26a9bbb 54 */
Jerome Coutant 0:146cf26a9bbb 55
Jerome Coutant 0:146cf26a9bbb 56 /** @addtogroup STM32H747I_DISCOVERY
Jerome Coutant 0:146cf26a9bbb 57 * @{
Jerome Coutant 0:146cf26a9bbb 58 */
Jerome Coutant 0:146cf26a9bbb 59
Jerome Coutant 0:146cf26a9bbb 60 /** @defgroup STM32H747I_DISCOVERY_CAMERA STM32H747I_DISCOVERY_CAMERA
Jerome Coutant 0:146cf26a9bbb 61 * @{
Jerome Coutant 0:146cf26a9bbb 62 */
Jerome Coutant 0:146cf26a9bbb 63
Jerome Coutant 0:146cf26a9bbb 64 /** @defgroup STM32H747I_DISCOVERY_CAMERA_Exported_Variables Exported Variables
Jerome Coutant 0:146cf26a9bbb 65 * @{
Jerome Coutant 0:146cf26a9bbb 66 */
Jerome Coutant 0:146cf26a9bbb 67 DCMI_HandleTypeDef hdcmi_discovery;
Jerome Coutant 0:146cf26a9bbb 68 CAMERA_DrvTypeDef *camera_drv;
Jerome Coutant 0:146cf26a9bbb 69 /**
Jerome Coutant 0:146cf26a9bbb 70 * @}
Jerome Coutant 0:146cf26a9bbb 71 */
Jerome Coutant 0:146cf26a9bbb 72
Jerome Coutant 0:146cf26a9bbb 73 /** @defgroup STM32H747I_DISCOVERY_CAMERA_Private_Variables Private Variables
Jerome Coutant 0:146cf26a9bbb 74 * @{
Jerome Coutant 0:146cf26a9bbb 75 */
Jerome Coutant 0:146cf26a9bbb 76 /* Camera current resolution naming (QQVGA, VGA, ...) */
Jerome Coutant 0:146cf26a9bbb 77 static uint32_t CameraCurrentResolution;
Jerome Coutant 0:146cf26a9bbb 78
Jerome Coutant 0:146cf26a9bbb 79 /* Camera image rotation on LCD Displayed frame buffer */
Jerome Coutant 0:146cf26a9bbb 80 uint32_t CameraRotation = CAMERA_ROTATION_INVALID;
Jerome Coutant 0:146cf26a9bbb 81
Jerome Coutant 0:146cf26a9bbb 82 /* Camera module I2C HW address */
Jerome Coutant 0:146cf26a9bbb 83 static uint32_t CameraHwAddress;
Jerome Coutant 0:146cf26a9bbb 84 /**
Jerome Coutant 0:146cf26a9bbb 85 * @}
Jerome Coutant 0:146cf26a9bbb 86 */
Jerome Coutant 0:146cf26a9bbb 87
Jerome Coutant 0:146cf26a9bbb 88 /** @defgroup STM32H747I_DISCOVERY_CAMERA_Private_FunctionPrototypes Private FunctionPrototypes
Jerome Coutant 0:146cf26a9bbb 89 * @{
Jerome Coutant 0:146cf26a9bbb 90 */
Jerome Coutant 0:146cf26a9bbb 91 static uint32_t GetSize(uint32_t Resolution);
Jerome Coutant 0:146cf26a9bbb 92 /**
Jerome Coutant 0:146cf26a9bbb 93 * @}
Jerome Coutant 0:146cf26a9bbb 94 */
Jerome Coutant 0:146cf26a9bbb 95
Jerome Coutant 0:146cf26a9bbb 96 /** @defgroup STM32H747I_DISCOVERY_CAMERA_Exported_Functions Exported Functions
Jerome Coutant 0:146cf26a9bbb 97 * @{
Jerome Coutant 0:146cf26a9bbb 98 */
Jerome Coutant 0:146cf26a9bbb 99
Jerome Coutant 0:146cf26a9bbb 100 /**
Jerome Coutant 0:146cf26a9bbb 101 * @brief Set Camera image rotation on LCD Displayed frame buffer.
Jerome Coutant 0:146cf26a9bbb 102 * @param rotation : uint32_t rotation of camera image in preview buffer sent to LCD
Jerome Coutant 0:146cf26a9bbb 103 * need to be of type Camera_ImageRotationTypeDef
Jerome Coutant 0:146cf26a9bbb 104 * @retval Camera status
Jerome Coutant 0:146cf26a9bbb 105 */
Jerome Coutant 0:146cf26a9bbb 106 uint8_t BSP_CAMERA_SetRotation(uint32_t rotation)
Jerome Coutant 0:146cf26a9bbb 107 {
Jerome Coutant 0:146cf26a9bbb 108 uint8_t status = CAMERA_ERROR;
Jerome Coutant 0:146cf26a9bbb 109
Jerome Coutant 0:146cf26a9bbb 110 if(rotation < CAMERA_ROTATION_INVALID)
Jerome Coutant 0:146cf26a9bbb 111 {
Jerome Coutant 0:146cf26a9bbb 112 /* Set Camera image rotation on LCD Displayed frame buffer */
Jerome Coutant 0:146cf26a9bbb 113 CameraRotation = rotation;
Jerome Coutant 0:146cf26a9bbb 114 status = CAMERA_OK;
Jerome Coutant 0:146cf26a9bbb 115 }
Jerome Coutant 0:146cf26a9bbb 116
Jerome Coutant 0:146cf26a9bbb 117 return status;
Jerome Coutant 0:146cf26a9bbb 118 }
Jerome Coutant 0:146cf26a9bbb 119
Jerome Coutant 0:146cf26a9bbb 120 /**
Jerome Coutant 0:146cf26a9bbb 121 * @brief Get Camera image rotation on LCD Displayed frame buffer.
Jerome Coutant 0:146cf26a9bbb 122 * @retval rotation : uint32_t value of type Camera_ImageRotationTypeDef
Jerome Coutant 0:146cf26a9bbb 123 */
Jerome Coutant 0:146cf26a9bbb 124 uint32_t BSP_CAMERA_GetRotation(void)
Jerome Coutant 0:146cf26a9bbb 125 {
Jerome Coutant 0:146cf26a9bbb 126 return(CameraRotation);
Jerome Coutant 0:146cf26a9bbb 127 }
Jerome Coutant 0:146cf26a9bbb 128
Jerome Coutant 0:146cf26a9bbb 129 /**
Jerome Coutant 0:146cf26a9bbb 130 * @brief Initializes the camera.
Jerome Coutant 0:146cf26a9bbb 131 * @param Resolution : camera sensor requested resolution (x, y) : standard resolution
Jerome Coutant 0:146cf26a9bbb 132 * naming QQVGA, QVGA, VGA ...
Jerome Coutant 0:146cf26a9bbb 133 * @retval Camera status
Jerome Coutant 0:146cf26a9bbb 134 */
Jerome Coutant 0:146cf26a9bbb 135 uint8_t BSP_CAMERA_Init(uint32_t Resolution)
Jerome Coutant 0:146cf26a9bbb 136 {
Jerome Coutant 0:146cf26a9bbb 137 DCMI_HandleTypeDef *phdcmi;
Jerome Coutant 0:146cf26a9bbb 138 uint8_t status = CAMERA_ERROR;
Jerome Coutant 0:146cf26a9bbb 139
Jerome Coutant 0:146cf26a9bbb 140 /* Get the DCMI handle structure */
Jerome Coutant 0:146cf26a9bbb 141 phdcmi = &hdcmi_discovery;
Jerome Coutant 0:146cf26a9bbb 142
Jerome Coutant 0:146cf26a9bbb 143 /*** Configures the DCMI to interface with the camera module ***/
Jerome Coutant 0:146cf26a9bbb 144 /* DCMI configuration */
Jerome Coutant 0:146cf26a9bbb 145 phdcmi->Init.CaptureRate = DCMI_CR_ALL_FRAME;
Jerome Coutant 0:146cf26a9bbb 146 phdcmi->Init.HSPolarity = DCMI_HSPOLARITY_LOW;
Jerome Coutant 0:146cf26a9bbb 147 phdcmi->Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
Jerome Coutant 0:146cf26a9bbb 148 phdcmi->Init.VSPolarity = DCMI_VSPOLARITY_HIGH;
Jerome Coutant 0:146cf26a9bbb 149 phdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
Jerome Coutant 0:146cf26a9bbb 150 phdcmi->Init.PCKPolarity = DCMI_PCKPOLARITY_RISING;
Jerome Coutant 0:146cf26a9bbb 151 phdcmi->Instance = DCMI;
Jerome Coutant 0:146cf26a9bbb 152
Jerome Coutant 0:146cf26a9bbb 153 /* Power up camera */
Jerome Coutant 0:146cf26a9bbb 154 BSP_CAMERA_PwrUp();
Jerome Coutant 0:146cf26a9bbb 155
Jerome Coutant 0:146cf26a9bbb 156 /* Read ID of Camera module via I2C */
Jerome Coutant 0:146cf26a9bbb 157 if(ov9655_ReadID(CAMERA_I2C_ADDRESS) == OV9655_ID)
Jerome Coutant 0:146cf26a9bbb 158 {
Jerome Coutant 0:146cf26a9bbb 159 /* Initialize the camera driver structure */
Jerome Coutant 0:146cf26a9bbb 160 camera_drv = &ov9655_drv;
Jerome Coutant 0:146cf26a9bbb 161 CameraHwAddress = CAMERA_I2C_ADDRESS;
Jerome Coutant 0:146cf26a9bbb 162
Jerome Coutant 0:146cf26a9bbb 163 /* DCMI Initialization */
Jerome Coutant 0:146cf26a9bbb 164 BSP_CAMERA_MspInit(&hdcmi_discovery, NULL);
Jerome Coutant 0:146cf26a9bbb 165 HAL_DCMI_Init(phdcmi);
Jerome Coutant 0:146cf26a9bbb 166
Jerome Coutant 0:146cf26a9bbb 167 /* Camera Module Initialization via I2C to the wanted 'Resolution' */
Jerome Coutant 0:146cf26a9bbb 168 if (Resolution == CAMERA_R480x272)
Jerome Coutant 0:146cf26a9bbb 169 { /* For 480x272 resolution, the OV9655 sensor is set to VGA resolution
Jerome Coutant 0:146cf26a9bbb 170 * as OV9655 doesn't supports 480x272 resolution,
Jerome Coutant 0:146cf26a9bbb 171 * then DCMI is configured to output a 480x272 cropped window */
Jerome Coutant 0:146cf26a9bbb 172 camera_drv->Init(CameraHwAddress, CAMERA_R640x480);
Jerome Coutant 0:146cf26a9bbb 173 HAL_DCMI_ConfigCROP(phdcmi, /* Crop in the middle of the VGA picture */
Jerome Coutant 0:146cf26a9bbb 174 (CAMERA_VGA_RES_X - CAMERA_480x272_RES_X)/2,
Jerome Coutant 0:146cf26a9bbb 175 (CAMERA_VGA_RES_Y - CAMERA_480x272_RES_Y)/2,
Jerome Coutant 0:146cf26a9bbb 176 (CAMERA_480x272_RES_X * 2) - 1,
Jerome Coutant 0:146cf26a9bbb 177 CAMERA_480x272_RES_Y - 1);
Jerome Coutant 0:146cf26a9bbb 178 HAL_DCMI_EnableCROP(phdcmi);
Jerome Coutant 0:146cf26a9bbb 179 }
Jerome Coutant 0:146cf26a9bbb 180 else
Jerome Coutant 0:146cf26a9bbb 181 {
Jerome Coutant 0:146cf26a9bbb 182 camera_drv->Init(CameraHwAddress, Resolution);
Jerome Coutant 0:146cf26a9bbb 183 HAL_DCMI_DisableCROP(phdcmi);
Jerome Coutant 0:146cf26a9bbb 184 }
Jerome Coutant 0:146cf26a9bbb 185
Jerome Coutant 0:146cf26a9bbb 186 CameraCurrentResolution = Resolution;
Jerome Coutant 0:146cf26a9bbb 187
Jerome Coutant 0:146cf26a9bbb 188 /* Return CAMERA_OK status */
Jerome Coutant 0:146cf26a9bbb 189 status = CAMERA_OK;
Jerome Coutant 0:146cf26a9bbb 190 }
Jerome Coutant 0:146cf26a9bbb 191 else
Jerome Coutant 0:146cf26a9bbb 192 {
Jerome Coutant 0:146cf26a9bbb 193 /* Return CAMERA_NOT_SUPPORTED status */
Jerome Coutant 0:146cf26a9bbb 194 status = CAMERA_NOT_SUPPORTED;
Jerome Coutant 0:146cf26a9bbb 195 }
Jerome Coutant 0:146cf26a9bbb 196
Jerome Coutant 0:146cf26a9bbb 197 return status;
Jerome Coutant 0:146cf26a9bbb 198 }
Jerome Coutant 0:146cf26a9bbb 199
Jerome Coutant 0:146cf26a9bbb 200
Jerome Coutant 0:146cf26a9bbb 201 /**
Jerome Coutant 0:146cf26a9bbb 202 * @brief DeInitializes the camera.
Jerome Coutant 0:146cf26a9bbb 203 * @retval Camera status
Jerome Coutant 0:146cf26a9bbb 204 */
Jerome Coutant 0:146cf26a9bbb 205 uint8_t BSP_CAMERA_DeInit(void)
Jerome Coutant 0:146cf26a9bbb 206 {
Jerome Coutant 0:146cf26a9bbb 207 hdcmi_discovery.Instance = DCMI;
Jerome Coutant 0:146cf26a9bbb 208
Jerome Coutant 0:146cf26a9bbb 209 HAL_DCMI_DeInit(&hdcmi_discovery);
Jerome Coutant 0:146cf26a9bbb 210 BSP_CAMERA_MspDeInit(&hdcmi_discovery, NULL);
Jerome Coutant 0:146cf26a9bbb 211 return CAMERA_OK;
Jerome Coutant 0:146cf26a9bbb 212 }
Jerome Coutant 0:146cf26a9bbb 213
Jerome Coutant 0:146cf26a9bbb 214 /**
Jerome Coutant 0:146cf26a9bbb 215 * @brief Starts the camera capture in continuous mode.
Jerome Coutant 0:146cf26a9bbb 216 * @param buff: pointer to the camera output buffer
Jerome Coutant 0:146cf26a9bbb 217 * @retval None
Jerome Coutant 0:146cf26a9bbb 218 */
Jerome Coutant 0:146cf26a9bbb 219 void BSP_CAMERA_ContinuousStart(uint8_t *buff)
Jerome Coutant 0:146cf26a9bbb 220 {
Jerome Coutant 0:146cf26a9bbb 221 /* Start the camera capture */
Jerome Coutant 0:146cf26a9bbb 222 HAL_DCMI_Start_DMA(&hdcmi_discovery, DCMI_MODE_CONTINUOUS, (uint32_t)buff, GetSize(CameraCurrentResolution));
Jerome Coutant 0:146cf26a9bbb 223 }
Jerome Coutant 0:146cf26a9bbb 224
Jerome Coutant 0:146cf26a9bbb 225 /**
Jerome Coutant 0:146cf26a9bbb 226 * @brief Starts the camera capture in snapshot mode.
Jerome Coutant 0:146cf26a9bbb 227 * @param buff: pointer to the camera output buffer
Jerome Coutant 0:146cf26a9bbb 228 * @retval None
Jerome Coutant 0:146cf26a9bbb 229 */
Jerome Coutant 0:146cf26a9bbb 230 void BSP_CAMERA_SnapshotStart(uint8_t *buff)
Jerome Coutant 0:146cf26a9bbb 231 {
Jerome Coutant 0:146cf26a9bbb 232 /* Start the camera capture */
Jerome Coutant 0:146cf26a9bbb 233 HAL_DCMI_Start_DMA(&hdcmi_discovery, DCMI_MODE_SNAPSHOT, (uint32_t)buff, GetSize(CameraCurrentResolution));
Jerome Coutant 0:146cf26a9bbb 234 }
Jerome Coutant 0:146cf26a9bbb 235
Jerome Coutant 0:146cf26a9bbb 236 /**
Jerome Coutant 0:146cf26a9bbb 237 * @brief Suspend the CAMERA capture
Jerome Coutant 0:146cf26a9bbb 238 * @retval None
Jerome Coutant 0:146cf26a9bbb 239 */
Jerome Coutant 0:146cf26a9bbb 240 void BSP_CAMERA_Suspend(void)
Jerome Coutant 0:146cf26a9bbb 241 {
Jerome Coutant 0:146cf26a9bbb 242 /* Suspend the Camera Capture */
Jerome Coutant 0:146cf26a9bbb 243 HAL_DCMI_Suspend(&hdcmi_discovery);
Jerome Coutant 0:146cf26a9bbb 244 }
Jerome Coutant 0:146cf26a9bbb 245
Jerome Coutant 0:146cf26a9bbb 246 /**
Jerome Coutant 0:146cf26a9bbb 247 * @brief Resume the CAMERA capture
Jerome Coutant 0:146cf26a9bbb 248 * @retval None
Jerome Coutant 0:146cf26a9bbb 249 */
Jerome Coutant 0:146cf26a9bbb 250 void BSP_CAMERA_Resume(void)
Jerome Coutant 0:146cf26a9bbb 251 {
Jerome Coutant 0:146cf26a9bbb 252 /* Start the Camera Capture */
Jerome Coutant 0:146cf26a9bbb 253 HAL_DCMI_Resume(&hdcmi_discovery);
Jerome Coutant 0:146cf26a9bbb 254 }
Jerome Coutant 0:146cf26a9bbb 255
Jerome Coutant 0:146cf26a9bbb 256 /**
Jerome Coutant 0:146cf26a9bbb 257 * @brief Stop the CAMERA capture
Jerome Coutant 0:146cf26a9bbb 258 * @retval Camera status
Jerome Coutant 0:146cf26a9bbb 259 */
Jerome Coutant 0:146cf26a9bbb 260 uint8_t BSP_CAMERA_Stop(void)
Jerome Coutant 0:146cf26a9bbb 261 {
Jerome Coutant 0:146cf26a9bbb 262 uint8_t status = CAMERA_ERROR;
Jerome Coutant 0:146cf26a9bbb 263
Jerome Coutant 0:146cf26a9bbb 264 if(HAL_DCMI_Stop(&hdcmi_discovery) == HAL_OK)
Jerome Coutant 0:146cf26a9bbb 265 {
Jerome Coutant 0:146cf26a9bbb 266 status = CAMERA_OK;
Jerome Coutant 0:146cf26a9bbb 267 }
Jerome Coutant 0:146cf26a9bbb 268
Jerome Coutant 0:146cf26a9bbb 269 /* Set Camera in Power Down */
Jerome Coutant 0:146cf26a9bbb 270 BSP_CAMERA_PwrDown();
Jerome Coutant 0:146cf26a9bbb 271
Jerome Coutant 0:146cf26a9bbb 272 return status;
Jerome Coutant 0:146cf26a9bbb 273 }
Jerome Coutant 0:146cf26a9bbb 274
Jerome Coutant 0:146cf26a9bbb 275 /**
Jerome Coutant 0:146cf26a9bbb 276 * @brief CANERA power up
Jerome Coutant 0:146cf26a9bbb 277 * @retval None
Jerome Coutant 0:146cf26a9bbb 278 */
Jerome Coutant 0:146cf26a9bbb 279 void BSP_CAMERA_PwrUp(void)
Jerome Coutant 0:146cf26a9bbb 280 {
Jerome Coutant 0:146cf26a9bbb 281 GPIO_InitTypeDef gpio_init_structure;
Jerome Coutant 0:146cf26a9bbb 282
Jerome Coutant 0:146cf26a9bbb 283 /* Enable GPIO clock */
Jerome Coutant 0:146cf26a9bbb 284 __HAL_RCC_GPIOJ_CLK_ENABLE();
Jerome Coutant 0:146cf26a9bbb 285
Jerome Coutant 0:146cf26a9bbb 286 /*** Configure the GPIO ***/
Jerome Coutant 0:146cf26a9bbb 287 /* Configure DCMI GPIO as alternate function */
Jerome Coutant 0:146cf26a9bbb 288 gpio_init_structure.Pin = GPIO_PIN_14;
Jerome Coutant 0:146cf26a9bbb 289 gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
Jerome Coutant 0:146cf26a9bbb 290 gpio_init_structure.Pull = GPIO_NOPULL;
Jerome Coutant 0:146cf26a9bbb 291 gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
Jerome Coutant 0:146cf26a9bbb 292 HAL_GPIO_Init(GPIOJ, &gpio_init_structure);
Jerome Coutant 0:146cf26a9bbb 293
Jerome Coutant 0:146cf26a9bbb 294 /* De-assert the camera POWER_DOWN pin (active high) */
Jerome Coutant 0:146cf26a9bbb 295 HAL_GPIO_WritePin(GPIOJ, GPIO_PIN_14, GPIO_PIN_RESET);
Jerome Coutant 0:146cf26a9bbb 296
Jerome Coutant 0:146cf26a9bbb 297 HAL_Delay(3); /* POWER_DOWN de-asserted during 3ms */
Jerome Coutant 0:146cf26a9bbb 298 }
Jerome Coutant 0:146cf26a9bbb 299
Jerome Coutant 0:146cf26a9bbb 300 /**
Jerome Coutant 0:146cf26a9bbb 301 * @brief CAMERA power down
Jerome Coutant 0:146cf26a9bbb 302 * @retval None
Jerome Coutant 0:146cf26a9bbb 303 */
Jerome Coutant 0:146cf26a9bbb 304 void BSP_CAMERA_PwrDown(void)
Jerome Coutant 0:146cf26a9bbb 305 {
Jerome Coutant 0:146cf26a9bbb 306 GPIO_InitTypeDef gpio_init_structure;
Jerome Coutant 0:146cf26a9bbb 307
Jerome Coutant 0:146cf26a9bbb 308 /* Enable GPIO clock */
Jerome Coutant 0:146cf26a9bbb 309 __HAL_RCC_GPIOJ_CLK_ENABLE();
Jerome Coutant 0:146cf26a9bbb 310
Jerome Coutant 0:146cf26a9bbb 311 /*** Configure the GPIO ***/
Jerome Coutant 0:146cf26a9bbb 312 /* Configure DCMI GPIO as alternate function */
Jerome Coutant 0:146cf26a9bbb 313 gpio_init_structure.Pin = GPIO_PIN_14;
Jerome Coutant 0:146cf26a9bbb 314 gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
Jerome Coutant 0:146cf26a9bbb 315 gpio_init_structure.Pull = GPIO_NOPULL;
Jerome Coutant 0:146cf26a9bbb 316 gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
Jerome Coutant 0:146cf26a9bbb 317 HAL_GPIO_Init(GPIOJ, &gpio_init_structure);
Jerome Coutant 0:146cf26a9bbb 318
Jerome Coutant 0:146cf26a9bbb 319 /* Assert the camera POWER_DOWN pin (active high) */
Jerome Coutant 0:146cf26a9bbb 320 HAL_GPIO_WritePin(GPIOJ, GPIO_PIN_14, GPIO_PIN_SET);
Jerome Coutant 0:146cf26a9bbb 321 }
Jerome Coutant 0:146cf26a9bbb 322
Jerome Coutant 0:146cf26a9bbb 323 /**
Jerome Coutant 0:146cf26a9bbb 324 * @brief Configures the camera contrast and brightness.
Jerome Coutant 0:146cf26a9bbb 325 * @param contrast_level: Contrast level
Jerome Coutant 0:146cf26a9bbb 326 * This parameter can be one of the following values:
Jerome Coutant 0:146cf26a9bbb 327 * @arg CAMERA_CONTRAST_LEVEL4: for contrast +2
Jerome Coutant 0:146cf26a9bbb 328 * @arg CAMERA_CONTRAST_LEVEL3: for contrast +1
Jerome Coutant 0:146cf26a9bbb 329 * @arg CAMERA_CONTRAST_LEVEL2: for contrast 0
Jerome Coutant 0:146cf26a9bbb 330 * @arg CAMERA_CONTRAST_LEVEL1: for contrast -1
Jerome Coutant 0:146cf26a9bbb 331 * @arg CAMERA_CONTRAST_LEVEL0: for contrast -2
Jerome Coutant 0:146cf26a9bbb 332 * @param brightness_level: Contrast level
Jerome Coutant 0:146cf26a9bbb 333 * This parameter can be one of the following values:
Jerome Coutant 0:146cf26a9bbb 334 * @arg CAMERA_BRIGHTNESS_LEVEL4: for brightness +2
Jerome Coutant 0:146cf26a9bbb 335 * @arg CAMERA_BRIGHTNESS_LEVEL3: for brightness +1
Jerome Coutant 0:146cf26a9bbb 336 * @arg CAMERA_BRIGHTNESS_LEVEL2: for brightness 0
Jerome Coutant 0:146cf26a9bbb 337 * @arg CAMERA_BRIGHTNESS_LEVEL1: for brightness -1
Jerome Coutant 0:146cf26a9bbb 338 * @arg CAMERA_BRIGHTNESS_LEVEL0: for brightness -2
Jerome Coutant 0:146cf26a9bbb 339 */
Jerome Coutant 0:146cf26a9bbb 340 void BSP_CAMERA_ContrastBrightnessConfig(uint32_t contrast_level, uint32_t brightness_level)
Jerome Coutant 0:146cf26a9bbb 341 {
Jerome Coutant 0:146cf26a9bbb 342 if(camera_drv->Config != NULL)
Jerome Coutant 0:146cf26a9bbb 343 {
Jerome Coutant 0:146cf26a9bbb 344 camera_drv->Config(CameraHwAddress, CAMERA_CONTRAST_BRIGHTNESS, contrast_level, brightness_level);
Jerome Coutant 0:146cf26a9bbb 345 }
Jerome Coutant 0:146cf26a9bbb 346 }
Jerome Coutant 0:146cf26a9bbb 347
Jerome Coutant 0:146cf26a9bbb 348 /**
Jerome Coutant 0:146cf26a9bbb 349 * @brief Configures the camera white balance.
Jerome Coutant 0:146cf26a9bbb 350 * @param Mode: black_white mode
Jerome Coutant 0:146cf26a9bbb 351 * This parameter can be one of the following values:
Jerome Coutant 0:146cf26a9bbb 352 * @arg CAMERA_BLACK_WHITE_BW
Jerome Coutant 0:146cf26a9bbb 353 * @arg CAMERA_BLACK_WHITE_NEGATIVE
Jerome Coutant 0:146cf26a9bbb 354 * @arg CAMERA_BLACK_WHITE_BW_NEGATIVE
Jerome Coutant 0:146cf26a9bbb 355 * @arg CAMERA_BLACK_WHITE_NORMAL
Jerome Coutant 0:146cf26a9bbb 356 */
Jerome Coutant 0:146cf26a9bbb 357 void BSP_CAMERA_BlackWhiteConfig(uint32_t Mode)
Jerome Coutant 0:146cf26a9bbb 358 {
Jerome Coutant 0:146cf26a9bbb 359 if(camera_drv->Config != NULL)
Jerome Coutant 0:146cf26a9bbb 360 {
Jerome Coutant 0:146cf26a9bbb 361 camera_drv->Config(CameraHwAddress, CAMERA_BLACK_WHITE, Mode, 0);
Jerome Coutant 0:146cf26a9bbb 362 }
Jerome Coutant 0:146cf26a9bbb 363 }
Jerome Coutant 0:146cf26a9bbb 364
Jerome Coutant 0:146cf26a9bbb 365 /**
Jerome Coutant 0:146cf26a9bbb 366 * @brief Configures the camera color effect.
Jerome Coutant 0:146cf26a9bbb 367 * @param Effect: Color effect
Jerome Coutant 0:146cf26a9bbb 368 * This parameter can be one of the following values:
Jerome Coutant 0:146cf26a9bbb 369 * @arg CAMERA_COLOR_EFFECT_ANTIQUE
Jerome Coutant 0:146cf26a9bbb 370 * @arg CAMERA_COLOR_EFFECT_BLUE
Jerome Coutant 0:146cf26a9bbb 371 * @arg CAMERA_COLOR_EFFECT_GREEN
Jerome Coutant 0:146cf26a9bbb 372 * @arg CAMERA_COLOR_EFFECT_RED
Jerome Coutant 0:146cf26a9bbb 373 * @retval None
Jerome Coutant 0:146cf26a9bbb 374 */
Jerome Coutant 0:146cf26a9bbb 375 void BSP_CAMERA_ColorEffectConfig(uint32_t Effect)
Jerome Coutant 0:146cf26a9bbb 376 {
Jerome Coutant 0:146cf26a9bbb 377 if(camera_drv->Config != NULL)
Jerome Coutant 0:146cf26a9bbb 378 {
Jerome Coutant 0:146cf26a9bbb 379 camera_drv->Config(CameraHwAddress, CAMERA_COLOR_EFFECT, Effect, 0);
Jerome Coutant 0:146cf26a9bbb 380 }
Jerome Coutant 0:146cf26a9bbb 381 }
Jerome Coutant 0:146cf26a9bbb 382
Jerome Coutant 0:146cf26a9bbb 383 /**
Jerome Coutant 0:146cf26a9bbb 384 * @brief Get the capture size in pixels unit.
Jerome Coutant 0:146cf26a9bbb 385 * @param Resolution: the current resolution.
Jerome Coutant 0:146cf26a9bbb 386 * @retval capture size in pixels unit.
Jerome Coutant 0:146cf26a9bbb 387 */
Jerome Coutant 0:146cf26a9bbb 388 static uint32_t GetSize(uint32_t Resolution)
Jerome Coutant 0:146cf26a9bbb 389 {
Jerome Coutant 0:146cf26a9bbb 390 uint32_t size = 0;
Jerome Coutant 0:146cf26a9bbb 391
Jerome Coutant 0:146cf26a9bbb 392 /* Get capture size */
Jerome Coutant 0:146cf26a9bbb 393 switch (Resolution)
Jerome Coutant 0:146cf26a9bbb 394 {
Jerome Coutant 0:146cf26a9bbb 395 case CAMERA_R160x120:
Jerome Coutant 0:146cf26a9bbb 396 {
Jerome Coutant 0:146cf26a9bbb 397 size = 0x2580;
Jerome Coutant 0:146cf26a9bbb 398 }
Jerome Coutant 0:146cf26a9bbb 399 break;
Jerome Coutant 0:146cf26a9bbb 400 case CAMERA_R320x240:
Jerome Coutant 0:146cf26a9bbb 401 {
Jerome Coutant 0:146cf26a9bbb 402 size = 0x9600;
Jerome Coutant 0:146cf26a9bbb 403 }
Jerome Coutant 0:146cf26a9bbb 404 break;
Jerome Coutant 0:146cf26a9bbb 405 case CAMERA_R480x272:
Jerome Coutant 0:146cf26a9bbb 406 {
Jerome Coutant 0:146cf26a9bbb 407 size = 0xFF00;
Jerome Coutant 0:146cf26a9bbb 408 }
Jerome Coutant 0:146cf26a9bbb 409 break;
Jerome Coutant 0:146cf26a9bbb 410 case CAMERA_R640x480:
Jerome Coutant 0:146cf26a9bbb 411 {
Jerome Coutant 0:146cf26a9bbb 412 size = 0x25800;
Jerome Coutant 0:146cf26a9bbb 413 }
Jerome Coutant 0:146cf26a9bbb 414 break;
Jerome Coutant 0:146cf26a9bbb 415 default:
Jerome Coutant 0:146cf26a9bbb 416 {
Jerome Coutant 0:146cf26a9bbb 417 break;
Jerome Coutant 0:146cf26a9bbb 418 }
Jerome Coutant 0:146cf26a9bbb 419 }
Jerome Coutant 0:146cf26a9bbb 420
Jerome Coutant 0:146cf26a9bbb 421 return size;
Jerome Coutant 0:146cf26a9bbb 422 }
Jerome Coutant 0:146cf26a9bbb 423
Jerome Coutant 0:146cf26a9bbb 424 /**
Jerome Coutant 0:146cf26a9bbb 425 * @brief Initializes the DCMI MSP.
Jerome Coutant 0:146cf26a9bbb 426 * @param hdcmi: HDMI handle
Jerome Coutant 0:146cf26a9bbb 427 * @param Params : pointer on additional configuration parameters, can be NULL.
Jerome Coutant 0:146cf26a9bbb 428 * @retval None
Jerome Coutant 0:146cf26a9bbb 429 */
Jerome Coutant 0:146cf26a9bbb 430 __weak void BSP_CAMERA_MspInit(DCMI_HandleTypeDef *hdcmi, void *Params)
Jerome Coutant 0:146cf26a9bbb 431 {
Jerome Coutant 0:146cf26a9bbb 432 static DMA_HandleTypeDef hdma_handler;
Jerome Coutant 0:146cf26a9bbb 433 GPIO_InitTypeDef gpio_init_structure;
Jerome Coutant 0:146cf26a9bbb 434
Jerome Coutant 0:146cf26a9bbb 435 /*** Enable peripherals and GPIO clocks ***/
Jerome Coutant 0:146cf26a9bbb 436 /* Enable DCMI clock */
Jerome Coutant 0:146cf26a9bbb 437 __HAL_RCC_DCMI_CLK_ENABLE();
Jerome Coutant 0:146cf26a9bbb 438
Jerome Coutant 0:146cf26a9bbb 439 /* Enable DMA clock */
Jerome Coutant 0:146cf26a9bbb 440 CAMERA_DCMI_DMAx_CLK_ENABLE();
Jerome Coutant 0:146cf26a9bbb 441
Jerome Coutant 0:146cf26a9bbb 442 /* Enable GPIO clocks */
Jerome Coutant 0:146cf26a9bbb 443 __HAL_RCC_GPIOA_CLK_ENABLE();
Jerome Coutant 0:146cf26a9bbb 444 __HAL_RCC_GPIOB_CLK_ENABLE();
Jerome Coutant 0:146cf26a9bbb 445 __HAL_RCC_GPIOC_CLK_ENABLE();
Jerome Coutant 0:146cf26a9bbb 446 __HAL_RCC_GPIOD_CLK_ENABLE();
Jerome Coutant 0:146cf26a9bbb 447 __HAL_RCC_GPIOG_CLK_ENABLE();
Jerome Coutant 0:146cf26a9bbb 448
Jerome Coutant 0:146cf26a9bbb 449 /*** Configure the GPIO ***/
Jerome Coutant 0:146cf26a9bbb 450 /* Configure DCMI GPIO as alternate function */
Jerome Coutant 0:146cf26a9bbb 451 gpio_init_structure.Pin = GPIO_PIN_4 | GPIO_PIN_6;
Jerome Coutant 0:146cf26a9bbb 452 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
Jerome Coutant 0:146cf26a9bbb 453 gpio_init_structure.Pull = GPIO_PULLUP;
Jerome Coutant 0:146cf26a9bbb 454 gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
Jerome Coutant 0:146cf26a9bbb 455 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
Jerome Coutant 0:146cf26a9bbb 456 HAL_GPIO_Init(GPIOA, &gpio_init_structure);
Jerome Coutant 0:146cf26a9bbb 457
Jerome Coutant 0:146cf26a9bbb 458 gpio_init_structure.Pin = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9;
Jerome Coutant 0:146cf26a9bbb 459 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
Jerome Coutant 0:146cf26a9bbb 460 gpio_init_structure.Pull = GPIO_PULLUP;
Jerome Coutant 0:146cf26a9bbb 461 gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
Jerome Coutant 0:146cf26a9bbb 462 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
Jerome Coutant 0:146cf26a9bbb 463 HAL_GPIO_Init(GPIOB, &gpio_init_structure);
Jerome Coutant 0:146cf26a9bbb 464
Jerome Coutant 0:146cf26a9bbb 465 gpio_init_structure.Pin = GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_9 | GPIO_PIN_11;
Jerome Coutant 0:146cf26a9bbb 466 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
Jerome Coutant 0:146cf26a9bbb 467 gpio_init_structure.Pull = GPIO_PULLUP;
Jerome Coutant 0:146cf26a9bbb 468 gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
Jerome Coutant 0:146cf26a9bbb 469 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
Jerome Coutant 0:146cf26a9bbb 470 HAL_GPIO_Init(GPIOC, &gpio_init_structure);
Jerome Coutant 0:146cf26a9bbb 471
Jerome Coutant 0:146cf26a9bbb 472 gpio_init_structure.Pin = GPIO_PIN_3;
Jerome Coutant 0:146cf26a9bbb 473 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
Jerome Coutant 0:146cf26a9bbb 474 gpio_init_structure.Pull = GPIO_PULLUP;
Jerome Coutant 0:146cf26a9bbb 475 gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
Jerome Coutant 0:146cf26a9bbb 476 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
Jerome Coutant 0:146cf26a9bbb 477 HAL_GPIO_Init(GPIOD, &gpio_init_structure);
Jerome Coutant 0:146cf26a9bbb 478
Jerome Coutant 0:146cf26a9bbb 479 gpio_init_structure.Pin = GPIO_PIN_10;
Jerome Coutant 0:146cf26a9bbb 480 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
Jerome Coutant 0:146cf26a9bbb 481 gpio_init_structure.Pull = GPIO_PULLUP;
Jerome Coutant 0:146cf26a9bbb 482 gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
Jerome Coutant 0:146cf26a9bbb 483 gpio_init_structure.Alternate = GPIO_AF13_DCMI;
Jerome Coutant 0:146cf26a9bbb 484 HAL_GPIO_Init(GPIOG, &gpio_init_structure);
Jerome Coutant 0:146cf26a9bbb 485
Jerome Coutant 0:146cf26a9bbb 486 /*** Configure the DMA ***/
Jerome Coutant 0:146cf26a9bbb 487 /* Set the parameters to be configured */
Jerome Coutant 0:146cf26a9bbb 488 hdma_handler.Init.Request = DMA_REQUEST_DCMI;
Jerome Coutant 0:146cf26a9bbb 489 hdma_handler.Init.Direction = DMA_PERIPH_TO_MEMORY;
Jerome Coutant 0:146cf26a9bbb 490 hdma_handler.Init.PeriphInc = DMA_PINC_DISABLE;
Jerome Coutant 0:146cf26a9bbb 491 hdma_handler.Init.MemInc = DMA_MINC_ENABLE;
Jerome Coutant 0:146cf26a9bbb 492 hdma_handler.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
Jerome Coutant 0:146cf26a9bbb 493 hdma_handler.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
Jerome Coutant 0:146cf26a9bbb 494 hdma_handler.Init.Mode = DMA_CIRCULAR;
Jerome Coutant 0:146cf26a9bbb 495 hdma_handler.Init.Priority = DMA_PRIORITY_HIGH;
Jerome Coutant 0:146cf26a9bbb 496 hdma_handler.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
Jerome Coutant 0:146cf26a9bbb 497 hdma_handler.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
Jerome Coutant 0:146cf26a9bbb 498 hdma_handler.Init.MemBurst = DMA_MBURST_SINGLE;
Jerome Coutant 0:146cf26a9bbb 499 hdma_handler.Init.PeriphBurst = DMA_PBURST_SINGLE;
Jerome Coutant 0:146cf26a9bbb 500
Jerome Coutant 0:146cf26a9bbb 501 hdma_handler.Instance = CAMERA_DCMI_DMAx_STREAM;
Jerome Coutant 0:146cf26a9bbb 502
Jerome Coutant 0:146cf26a9bbb 503 /* Associate the initialized DMA handle to the DCMI handle */
Jerome Coutant 0:146cf26a9bbb 504 __HAL_LINKDMA(hdcmi, DMA_Handle, hdma_handler);
Jerome Coutant 0:146cf26a9bbb 505
Jerome Coutant 0:146cf26a9bbb 506 /*** Configure the NVIC for DCMI and DMA ***/
Jerome Coutant 0:146cf26a9bbb 507 /* NVIC configuration for DCMI transfer complete interrupt */
Jerome Coutant 0:146cf26a9bbb 508 HAL_NVIC_SetPriority(DCMI_IRQn, 0x0F, 0);
Jerome Coutant 0:146cf26a9bbb 509 HAL_NVIC_EnableIRQ(DCMI_IRQn);
Jerome Coutant 0:146cf26a9bbb 510
Jerome Coutant 0:146cf26a9bbb 511 /* NVIC configuration for DMA transfer complete interrupt */
Jerome Coutant 0:146cf26a9bbb 512 HAL_NVIC_SetPriority(CAMERA_DCMI_DMAx_IRQ, 0x0F, 0);
Jerome Coutant 0:146cf26a9bbb 513 HAL_NVIC_EnableIRQ(CAMERA_DCMI_DMAx_IRQ);
Jerome Coutant 0:146cf26a9bbb 514
Jerome Coutant 0:146cf26a9bbb 515 /* Configure the DMA stream */
Jerome Coutant 0:146cf26a9bbb 516 HAL_DMA_Init(hdcmi->DMA_Handle);
Jerome Coutant 0:146cf26a9bbb 517 }
Jerome Coutant 0:146cf26a9bbb 518
Jerome Coutant 0:146cf26a9bbb 519 /**
Jerome Coutant 0:146cf26a9bbb 520 * @brief DeInitializes the DCMI MSP.
Jerome Coutant 0:146cf26a9bbb 521 * @param hdcmi: HDMI handle
Jerome Coutant 0:146cf26a9bbb 522 * @param Params : pointer on additional configuration parameters, can be NULL.
Jerome Coutant 0:146cf26a9bbb 523 * @retval None
Jerome Coutant 0:146cf26a9bbb 524 */
Jerome Coutant 0:146cf26a9bbb 525 __weak void BSP_CAMERA_MspDeInit(DCMI_HandleTypeDef *hdcmi, void *Params)
Jerome Coutant 0:146cf26a9bbb 526 {
Jerome Coutant 0:146cf26a9bbb 527 /* Disable NVIC for DCMI transfer complete interrupt */
Jerome Coutant 0:146cf26a9bbb 528 HAL_NVIC_DisableIRQ(DCMI_IRQn);
Jerome Coutant 0:146cf26a9bbb 529
Jerome Coutant 0:146cf26a9bbb 530 /* Disable NVIC for DMA2 transfer complete interrupt */
Jerome Coutant 0:146cf26a9bbb 531 HAL_NVIC_DisableIRQ(CAMERA_DCMI_DMAx_IRQ);
Jerome Coutant 0:146cf26a9bbb 532
Jerome Coutant 0:146cf26a9bbb 533 /* Configure the DMA stream */
Jerome Coutant 0:146cf26a9bbb 534 HAL_DMA_DeInit(hdcmi->DMA_Handle);
Jerome Coutant 0:146cf26a9bbb 535
Jerome Coutant 0:146cf26a9bbb 536 /* Disable DCMI clock */
Jerome Coutant 0:146cf26a9bbb 537 __HAL_RCC_DCMI_CLK_DISABLE();
Jerome Coutant 0:146cf26a9bbb 538
Jerome Coutant 0:146cf26a9bbb 539 /* GPIO pins clock and DMA clock can be shut down in the application
Jerome Coutant 0:146cf26a9bbb 540 by surcharging this __weak function */
Jerome Coutant 0:146cf26a9bbb 541 }
Jerome Coutant 0:146cf26a9bbb 542
Jerome Coutant 0:146cf26a9bbb 543 /**
Jerome Coutant 0:146cf26a9bbb 544 * @brief Line event callback
Jerome Coutant 0:146cf26a9bbb 545 * @param hdcmi: pointer to the DCMI handle
Jerome Coutant 0:146cf26a9bbb 546 * @retval None
Jerome Coutant 0:146cf26a9bbb 547 */
Jerome Coutant 0:146cf26a9bbb 548 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi)
Jerome Coutant 0:146cf26a9bbb 549 {
Jerome Coutant 0:146cf26a9bbb 550 BSP_CAMERA_LineEventCallback();
Jerome Coutant 0:146cf26a9bbb 551 }
Jerome Coutant 0:146cf26a9bbb 552
Jerome Coutant 0:146cf26a9bbb 553 /**
Jerome Coutant 0:146cf26a9bbb 554 * @brief Line Event callback.
Jerome Coutant 0:146cf26a9bbb 555 * @retval None
Jerome Coutant 0:146cf26a9bbb 556 */
Jerome Coutant 0:146cf26a9bbb 557 __weak void BSP_CAMERA_LineEventCallback(void)
Jerome Coutant 0:146cf26a9bbb 558 {
Jerome Coutant 0:146cf26a9bbb 559 /* NOTE : This function Should not be modified, when the callback is needed,
Jerome Coutant 0:146cf26a9bbb 560 the HAL_DCMI_LineEventCallback could be implemented in the user file
Jerome Coutant 0:146cf26a9bbb 561 */
Jerome Coutant 0:146cf26a9bbb 562 }
Jerome Coutant 0:146cf26a9bbb 563
Jerome Coutant 0:146cf26a9bbb 564 /**
Jerome Coutant 0:146cf26a9bbb 565 * @brief VSYNC event callback
Jerome Coutant 0:146cf26a9bbb 566 * @param hdcmi: pointer to the DCMI handle
Jerome Coutant 0:146cf26a9bbb 567 * @retval None
Jerome Coutant 0:146cf26a9bbb 568 */
Jerome Coutant 0:146cf26a9bbb 569 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi)
Jerome Coutant 0:146cf26a9bbb 570 {
Jerome Coutant 0:146cf26a9bbb 571 BSP_CAMERA_VsyncEventCallback();
Jerome Coutant 0:146cf26a9bbb 572 }
Jerome Coutant 0:146cf26a9bbb 573
Jerome Coutant 0:146cf26a9bbb 574 /**
Jerome Coutant 0:146cf26a9bbb 575 * @brief VSYNC Event callback.
Jerome Coutant 0:146cf26a9bbb 576 * @retval None
Jerome Coutant 0:146cf26a9bbb 577 */
Jerome Coutant 0:146cf26a9bbb 578 __weak void BSP_CAMERA_VsyncEventCallback(void)
Jerome Coutant 0:146cf26a9bbb 579 {
Jerome Coutant 0:146cf26a9bbb 580 /* NOTE : This function Should not be modified, when the callback is needed,
Jerome Coutant 0:146cf26a9bbb 581 the HAL_DCMI_VsyncEventCallback could be implemented in the user file
Jerome Coutant 0:146cf26a9bbb 582 */
Jerome Coutant 0:146cf26a9bbb 583 }
Jerome Coutant 0:146cf26a9bbb 584
Jerome Coutant 0:146cf26a9bbb 585 /**
Jerome Coutant 0:146cf26a9bbb 586 * @brief Frame event callback
Jerome Coutant 0:146cf26a9bbb 587 * @param hdcmi: pointer to the DCMI handle
Jerome Coutant 0:146cf26a9bbb 588 * @retval None
Jerome Coutant 0:146cf26a9bbb 589 */
Jerome Coutant 0:146cf26a9bbb 590 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
Jerome Coutant 0:146cf26a9bbb 591 {
Jerome Coutant 0:146cf26a9bbb 592 BSP_CAMERA_FrameEventCallback();
Jerome Coutant 0:146cf26a9bbb 593 }
Jerome Coutant 0:146cf26a9bbb 594
Jerome Coutant 0:146cf26a9bbb 595 /**
Jerome Coutant 0:146cf26a9bbb 596 * @brief Frame Event callback.
Jerome Coutant 0:146cf26a9bbb 597 * @retval None
Jerome Coutant 0:146cf26a9bbb 598 */
Jerome Coutant 0:146cf26a9bbb 599 __weak void BSP_CAMERA_FrameEventCallback(void)
Jerome Coutant 0:146cf26a9bbb 600 {
Jerome Coutant 0:146cf26a9bbb 601 /* NOTE : This function Should not be modified, when the callback is needed,
Jerome Coutant 0:146cf26a9bbb 602 the HAL_DCMI_FrameEventCallback could be implemented in the user file
Jerome Coutant 0:146cf26a9bbb 603 */
Jerome Coutant 0:146cf26a9bbb 604 }
Jerome Coutant 0:146cf26a9bbb 605
Jerome Coutant 0:146cf26a9bbb 606 /**
Jerome Coutant 0:146cf26a9bbb 607 * @brief Error callback
Jerome Coutant 0:146cf26a9bbb 608 * @param hdcmi: pointer to the DCMI handle
Jerome Coutant 0:146cf26a9bbb 609 * @retval None
Jerome Coutant 0:146cf26a9bbb 610 */
Jerome Coutant 0:146cf26a9bbb 611 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi)
Jerome Coutant 0:146cf26a9bbb 612 {
Jerome Coutant 0:146cf26a9bbb 613 BSP_CAMERA_ErrorCallback();
Jerome Coutant 0:146cf26a9bbb 614 }
Jerome Coutant 0:146cf26a9bbb 615
Jerome Coutant 0:146cf26a9bbb 616 /**
Jerome Coutant 0:146cf26a9bbb 617 * @brief Error callback.
Jerome Coutant 0:146cf26a9bbb 618 * @retval None
Jerome Coutant 0:146cf26a9bbb 619 */
Jerome Coutant 0:146cf26a9bbb 620 __weak void BSP_CAMERA_ErrorCallback(void)
Jerome Coutant 0:146cf26a9bbb 621 {
Jerome Coutant 0:146cf26a9bbb 622 /* NOTE : This function Should not be modified, when the callback is needed,
Jerome Coutant 0:146cf26a9bbb 623 the HAL_DCMI_ErrorCallback could be implemented in the user file
Jerome Coutant 0:146cf26a9bbb 624 */
Jerome Coutant 0:146cf26a9bbb 625 }
Jerome Coutant 0:146cf26a9bbb 626
Jerome Coutant 0:146cf26a9bbb 627 /**
Jerome Coutant 0:146cf26a9bbb 628 * @}
Jerome Coutant 0:146cf26a9bbb 629 */
Jerome Coutant 0:146cf26a9bbb 630
Jerome Coutant 0:146cf26a9bbb 631 /**
Jerome Coutant 0:146cf26a9bbb 632 * @}
Jerome Coutant 0:146cf26a9bbb 633 */
Jerome Coutant 0:146cf26a9bbb 634
Jerome Coutant 0:146cf26a9bbb 635 /**
Jerome Coutant 0:146cf26a9bbb 636 * @}
Jerome Coutant 0:146cf26a9bbb 637 */
Jerome Coutant 0:146cf26a9bbb 638
Jerome Coutant 0:146cf26a9bbb 639 /**
Jerome Coutant 0:146cf26a9bbb 640 * @}
Jerome Coutant 0:146cf26a9bbb 641 */
Jerome Coutant 0:146cf26a9bbb 642
Jerome Coutant 0:146cf26a9bbb 643 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/