STM32446E_EVAL BSP User Manual: stm32446e_eval_camera.c Source File

STM32446E EVAL BSP Drivers

stm32446e_eval_camera.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32446e_eval_camera.c
00004   * @author  MCD Application Team
00005   * @version V1.1.1
00006   * @date    13-January-2016
00007   * @brief   This file includes the driver for Camera modules mounted on
00008   *          STM32446E-EVAL evaluation board.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; COPYRIGHT(c) 2015 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 "stm32446e_eval_camera.h"
00068 
00069 /** @addtogroup BSP
00070   * @{
00071   */
00072 
00073 /** @addtogroup STM32446E_EVAL
00074   * @{
00075   */
00076     
00077 /** @defgroup STM32446E_EVAL_CAMERA STM32446E-EVAL CAMERA
00078   * @{
00079   */ 
00080 
00081 /** @defgroup STM32446E_EVAL_CAMERA_Private_TypesDefinitions STM32446E EVAL CAMERA Private TypesDefinitions
00082   * @{
00083   */ 
00084 /**
00085   * @}
00086   */ 
00087 
00088 /** @defgroup STM32446E_EVAL_CAMERA_Private_Defines STM32446E EVAL CAMERA Private Defines
00089   * @{
00090   */
00091 /**
00092   * @}
00093   */ 
00094   
00095 /** @defgroup STM32446E_EVAL_CAMERA_Private_Macros STM32446E EVAL CAMERA Private Macros
00096   * @{
00097   */
00098 /**
00099   * @}
00100   */  
00101 
00102 /** @defgroup STM32446E_EVAL_CAMERA_Private_Variables STM32446E EVAL CAMERA Private Variables
00103   * @{
00104   */ 
00105   
00106   /*
00107 Note: 
00108   camera_drv variable is not compliant to naming rules (upper case without "_" ), 
00109   but we keep this naming for compatibility, in fact these variables (not static)
00110   could have been used by the application, example the stm32f4xx_it.c.
00111 */
00112 CAMERA_DrvTypeDef   *camera_drv;
00113 
00114 static DCMI_HandleTypeDef  hDcmiEval;
00115 uint32_t currentResolution;
00116 static uint32_t  cameraHwAddress;
00117 /**
00118   * @}
00119   */ 
00120   
00121 /** @defgroup STM32446E_EVAL_CAMERA_Private_FunctionPrototypes STM32446E EVAL CAMERA Private FunctionPrototypes
00122   * @{
00123   */
00124 static uint32_t GetSize(uint32_t Resolution);
00125 /**
00126   * @}
00127   */ 
00128   
00129 /** @defgroup STM32446E_EVAL_CAMERA_Private_Functions STM32446E EVAL CAMERA Private Functions
00130   * @{
00131   */
00132 
00133 /**
00134   * @brief  Initializes the camera.
00135   * @param  Resolution: camera resolution
00136   * @retval Camera status
00137   */
00138 uint8_t BSP_CAMERA_Init(uint32_t Resolution)
00139 { 
00140   DCMI_HandleTypeDef *phdcmi;
00141   
00142   uint8_t ret = CAMERA_ERROR;
00143   
00144   /* Get the DCMI handle structure */
00145   phdcmi = &hDcmiEval;
00146 
00147   /*** Configures the DCMI to interface with the camera module ***/
00148   /* DCMI configuration */
00149   phdcmi->Init.CaptureRate      = DCMI_CR_ALL_FRAME;
00150   phdcmi->Init.HSPolarity       = DCMI_HSPOLARITY_HIGH;
00151   phdcmi->Init.SynchroMode      = DCMI_SYNCHRO_HARDWARE;
00152   phdcmi->Init.VSPolarity       = DCMI_VSPOLARITY_HIGH;
00153   phdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
00154   phdcmi->Init.PCKPolarity      = DCMI_PCKPOLARITY_RISING;
00155   phdcmi->Init.ByteSelectMode   = DCMI_BSM_ALL;
00156   phdcmi->Init.ByteSelectStart  = DCMI_OEBS_ODD;
00157   phdcmi->Init.LineSelectMode   = DCMI_LSM_ALL;
00158   phdcmi->Init.LineSelectStart  = DCMI_OELS_ODD; 
00159   phdcmi->Instance              = DCMI;
00160 
00161   /* Configure IO functionalities for CAMERA detect pin */
00162   BSP_IO_Init(); 
00163   
00164   /* Apply Camera hardware reset */
00165   BSP_CAMERA_HwReset();
00166 
00167   /* Check if the CAMERA is plugged */
00168   if(BSP_IO_ReadPin(CAM_PLUG_PIN))
00169   {
00170     return CAMERA_ERROR;
00171   }
00172 
00173   if (s5k5cag_ReadID(CAMERA_I2C_ADDRESS) == S5K5CAG_ID)
00174   {
00175     /* Initialize the camera driver structure */
00176     camera_drv = &s5k5cag_drv;
00177     cameraHwAddress = CAMERA_I2C_ADDRESS;
00178 
00179     /* DCMI Initialization */
00180     BSP_CAMERA_MspInit(&hDcmiEval, NULL);
00181     HAL_DCMI_Init(phdcmi);
00182 
00183     /* Camera Init */
00184     camera_drv->Init(cameraHwAddress, Resolution);
00185 
00186     currentResolution = Resolution;
00187 
00188     /* Return CAMERA_OK status */
00189     ret = CAMERA_OK;
00190   }
00191   else
00192   {
00193     /* No supported camera sensor found */
00194     ret = CAMERA_ERROR;
00195   }
00196   
00197   return ret;
00198 }
00199 
00200 
00201 /**
00202   * @brief  DeInitializes the camera.
00203   * @retval Camera status
00204   */
00205 uint8_t BSP_CAMERA_DeInit(void)
00206 { 
00207   hDcmiEval.Instance              = DCMI;
00208 
00209   HAL_DCMI_DeInit(&hDcmiEval);
00210   BSP_CAMERA_MspDeInit(&hDcmiEval, NULL);
00211   return CAMERA_OK;
00212 }
00213 
00214 /**
00215   * @brief  Starts the camera capture in continuous mode.
00216   * @param  buff: pointer to the camera output buffer
00217   */
00218 void BSP_CAMERA_ContinuousStart(uint8_t *buff)
00219 { 
00220   /* Start the camera capture */
00221   HAL_DCMI_Start_DMA(&hDcmiEval, DCMI_MODE_CONTINUOUS, (uint32_t)buff, GetSize(currentResolution));  
00222 }
00223 
00224 /**
00225   * @brief  Starts the camera capture in snapshot mode.
00226   * @param  buff: pointer to the camera output buffer
00227   */
00228 void BSP_CAMERA_SnapshotStart(uint8_t *buff)
00229 { 
00230   /* Start the camera capture */
00231   HAL_DCMI_Start_DMA(&hDcmiEval, DCMI_MODE_SNAPSHOT, (uint32_t)buff, GetSize(currentResolution));  
00232 }
00233 
00234 /**
00235   * @brief Suspend the CAMERA capture 
00236   */
00237 void BSP_CAMERA_Suspend(void) 
00238 {
00239   /* Disable the DMA */
00240   __HAL_DMA_DISABLE(hDcmiEval.DMA_Handle);
00241   /* Disable the DCMI */
00242   __HAL_DCMI_DISABLE(&hDcmiEval);
00243   
00244 }
00245 
00246 /**
00247   * @brief Resume the CAMERA capture 
00248   */
00249 void BSP_CAMERA_Resume(void) 
00250 {
00251   /* Enable the DCMI */
00252   __HAL_DCMI_ENABLE(&hDcmiEval);
00253   /* Enable the DMA */
00254   __HAL_DMA_ENABLE(hDcmiEval.DMA_Handle);
00255 }
00256 
00257 /**
00258   * @brief  Stop the CAMERA capture 
00259   * @retval Camera status
00260   */
00261 uint8_t BSP_CAMERA_Stop(void) 
00262 {
00263   DCMI_HandleTypeDef *phdcmi;
00264   
00265   uint8_t ret = CAMERA_ERROR;
00266   
00267   /* Get the DCMI handle structure */
00268   phdcmi = &hDcmiEval;  
00269   
00270   if(HAL_DCMI_Stop(phdcmi) == HAL_OK)
00271   {
00272      ret = CAMERA_OK;
00273   }
00274   
00275   /* Set Camera in Power Down */
00276   BSP_CAMERA_PwrDown();
00277 
00278   return ret;
00279 }
00280 
00281 /**
00282   * @brief  CAMERA hardware reset
00283   */
00284 void BSP_CAMERA_HwReset(void)
00285 {
00286   /* Camera sensor RESET sequence */
00287   BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT);
00288   BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);
00289 
00290   /* Assert the camera STANDBY pin (active high)  */
00291   BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_SET);
00292 
00293   /* Assert the camera RSTI pin (active low) */
00294   BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET);
00295 
00296   HAL_Delay(100);   /* RST and XSDN signals asserted during 100ms */
00297 
00298   /* De-assert the camera STANDBY pin (active high) */
00299   BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET);
00300 
00301   HAL_Delay(3);     /* RST de-asserted and XSDN asserted during 3ms */
00302 
00303   /* De-assert the camera RSTI pin (active low) */
00304   BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_SET);
00305 
00306   HAL_Delay(6);     /* RST de-asserted during 3ms */
00307 }
00308 
00309 /**
00310   * @brief  CAMERA power down
00311   */
00312 void BSP_CAMERA_PwrDown(void)
00313 {
00314   /* Camera power down sequence */
00315   BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT);
00316   BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);
00317 
00318   /* De-assert the camera STANDBY pin (active high) */
00319   BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET);
00320 
00321   /* Assert the camera RSTI pin (active low) */
00322   BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET);
00323 }
00324 
00325 /**
00326   * @brief  Configures the camera contrast and brightness.
00327   * @param  contrast_level: Contrast level
00328   *          This parameter can be one of the following values:
00329   *            @arg  CAMERA_CONTRAST_LEVEL4: for contrast +2
00330   *            @arg  CAMERA_CONTRAST_LEVEL3: for contrast +1
00331   *            @arg  CAMERA_CONTRAST_LEVEL2: for contrast  0
00332   *            @arg  CAMERA_CONTRAST_LEVEL1: for contrast -1
00333   *            @arg  CAMERA_CONTRAST_LEVEL0: for contrast -2
00334   * @param  brightness_level: Contrast level
00335   *          This parameter can be one of the following values:
00336   *            @arg  CAMERA_BRIGHTNESS_LEVEL4: for brightness +2
00337   *            @arg  CAMERA_BRIGHTNESS_LEVEL3: for brightness +1
00338   *            @arg  CAMERA_BRIGHTNESS_LEVEL2: for brightness  0
00339   *            @arg  CAMERA_BRIGHTNESS_LEVEL1: for brightness -1
00340   *            @arg  CAMERA_BRIGHTNESS_LEVEL0: for brightness -2    
00341   */
00342 void BSP_CAMERA_ContrastBrightnessConfig(uint32_t contrast_level, uint32_t brightness_level)
00343 {
00344   if(camera_drv->Config != NULL)
00345   {
00346     camera_drv->Config(cameraHwAddress, CAMERA_CONTRAST_BRIGHTNESS, contrast_level, brightness_level);
00347   }  
00348 }
00349 
00350 /**
00351   * @brief  Configures the camera white balance.
00352   * @param  Mode: black_white mode
00353   *          This parameter can be one of the following values:
00354   *            @arg  CAMERA_BLACK_WHITE_BW
00355   *            @arg  CAMERA_BLACK_WHITE_NEGATIVE
00356   *            @arg  CAMERA_BLACK_WHITE_BW_NEGATIVE
00357   *            @arg  CAMERA_BLACK_WHITE_NORMAL       
00358   */
00359 void BSP_CAMERA_BlackWhiteConfig(uint32_t Mode)
00360 {
00361   if(camera_drv->Config != NULL)
00362   {
00363     camera_drv->Config(cameraHwAddress, CAMERA_BLACK_WHITE, Mode, 0);
00364   }  
00365 }
00366 
00367 /**
00368   * @brief  Configures the camera color effect.
00369   * @param  Effect: Color effect
00370   *          This parameter can be one of the following values:
00371   *            @arg  CAMERA_COLOR_EFFECT_ANTIQUE               
00372   *            @arg  CAMERA_COLOR_EFFECT_BLUE        
00373   *            @arg  CAMERA_COLOR_EFFECT_GREEN    
00374   *            @arg  CAMERA_COLOR_EFFECT_RED        
00375   */
00376 void BSP_CAMERA_ColorEffectConfig(uint32_t Effect)
00377 {
00378   if(camera_drv->Config != NULL)
00379   {
00380     camera_drv->Config(cameraHwAddress, CAMERA_COLOR_EFFECT, Effect, 0);
00381   }  
00382 }
00383 
00384 /**
00385   * @brief  Handles DCMI interrupt request.
00386   */
00387 void BSP_CAMERA_IRQHandler(void) 
00388 {
00389   HAL_DCMI_IRQHandler(&hDcmiEval);
00390 }
00391 
00392 /**
00393   * @brief  Handles DMA interrupt request.
00394   */
00395 void BSP_CAMERA_DMA_IRQHandler(void) 
00396 {
00397   HAL_DMA_IRQHandler(hDcmiEval.DMA_Handle);
00398 }
00399 
00400 /**
00401   * @brief  Get the capture size.
00402   * @param  Resolution: the current resolution.
00403   * @retval capture size.
00404   */
00405 static uint32_t GetSize(uint32_t Resolution)
00406 { 
00407   uint32_t size = 0;
00408   
00409   /* Get capture size */
00410   switch (Resolution)
00411   {
00412   case CAMERA_R160x120:
00413     {
00414       size =  0x2580;
00415     }
00416     break;    
00417   case CAMERA_R320x240:
00418     {
00419       size =  0x9600;
00420     }
00421     break;
00422   case CAMERA_R480x272:
00423     {
00424       size =  0xFF00;
00425     }
00426     break;
00427   case CAMERA_R640x480:
00428     {
00429       size =  0x25800;
00430     }    
00431     break;
00432   default:
00433     {
00434       break;
00435     }
00436   }
00437   
00438   return size;
00439 }
00440 
00441 /**
00442   * @brief  Initializes the DCMI MSP.
00443   * @param  hdcmi: HDMI handle 
00444   * @param  Params: pointer on additional configuration parameters, can be NULL.
00445   */
00446 __weak void BSP_CAMERA_MspInit(DCMI_HandleTypeDef *hdcmi, void *Params)
00447 {
00448   static DMA_HandleTypeDef hdma_eval;
00449   GPIO_InitTypeDef gpio_init_structure;
00450   
00451   /*** Enable peripherals and GPIO clocks ***/
00452   /* Enable DCMI clock */
00453   __HAL_RCC_DCMI_CLK_ENABLE();
00454 
00455   /* Enable DMA2 clock */
00456   __HAL_RCC_DMA2_CLK_ENABLE(); 
00457   
00458   /* Enable GPIO clocks */
00459   __HAL_RCC_GPIOA_CLK_ENABLE();
00460   __HAL_RCC_GPIOB_CLK_ENABLE();
00461   __HAL_RCC_GPIOC_CLK_ENABLE();
00462   __HAL_RCC_GPIOD_CLK_ENABLE();
00463   __HAL_RCC_GPIOE_CLK_ENABLE();
00464 
00465   /*** Configure the GPIO ***/
00466   /* Configure DCMI GPIO as alternate function */
00467   gpio_init_structure.Pin       = GPIO_PIN_4 | GPIO_PIN_6; 
00468   gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
00469   gpio_init_structure.Pull      = GPIO_PULLUP;
00470   gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
00471   gpio_init_structure.Alternate = GPIO_AF13_DCMI;  
00472   HAL_GPIO_Init(GPIOA, &gpio_init_structure);
00473  
00474 #if !defined(USE_STM32446E_EVAL_REVA)
00475   gpio_init_structure.Pin       = GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9; 
00476 #else
00477   gpio_init_structure.Pin       = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9; 
00478 #endif // !USE_STM32446E_EVAL_REVA
00479   gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
00480   gpio_init_structure.Pull      = GPIO_PULLUP;
00481   gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
00482   gpio_init_structure.Alternate = GPIO_AF13_DCMI;   
00483   HAL_GPIO_Init(GPIOB, &gpio_init_structure);
00484 
00485   gpio_init_structure.Pin       = GPIO_PIN_6 | GPIO_PIN_7  | GPIO_PIN_8  |\
00486                                   GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 |\
00487                                   GPIO_PIN_12; 
00488   gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
00489   gpio_init_structure.Pull      = GPIO_PULLUP;
00490   gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
00491   gpio_init_structure.Alternate = GPIO_AF13_DCMI;   
00492   HAL_GPIO_Init(GPIOC, &gpio_init_structure);
00493 
00494 #if !defined(USE_STM32446E_EVAL_REVA)
00495   gpio_init_structure.Pin       = GPIO_PIN_2 | GPIO_PIN_6; 
00496 #else
00497   gpio_init_structure.Pin       = GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_6; 
00498 #endif // !USE_STM32446E_EVAL_REVA
00499   gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
00500   gpio_init_structure.Pull      = GPIO_PULLUP;
00501   gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
00502   gpio_init_structure.Alternate = GPIO_AF13_DCMI;   
00503   HAL_GPIO_Init(GPIOD, &gpio_init_structure);
00504 
00505   
00506   /*** Configure the DMA ***/
00507   /* Set the parameters to be configured */
00508   hdma_eval.Init.Channel             = DMA_CHANNEL_1;
00509   hdma_eval.Init.Direction           = DMA_PERIPH_TO_MEMORY;
00510   hdma_eval.Init.PeriphInc           = DMA_PINC_DISABLE;
00511   hdma_eval.Init.MemInc              = DMA_MINC_ENABLE;
00512   hdma_eval.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
00513   hdma_eval.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
00514   hdma_eval.Init.Mode                = DMA_CIRCULAR;
00515   hdma_eval.Init.Priority            = DMA_PRIORITY_HIGH;
00516   hdma_eval.Init.FIFOMode            = DMA_FIFOMODE_DISABLE;         
00517   hdma_eval.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
00518   hdma_eval.Init.MemBurst            = DMA_MBURST_SINGLE;
00519   hdma_eval.Init.PeriphBurst         = DMA_PBURST_SINGLE; 
00520 
00521   hdma_eval.Instance = DMA2_Stream1;
00522 
00523   /* Associate the initialized DMA handle to the DCMI handle */
00524   __HAL_LINKDMA(hdcmi, DMA_Handle, hdma_eval);
00525   
00526   /*** Configure the NVIC for DCMI and DMA ***/
00527   /* NVIC configuration for DCMI transfer complete interrupt */
00528   HAL_NVIC_SetPriority(DCMI_IRQn, 5, 0);
00529   HAL_NVIC_EnableIRQ(DCMI_IRQn);  
00530   
00531   /* NVIC configuration for DMA2D transfer complete interrupt */
00532   HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 5, 0);
00533   HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
00534   
00535   /* Configure the DMA stream */
00536   HAL_DMA_Init(hdcmi->DMA_Handle);  
00537 }
00538 
00539 
00540 /**
00541   * @brief  DeInitializes the DCMI MSP.
00542   * @param  hdcmi: HDMI handle 
00543   * @param  Params: pointer on additional configuration parameters, can be NULL.
00544   */
00545 __weak void BSP_CAMERA_MspDeInit(DCMI_HandleTypeDef *hdcmi, void *Params)
00546 {
00547     /* Disable NVIC  for DCMI transfer complete interrupt */
00548     HAL_NVIC_DisableIRQ(DCMI_IRQn);  
00549   
00550     /* Disable NVIC for DMA2 transfer complete interrupt */
00551     HAL_NVIC_DisableIRQ(DMA2_Stream1_IRQn);
00552   
00553     /* Configure the DMA stream */
00554     HAL_DMA_DeInit(hdcmi->DMA_Handle);  
00555 
00556     /* Disable DCMI clock */
00557     __HAL_RCC_DCMI_CLK_DISABLE();
00558 
00559     /* GPIO pins clock and DMA clock can be shut down in the application 
00560        by surcharging this __weak function */ 
00561 }
00562 
00563 /**
00564   * @brief  Line event callback
00565   * @param  hdcmi: pointer to the DCMI handle  
00566   */
00567 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi)
00568 {        
00569   BSP_CAMERA_LineEventCallback();
00570 }
00571 
00572 /**
00573   * @brief  Line Event callback.
00574   */
00575 __weak void BSP_CAMERA_LineEventCallback(void)
00576 {
00577   /* NOTE : This function Should not be modified, when the callback is needed,
00578             the HAL_DCMI_LineEventCallback could be implemented in the user file
00579    */
00580 }
00581 
00582 /**
00583   * @brief  VSYNC event callback
00584   * @param  hdcmi: pointer to the DCMI handle  
00585   */
00586 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi)
00587 {        
00588   BSP_CAMERA_VsyncEventCallback();
00589 }
00590 
00591 /**
00592   * @brief  VSYNC Event callback.
00593   */
00594 __weak void BSP_CAMERA_VsyncEventCallback(void)
00595 {
00596   /* NOTE : This function Should not be modified, when the callback is needed,
00597             the HAL_DCMI_VsyncEventCallback could be implemented in the user file
00598    */
00599 }
00600 
00601 /**
00602   * @brief  Frame event callback
00603   * @param  hdcmi: pointer to the DCMI handle  
00604   */
00605 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
00606 {        
00607   BSP_CAMERA_FrameEventCallback();
00608 }
00609 
00610 /**
00611   * @brief  Frame Event callback.
00612   */
00613 __weak void BSP_CAMERA_FrameEventCallback(void)
00614 {
00615   /* NOTE : This function Should not be modified, when the callback is needed,
00616             the HAL_DCMI_FrameEventCallback could be implemented in the user file
00617    */
00618 }
00619 
00620 /**
00621   * @brief  Error callback
00622   * @param  hdcmi: pointer to the DCMI handle  
00623   */
00624 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi)
00625 {        
00626   BSP_CAMERA_ErrorCallback();
00627 }
00628 
00629 /**
00630   * @brief  Error callback.
00631   */
00632 __weak void BSP_CAMERA_ErrorCallback(void)
00633 {
00634   /* NOTE : This function Should not be modified, when the callback is needed,
00635             the HAL_DCMI_ErrorCallback could be implemented in the user file
00636    */
00637 }
00638 
00639 /**
00640   * @}
00641   */  
00642   
00643 /**
00644   * @}
00645   */
00646   
00647 /**
00648   * @}
00649   */
00650   
00651 /**
00652   * @}
00653   */      
00654 
00655 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Fri Jan 15 2016 10:06:21 for STM32446E_EVAL BSP User Manual by   doxygen 1.7.6.1