In the Camera asynchronous driver, a callback function can be registered in the driver by the application and triggered when the capture is done.
The Camera interface driver supports the CMOS sensor data format configuration and data stream capture. The "Image Sensor" middleware is used to select which image sensor is to be used.
Initialize and deinitialize the driver and associated hardware
Enabling and disabling
Hookup callback handlers on capture done
Data stream capture
Select input data stream format
Select input data stream path
Set vertical and horizontal size of the image sensor
Set vertical and horizontal size of the preview path
Which clock source is used
After the Camera hardware initialization, the application can register a callback function for capture done by camera_async_register_callback.
The following shows a simple example of using the Camera. The Camera must have been initialized by camera_async_init. This initialization will configure the operation of the Camera, such as input pins, Camera configuration, and interrupt configuration, etc.
The example registers a callback function for capture done and enables the Camera to start recording.
/** * Example of using CAMERA_0. */ static void capture_cb(struct camera_async_descriptor *const descr, uint32_t ch) { if (ch == 0) { // Application can process data in frame_buf. camera_async_capture_start(&CAMERA_0, 0, frame_buf); } } /** * Application example. */ void CAMERA_0_example(void) { camera_async_register_callback(&CAMERA_0, capture_cb); camera_async_enable(&CAMERA_0); camera_async_capture_start(&CAMERA_0, 0, frame_buf); }
The Camera peripheral and its related I/O lines and clocks
The NVIC must be configured so that Camera interrupt requests are periodically serviced