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