No changes made
Fork of BSP_DISCO_F746NG by
Embed:
(wiki syntax)
Show/hide line numbers
stm32746g_discovery_camera.c
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32746g_discovery_camera.c 00004 * @author MCD Application Team 00005 * @version V2.0.0 00006 * @date 30-December-2016 00007 * @brief This file includes the driver for Camera modules mounted on 00008 * STM32746G-Discovery board. 00009 @verbatim 00010 How to use this driver: 00011 ------------------------ 00012 - This driver is used to drive the camera. 00013 - The OV9655 component driver MUST be included with this driver. 00014 00015 Driver description: 00016 ------------------- 00017 + Initialization steps: 00018 o Initialize the camera using the BSP_CAMERA_Init() function. 00019 o Start the camera capture/snapshot using the CAMERA_Start() function. 00020 o Suspend, resume or stop the camera capture using the following functions: 00021 - BSP_CAMERA_Suspend() 00022 - BSP_CAMERA_Resume() 00023 - BSP_CAMERA_Stop() 00024 00025 + Options 00026 o Increase or decrease on the fly the brightness and/or contrast 00027 using the following function: 00028 - BSP_CAMERA_ContrastBrightnessConfig 00029 o Add a special effect on the fly using the following functions: 00030 - BSP_CAMERA_BlackWhiteConfig() 00031 - BSP_CAMERA_ColorEffectConfig() 00032 @endverbatim 00033 ****************************************************************************** 00034 * @attention 00035 * 00036 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> 00037 * 00038 * Redistribution and use in source and binary forms, with or without modification, 00039 * are permitted provided that the following conditions are met: 00040 * 1. Redistributions of source code must retain the above copyright notice, 00041 * this list of conditions and the following disclaimer. 00042 * 2. Redistributions in binary form must reproduce the above copyright notice, 00043 * this list of conditions and the following disclaimer in the documentation 00044 * and/or other materials provided with the distribution. 00045 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00046 * may be used to endorse or promote products derived from this software 00047 * without specific prior written permission. 00048 * 00049 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00050 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00051 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00052 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00053 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00054 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00055 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00056 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00057 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00058 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00059 * 00060 ****************************************************************************** 00061 */ 00062 00063 /* Includes ------------------------------------------------------------------*/ 00064 #include "stm32746g_discovery_camera.h" 00065 #include "stm32746g_discovery.h" 00066 00067 void wait_ms(int ms); // MBED to replace HAL_Delay function 00068 00069 /** @addtogroup BSP 00070 * @{ 00071 */ 00072 00073 /** @addtogroup STM32746G_DISCOVERY 00074 * @{ 00075 */ 00076 00077 /** @addtogroup STM32746G_DISCOVERY_CAMERA 00078 * @{ 00079 */ 00080 00081 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_TypesDefinitions STM32746G_DISCOVERY_CAMERA Private Types Definitions 00082 * @{ 00083 */ 00084 /** 00085 * @} 00086 */ 00087 00088 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_Defines STM32746G_DISCOVERY_CAMERA Private Defines 00089 * @{ 00090 */ 00091 #define CAMERA_VGA_RES_X 640 00092 #define CAMERA_VGA_RES_Y 480 00093 #define CAMERA_480x272_RES_X 480 00094 #define CAMERA_480x272_RES_Y 272 00095 #define CAMERA_QVGA_RES_X 320 00096 #define CAMERA_QVGA_RES_Y 240 00097 #define CAMERA_QQVGA_RES_X 160 00098 #define CAMERA_QQVGA_RES_Y 120 00099 /** 00100 * @} 00101 */ 00102 00103 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_Macros STM32746G_DISCOVERY_CAMERA Private Macros 00104 * @{ 00105 */ 00106 /** 00107 * @} 00108 */ 00109 00110 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_Variables STM32746G_DISCOVERY_CAMERA Private Variables 00111 * @{ 00112 */ 00113 DCMI_HandleTypeDef hDcmiHandler; 00114 CAMERA_DrvTypeDef *camera_drv; 00115 /* Camera current resolution naming (QQVGA, VGA, ...) */ 00116 static uint32_t CameraCurrentResolution; 00117 00118 /* Camera module I2C HW address */ 00119 static uint32_t CameraHwAddress; 00120 /** 00121 * @} 00122 */ 00123 00124 /** @defgroup STM32746G_DISCOVERY_CAMERA_Private_FunctionPrototypes STM32746G_DISCOVERY_CAMERA Private Function Prototypes 00125 * @{ 00126 */ 00127 static uint32_t GetSize(uint32_t resolution); 00128 /** 00129 * @} 00130 */ 00131 00132 /** @defgroup STM32746G_DISCOVERY_CAMERA_Exported_Functions STM32746G_DISCOVERY_CAMERA Exported Functions 00133 * @{ 00134 */ 00135 00136 /** 00137 * @brief Initializes the camera. 00138 * @param Resolution : camera sensor requested resolution (x, y) : standard resolution 00139 * naming QQVGA, QVGA, VGA ... 00140 * @retval Camera status 00141 */ 00142 uint8_t BSP_CAMERA_Init(uint32_t Resolution) 00143 { 00144 DCMI_HandleTypeDef *phdcmi; 00145 uint8_t status = CAMERA_ERROR; 00146 00147 /* Get the DCMI handle structure */ 00148 phdcmi = &hDcmiHandler; 00149 00150 /*** Configures the DCMI to interface with the camera module ***/ 00151 /* DCMI configuration */ 00152 phdcmi->Init.CaptureRate = DCMI_CR_ALL_FRAME; 00153 phdcmi->Init.HSPolarity = DCMI_HSPOLARITY_LOW; 00154 phdcmi->Init.SynchroMode = DCMI_SYNCHRO_HARDWARE; 00155 phdcmi->Init.VSPolarity = DCMI_VSPOLARITY_HIGH; 00156 phdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B; 00157 phdcmi->Init.PCKPolarity = DCMI_PCKPOLARITY_RISING; 00158 phdcmi->Instance = DCMI; 00159 00160 /* Power up camera */ 00161 BSP_CAMERA_PwrUp(); 00162 00163 /* Read ID of Camera module via I2C */ 00164 if(ov9655_ReadID(CAMERA_I2C_ADDRESS) == OV9655_ID) 00165 { 00166 /* Initialize the camera driver structure */ 00167 camera_drv = &ov9655_drv; 00168 CameraHwAddress = CAMERA_I2C_ADDRESS; 00169 00170 /* DCMI Initialization */ 00171 BSP_CAMERA_MspInit(&hDcmiHandler, NULL); 00172 HAL_DCMI_Init(phdcmi); 00173 00174 /* Camera Module Initialization via I2C to the wanted 'Resolution' */ 00175 if (Resolution == CAMERA_R480x272) 00176 { /* For 480x272 resolution, the OV9655 sensor is set to VGA resolution 00177 * as OV9655 doesn't supports 480x272 resolution, 00178 * then DCMI is configured to output a 480x272 cropped window */ 00179 camera_drv->Init(CameraHwAddress, CAMERA_R640x480); 00180 HAL_DCMI_ConfigCROP(phdcmi, /* Crop in the middle of the VGA picture */ 00181 (CAMERA_VGA_RES_X - CAMERA_480x272_RES_X)/2, 00182 (CAMERA_VGA_RES_Y - CAMERA_480x272_RES_Y)/2, 00183 (CAMERA_480x272_RES_X * 2) - 1, 00184 CAMERA_480x272_RES_Y - 1); 00185 HAL_DCMI_EnableCROP(phdcmi); 00186 } 00187 else 00188 { 00189 camera_drv->Init(CameraHwAddress, Resolution); 00190 HAL_DCMI_DisableCROP(phdcmi); 00191 } 00192 00193 CameraCurrentResolution = Resolution; 00194 00195 /* Return CAMERA_OK status */ 00196 status = CAMERA_OK; 00197 } 00198 else 00199 { 00200 /* Return CAMERA_NOT_SUPPORTED status */ 00201 status = CAMERA_NOT_SUPPORTED; 00202 } 00203 00204 return status; 00205 } 00206 00207 /** 00208 * @brief DeInitializes the camera. 00209 * @retval Camera status 00210 */ 00211 uint8_t BSP_CAMERA_DeInit(void) 00212 { 00213 hDcmiHandler.Instance = DCMI; 00214 00215 HAL_DCMI_DeInit(&hDcmiHandler); 00216 BSP_CAMERA_MspDeInit(&hDcmiHandler, NULL); 00217 return CAMERA_OK; 00218 } 00219 00220 /** 00221 * @brief Starts the camera capture in continuous mode. 00222 * @param buff: pointer to the camera output buffer 00223 * @retval None 00224 */ 00225 void BSP_CAMERA_ContinuousStart(uint8_t *buff) 00226 { 00227 /* Start the camera capture */ 00228 HAL_DCMI_Start_DMA(&hDcmiHandler, DCMI_MODE_CONTINUOUS, (uint32_t)buff, GetSize(CameraCurrentResolution)); 00229 } 00230 00231 /** 00232 * @brief Starts the camera capture in snapshot mode. 00233 * @param buff: pointer to the camera output buffer 00234 * @retval None 00235 */ 00236 void BSP_CAMERA_SnapshotStart(uint8_t *buff) 00237 { 00238 /* Start the camera capture */ 00239 HAL_DCMI_Start_DMA(&hDcmiHandler, DCMI_MODE_SNAPSHOT, (uint32_t)buff, GetSize(CameraCurrentResolution)); 00240 } 00241 00242 /** 00243 * @brief Suspend the CAMERA capture 00244 * @retval None 00245 */ 00246 void BSP_CAMERA_Suspend(void) 00247 { 00248 /* Suspend the Camera Capture */ 00249 HAL_DCMI_Suspend(&hDcmiHandler); 00250 } 00251 00252 /** 00253 * @brief Resume the CAMERA capture 00254 * @retval None 00255 */ 00256 void BSP_CAMERA_Resume(void) 00257 { 00258 /* Start the Camera Capture */ 00259 HAL_DCMI_Resume(&hDcmiHandler); 00260 } 00261 00262 /** 00263 * @brief Stop the CAMERA capture 00264 * @retval Camera status 00265 */ 00266 uint8_t BSP_CAMERA_Stop(void) 00267 { 00268 uint8_t status = CAMERA_ERROR; 00269 00270 if(HAL_DCMI_Stop(&hDcmiHandler) == HAL_OK) 00271 { 00272 status = CAMERA_OK; 00273 } 00274 00275 /* Set Camera in Power Down */ 00276 BSP_CAMERA_PwrDown(); 00277 00278 return status; 00279 } 00280 00281 /** 00282 * @brief CANERA power up 00283 * @retval None 00284 */ 00285 void BSP_CAMERA_PwrUp(void) 00286 { 00287 GPIO_InitTypeDef gpio_init_structure; 00288 00289 /* Enable GPIO clock */ 00290 __HAL_RCC_GPIOH_CLK_ENABLE(); 00291 00292 /*** Configure the GPIO ***/ 00293 /* Configure DCMI GPIO as alternate function */ 00294 gpio_init_structure.Pin = GPIO_PIN_13; 00295 gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP; 00296 gpio_init_structure.Pull = GPIO_NOPULL; 00297 gpio_init_structure.Speed = GPIO_SPEED_HIGH; 00298 HAL_GPIO_Init(GPIOH, &gpio_init_structure); 00299 00300 /* De-assert the camera POWER_DOWN pin (active high) */ 00301 HAL_GPIO_WritePin(GPIOH, GPIO_PIN_13, GPIO_PIN_RESET); 00302 00303 wait_ms(3); /* POWER_DOWN de-asserted during 3ms */ 00304 } 00305 00306 /** 00307 * @brief CAMERA power down 00308 * @retval None 00309 */ 00310 void BSP_CAMERA_PwrDown(void) 00311 { 00312 GPIO_InitTypeDef gpio_init_structure; 00313 00314 /* Enable GPIO clock */ 00315 __HAL_RCC_GPIOH_CLK_ENABLE(); 00316 00317 /*** Configure the GPIO ***/ 00318 /* Configure DCMI GPIO as alternate function */ 00319 gpio_init_structure.Pin = GPIO_PIN_13; 00320 gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP; 00321 gpio_init_structure.Pull = GPIO_NOPULL; 00322 gpio_init_structure.Speed = GPIO_SPEED_HIGH; 00323 HAL_GPIO_Init(GPIOH, &gpio_init_structure); 00324 00325 /* Assert the camera POWER_DOWN pin (active high) */ 00326 HAL_GPIO_WritePin(GPIOH, GPIO_PIN_13, GPIO_PIN_SET); 00327 } 00328 00329 /** 00330 * @brief Configures the camera contrast and brightness. 00331 * @param contrast_level: Contrast level 00332 * This parameter can be one of the following values: 00333 * @arg CAMERA_CONTRAST_LEVEL4: for contrast +2 00334 * @arg CAMERA_CONTRAST_LEVEL3: for contrast +1 00335 * @arg CAMERA_CONTRAST_LEVEL2: for contrast 0 00336 * @arg CAMERA_CONTRAST_LEVEL1: for contrast -1 00337 * @arg CAMERA_CONTRAST_LEVEL0: for contrast -2 00338 * @param brightness_level: Contrast level 00339 * This parameter can be one of the following values: 00340 * @arg CAMERA_BRIGHTNESS_LEVEL4: for brightness +2 00341 * @arg CAMERA_BRIGHTNESS_LEVEL3: for brightness +1 00342 * @arg CAMERA_BRIGHTNESS_LEVEL2: for brightness 0 00343 * @arg CAMERA_BRIGHTNESS_LEVEL1: for brightness -1 00344 * @arg CAMERA_BRIGHTNESS_LEVEL0: for brightness -2 00345 * @retval None 00346 */ 00347 void BSP_CAMERA_ContrastBrightnessConfig(uint32_t contrast_level, uint32_t brightness_level) 00348 { 00349 if(camera_drv->Config != NULL) 00350 { 00351 camera_drv->Config(CameraHwAddress, CAMERA_CONTRAST_BRIGHTNESS, contrast_level, brightness_level); 00352 } 00353 } 00354 00355 /** 00356 * @brief Configures the camera white balance. 00357 * @param Mode: black_white mode 00358 * This parameter can be one of the following values: 00359 * @arg CAMERA_BLACK_WHITE_BW 00360 * @arg CAMERA_BLACK_WHITE_NEGATIVE 00361 * @arg CAMERA_BLACK_WHITE_BW_NEGATIVE 00362 * @arg CAMERA_BLACK_WHITE_NORMAL 00363 * @retval None 00364 */ 00365 void BSP_CAMERA_BlackWhiteConfig(uint32_t Mode) 00366 { 00367 if(camera_drv->Config != NULL) 00368 { 00369 camera_drv->Config(CameraHwAddress, CAMERA_BLACK_WHITE, Mode, 0); 00370 } 00371 } 00372 00373 /** 00374 * @brief Configures the camera color effect. 00375 * @param Effect: Color effect 00376 * This parameter can be one of the following values: 00377 * @arg CAMERA_COLOR_EFFECT_ANTIQUE 00378 * @arg CAMERA_COLOR_EFFECT_BLUE 00379 * @arg CAMERA_COLOR_EFFECT_GREEN 00380 * @arg CAMERA_COLOR_EFFECT_RED 00381 * @retval None 00382 */ 00383 void BSP_CAMERA_ColorEffectConfig(uint32_t Effect) 00384 { 00385 if(camera_drv->Config != NULL) 00386 { 00387 camera_drv->Config(CameraHwAddress, CAMERA_COLOR_EFFECT, Effect, 0); 00388 } 00389 } 00390 00391 /** 00392 * @brief Get the capture size in pixels unit. 00393 * @param resolution: the current resolution. 00394 * @retval capture size in pixels unit. 00395 */ 00396 static uint32_t GetSize(uint32_t resolution) 00397 { 00398 uint32_t size = 0; 00399 00400 /* Get capture size */ 00401 switch (resolution) 00402 { 00403 case CAMERA_R160x120: 00404 { 00405 size = 0x2580; 00406 } 00407 break; 00408 case CAMERA_R320x240: 00409 { 00410 size = 0x9600; 00411 } 00412 break; 00413 case CAMERA_R480x272: 00414 { 00415 size = 0xFF00; 00416 } 00417 break; 00418 case CAMERA_R640x480: 00419 { 00420 size = 0x25800; 00421 } 00422 break; 00423 default: 00424 { 00425 break; 00426 } 00427 } 00428 00429 return size; 00430 } 00431 00432 /** 00433 * @brief Initializes the DCMI MSP. 00434 * @param hdcmi: HDMI handle 00435 * @param Params 00436 * @retval None 00437 */ 00438 __weak void BSP_CAMERA_MspInit(DCMI_HandleTypeDef *hdcmi, void *Params) 00439 { 00440 static DMA_HandleTypeDef hdma_handler; 00441 GPIO_InitTypeDef gpio_init_structure; 00442 00443 /*** Enable peripherals and GPIO clocks ***/ 00444 /* Enable DCMI clock */ 00445 __HAL_RCC_DCMI_CLK_ENABLE(); 00446 00447 /* Enable DMA2 clock */ 00448 __HAL_RCC_DMA2_CLK_ENABLE(); 00449 00450 /* Enable GPIO clocks */ 00451 __HAL_RCC_GPIOA_CLK_ENABLE(); 00452 __HAL_RCC_GPIOD_CLK_ENABLE(); 00453 __HAL_RCC_GPIOE_CLK_ENABLE(); 00454 __HAL_RCC_GPIOG_CLK_ENABLE(); 00455 __HAL_RCC_GPIOH_CLK_ENABLE(); 00456 00457 /*** Configure the GPIO ***/ 00458 /* Configure DCMI GPIO as alternate function */ 00459 gpio_init_structure.Pin = GPIO_PIN_4 | GPIO_PIN_6; 00460 gpio_init_structure.Mode = GPIO_MODE_AF_PP; 00461 gpio_init_structure.Pull = GPIO_PULLUP; 00462 gpio_init_structure.Speed = GPIO_SPEED_HIGH; 00463 gpio_init_structure.Alternate = GPIO_AF13_DCMI; 00464 HAL_GPIO_Init(GPIOA, &gpio_init_structure); 00465 00466 gpio_init_structure.Pin = GPIO_PIN_3; 00467 gpio_init_structure.Mode = GPIO_MODE_AF_PP; 00468 gpio_init_structure.Pull = GPIO_PULLUP; 00469 gpio_init_structure.Speed = GPIO_SPEED_HIGH; 00470 gpio_init_structure.Alternate = GPIO_AF13_DCMI; 00471 HAL_GPIO_Init(GPIOD, &gpio_init_structure); 00472 00473 gpio_init_structure.Pin = GPIO_PIN_5 | GPIO_PIN_6; 00474 gpio_init_structure.Mode = GPIO_MODE_AF_PP; 00475 gpio_init_structure.Pull = GPIO_PULLUP; 00476 gpio_init_structure.Speed = GPIO_SPEED_HIGH; 00477 gpio_init_structure.Alternate = GPIO_AF13_DCMI; 00478 HAL_GPIO_Init(GPIOE, &gpio_init_structure); 00479 00480 gpio_init_structure.Pin = GPIO_PIN_9; 00481 gpio_init_structure.Mode = GPIO_MODE_AF_PP; 00482 gpio_init_structure.Pull = GPIO_PULLUP; 00483 gpio_init_structure.Speed = GPIO_SPEED_HIGH; 00484 gpio_init_structure.Alternate = GPIO_AF13_DCMI; 00485 HAL_GPIO_Init(GPIOG, &gpio_init_structure); 00486 00487 gpio_init_structure.Pin = GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 |\ 00488 GPIO_PIN_12 | GPIO_PIN_14; 00489 gpio_init_structure.Mode = GPIO_MODE_AF_PP; 00490 gpio_init_structure.Pull = GPIO_PULLUP; 00491 gpio_init_structure.Speed = GPIO_SPEED_HIGH; 00492 gpio_init_structure.Alternate = GPIO_AF13_DCMI; 00493 HAL_GPIO_Init(GPIOH, &gpio_init_structure); 00494 00495 /*** Configure the DMA ***/ 00496 /* Set the parameters to be configured */ 00497 hdma_handler.Init.Channel = DMA_CHANNEL_1; 00498 hdma_handler.Init.Direction = DMA_PERIPH_TO_MEMORY; 00499 hdma_handler.Init.PeriphInc = DMA_PINC_DISABLE; 00500 hdma_handler.Init.MemInc = DMA_MINC_ENABLE; 00501 hdma_handler.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; 00502 hdma_handler.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; 00503 hdma_handler.Init.Mode = DMA_CIRCULAR; 00504 hdma_handler.Init.Priority = DMA_PRIORITY_HIGH; 00505 hdma_handler.Init.FIFOMode = DMA_FIFOMODE_DISABLE; 00506 hdma_handler.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; 00507 hdma_handler.Init.MemBurst = DMA_MBURST_SINGLE; 00508 hdma_handler.Init.PeriphBurst = DMA_PBURST_SINGLE; 00509 00510 hdma_handler.Instance = DMA2_Stream1; 00511 00512 /* Associate the initialized DMA handle to the DCMI handle */ 00513 __HAL_LINKDMA(hdcmi, DMA_Handle, hdma_handler); 00514 00515 /*** Configure the NVIC for DCMI and DMA ***/ 00516 /* NVIC configuration for DCMI transfer complete interrupt */ 00517 HAL_NVIC_SetPriority(DCMI_IRQn, 0x0F, 0); 00518 HAL_NVIC_EnableIRQ(DCMI_IRQn); 00519 00520 /* NVIC configuration for DMA2D transfer complete interrupt */ 00521 HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 0x0F, 0); 00522 HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn); 00523 00524 /* Configure the DMA stream */ 00525 HAL_DMA_Init(hdcmi->DMA_Handle); 00526 } 00527 00528 00529 /** 00530 * @brief DeInitializes the DCMI MSP. 00531 * @param hdcmi: HDMI handle 00532 * @param Params 00533 * @retval None 00534 */ 00535 __weak void BSP_CAMERA_MspDeInit(DCMI_HandleTypeDef *hdcmi, void *Params) 00536 { 00537 /* Disable NVIC for DCMI transfer complete interrupt */ 00538 HAL_NVIC_DisableIRQ(DCMI_IRQn); 00539 00540 /* Disable NVIC for DMA2 transfer complete interrupt */ 00541 HAL_NVIC_DisableIRQ(DMA2_Stream1_IRQn); 00542 00543 /* Configure the DMA stream */ 00544 HAL_DMA_DeInit(hdcmi->DMA_Handle); 00545 00546 /* Disable DCMI clock */ 00547 __HAL_RCC_DCMI_CLK_DISABLE(); 00548 00549 /* GPIO pins clock and DMA clock can be shut down in the application 00550 by surcharging this __weak function */ 00551 } 00552 00553 /** 00554 * @brief Line event callback 00555 * @param hdcmi: pointer to the DCMI handle 00556 * @retval None 00557 */ 00558 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi) 00559 { 00560 BSP_CAMERA_LineEventCallback(); 00561 } 00562 00563 /** 00564 * @brief Line Event callback. 00565 * @retval None 00566 */ 00567 __weak void BSP_CAMERA_LineEventCallback(void) 00568 { 00569 /* NOTE : This function Should not be modified, when the callback is needed, 00570 the HAL_DCMI_LineEventCallback could be implemented in the user file 00571 */ 00572 } 00573 00574 /** 00575 * @brief VSYNC event callback 00576 * @param hdcmi: pointer to the DCMI handle 00577 * @retval None 00578 */ 00579 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi) 00580 { 00581 BSP_CAMERA_VsyncEventCallback(); 00582 } 00583 00584 /** 00585 * @brief VSYNC Event callback. 00586 * @retval None 00587 */ 00588 __weak void BSP_CAMERA_VsyncEventCallback(void) 00589 { 00590 /* NOTE : This function Should not be modified, when the callback is needed, 00591 the HAL_DCMI_VsyncEventCallback could be implemented in the user file 00592 */ 00593 } 00594 00595 /** 00596 * @brief Frame event callback 00597 * @param hdcmi: pointer to the DCMI handle 00598 * @retval None 00599 */ 00600 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi) 00601 { 00602 BSP_CAMERA_FrameEventCallback(); 00603 } 00604 00605 /** 00606 * @brief Frame Event callback. 00607 * @retval None 00608 */ 00609 __weak void BSP_CAMERA_FrameEventCallback(void) 00610 { 00611 /* NOTE : This function Should not be modified, when the callback is needed, 00612 the HAL_DCMI_FrameEventCallback could be implemented in the user file 00613 */ 00614 } 00615 00616 /** 00617 * @brief Error callback 00618 * @param hdcmi: pointer to the DCMI handle 00619 * @retval None 00620 */ 00621 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi) 00622 { 00623 BSP_CAMERA_ErrorCallback(); 00624 } 00625 00626 /** 00627 * @brief Error callback. 00628 * @retval None 00629 */ 00630 __weak void BSP_CAMERA_ErrorCallback(void) 00631 { 00632 /* NOTE : This function Should not be modified, when the callback is needed, 00633 the HAL_DCMI_ErrorCallback could be implemented in the user file 00634 */ 00635 } 00636 00637 /** 00638 * @} 00639 */ 00640 00641 /** 00642 * @} 00643 */ 00644 00645 /** 00646 * @} 00647 */ 00648 00649 /** 00650 * @} 00651 */ 00652 00653 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 19:15:26 by 1.7.2