Camera Asynchronous Driver

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.

Summary of the API's Functional Features

The API provides functions to:
  • Initialize and deinitialize the driver and associated hardware

  • Enabling and disabling

  • Hookup callback handlers on capture done

  • Data stream capture

Summary of Configuration Options

Below is a list of the main Camera parameters that can be configured in START. Many of these parameters are used by the camera_async_init function when initializing the driver and underlying hardware. Most of the initial values can be overridden and changed runtime by calling the appropriate API functions.
  • 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

Driver Implementation Description

After the Camera hardware initialization, the application can register a callback function for capture done by camera_async_register_callback.

Example of Usage

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);
          }
        

Dependencies

  • The Camera peripheral and its related I/O lines and clocks

  • The NVIC must be configured so that Camera interrupt requests are periodically serviced