HAL DCMI How to Use ¶
- group DCMI_How_To_Use
-
How to use the DCMI HAL module 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 must be made before configuring and enabling the DCMI to capture images.
A set of functions allowing to initialize the HAL DCMI driver and link it to a physical DCMI peripheral instance and to deinitialize the DCMI peripheral by aborting/stopping any ongoing process and resetting the HAL DCMI handle state:
Mandatory Configuration ¶
-
Requirements configuration programmed via the following parameters: horizontal/vertical polarity, pixel clock polarity, image format and data width using HAL_DCMI_PARALLEL_SetConfig() function and for the Capture Rate is configured by HAL_DCMI_SetConfigPipe()
Optional Configuration ¶
-
Embedded synchronisation mode can be selected and configured the code attached to the frame through these functions:
-
The Horizontal/Vertical resolution can be adjusted using the following functions:
-
The CROP feature is configured and enabled to select a window from the image received using these functions:
HAL_DCMI_StartPipe_DMA() : Start a frame capture process according to the given parameters: capture mode (continuous/snapshot), destination memory Buffer address and the data length
HAL_DCMI_StartPipe_DMA_Opt() : Provide one additional parameter allowing to select the optional interrupts that can be enabled during the capture process
Configure the selected DMA channel to transfer Data from DCMI DR register to the destination memory buffer.
The capture can be stopped using HAL_DCMI_StopPipe_DMA() function.
The capture can be suspend using HAL_DCMI_SuspendPipe() function and resume by HAL_DCMI_ResumePipe() function.
Callback registration ¶
-
When the compilation flag USE_HAL_DCMI_REGISTER_CALLBACKS is set to 1, it allows the user to configure dynamically the driver callbacks instead of weak functions:
-
HAL_DCMI_PipeStopCallback() : DCMI Pipe stop callback.
-
HAL_DCMI_PipeFrameEventCallback() : DCMI Pipe frame event callback.
-
HAL_DCMI_PipeVsyncEventCallback() : DCMI Pipe Vsync event callback.
-
HAL_DCMI_PipeLineEventCallback() : DCMI Pipe line event callback.
-
HAL_DCMI_PipeErrorCallback() : DCMI Pipe error callback.
-
HAL_DCMI_ErrorCallback() : DCMI error callback.
-
-
When the compilation flag USE_HAL_DCMI_REGISTER_CALLBACKS is set to 0 or not defined, the callback registration feature is not available and all callbacks are set to the corresponding weak functions or in this case user can provide his own implementation of these weak functions at user application side.
-