STM32F4xx HAL Driver master
STM32CubeF4 HAL / LL Drivers API Reference
Loading...
Searching...
No Matches
stm32f4xx_hal_dcmi.c File Reference

DCMI HAL module driver This file provides firmware functions to manage the following functionalities of the Digital Camera Interface (DCMI) peripheral: More...

#include "stm32f4xx_hal.h"
Include dependency graph for stm32f4xx_hal_dcmi.c:

Go to the source code of this file.

Detailed Description

DCMI HAL module driver This file provides firmware functions to manage the following functionalities of the Digital Camera Interface (DCMI) peripheral:

Author
MCD Application Team
  • Initialization and de-initialization functions
  • IO operation functions
  • Peripheral Control functions
  • Peripheral State and Error functions
Attention

Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

==============================================================================
                      ##### How to use this driver #####
==============================================================================
[..]
    The sequence below describes how to use this driver to capture image
    from a camera module connected to the DCMI Interface.
    This sequence does not take into account the configuration of the
    camera module, which should be made before to configure and enable
    the DCMI to capture images.

  (#) Program the required configuration through following parameters:
      horizontal and vertical polarity, pixel clock polarity, Capture Rate,
      Synchronization Mode, code of the frame delimiter and data width 
      using HAL_DCMI_Init() function.

  (#) Configure the DMA2_Stream1 channel1 to transfer Data from DCMI DR
      register to the destination memory buffer.

  (#) Program the required configuration through following parameters:
      DCMI mode, destination memory Buffer address and the data length
      and enable capture using HAL_DCMI_Start_DMA() function.

  (#) Optionally, configure and Enable the CROP feature to select a rectangular
      window from the received image using HAL_DCMI_ConfigCrop()
      and HAL_DCMI_EnableCROP() functions

  (#) The capture can be stopped using HAL_DCMI_Stop() function.

  (#) To control DCMI state you can use the function HAL_DCMI_GetState().

   *** DCMI HAL driver macros list ***
   =============================================
   [..]
     Below the list of most used macros in DCMI HAL driver.
     
    (+) __HAL_DCMI_ENABLE: Enable the DCMI peripheral.
    (+) __HAL_DCMI_DISABLE: Disable the DCMI peripheral.
    (+) __HAL_DCMI_GET_FLAG: Get the DCMI pending flags.
    (+) __HAL_DCMI_CLEAR_FLAG: Clear the DCMI pending flags.
    (+) __HAL_DCMI_ENABLE_IT: Enable the specified DCMI interrupts.
    (+) __HAL_DCMI_DISABLE_IT: Disable the specified DCMI interrupts.
    (+) __HAL_DCMI_GET_IT_SOURCE: Check whether the specified DCMI interrupt has occurred or not.

   [..]
     (@) You can refer to the DCMI HAL driver header file for more useful macros
    
  *** Callback registration ***
  =============================

  The compilation define USE_HAL_DCMI_REGISTER_CALLBACKS when set to 1
  allows the user to configure dynamically the driver callbacks.
  Use functions HAL_DCMI_RegisterCallback() to register a user callback.

  Function HAL_DCMI_RegisterCallback() allows to register following callbacks:
    (+) FrameEventCallback : DCMI Frame Event.
    (+) VsyncEventCallback : DCMI Vsync Event.
    (+) LineEventCallback  : DCMI Line Event.
    (+) ErrorCallback      : DCMI error.
    (+) MspInitCallback    : DCMI MspInit.
    (+) MspDeInitCallback  : DCMI MspDeInit.
  This function takes as parameters the HAL peripheral handle, the callback ID
  and a pointer to the user callback function.

  Use function HAL_DCMI_UnRegisterCallback() to reset a callback to the default
  weak (surcharged) function.
  HAL_DCMI_UnRegisterCallback() takes as parameters the HAL peripheral handle,
  and the callback ID.
  This function allows to reset following callbacks:
    (+) FrameEventCallback : DCMI Frame Event.
    (+) VsyncEventCallback : DCMI Vsync Event.
    (+) LineEventCallback  : DCMI Line Event.
    (+) ErrorCallback      : DCMI error.
    (+) MspInitCallback    : DCMI MspInit.
    (+) MspDeInitCallback  : DCMI MspDeInit.

  By default, after the HAL_DCMI_Init and if the state is HAL_DCMI_STATE_RESET
  all callbacks are reset to the corresponding legacy weak (surcharged) functions:
  examples FrameEventCallback(), HAL_DCMI_ErrorCallback().
  Exception done for MspInit and MspDeInit callbacks that are respectively
  reset to the legacy weak (surcharged) functions in the HAL_DCMI_Init
  and  HAL_DCMI_DeInit only when these callbacks are null (not registered beforehand).
  If not, MspInit or MspDeInit are not null, the HAL_DCMI_Init and HAL_DCMI_DeInit
  keep and use the user MspInit/MspDeInit callbacks (registered beforehand).

  Callbacks can be registered/unregistered in READY state only.
  Exception done for MspInit/MspDeInit callbacks that can be registered/unregistered
  in READY or RESET state, thus registered (user) MspInit/DeInit callbacks can be used
  during the Init/DeInit.
  In that case first register the MspInit/MspDeInit user callbacks
  using HAL_DCMI_RegisterCallback before calling HAL_DCMI_DeInit
  or HAL_DCMI_Init function.

  When the compilation define USE_HAL_DCMI_REGISTER_CALLBACKS is set to 0 or
  not defined, the callback registering feature is not available
  and weak (surcharged) callbacks are used.

Definition in file stm32f4xx_hal_dcmi.c.