STM32769I_EVAL BSP User Manual: stm32f769i_eval_camera.c Source File

STM32769I EVAL BSP Drivers

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