The KSDK provides driver for the camera function using Flexible I/O.
Overview
FlexIO CAMERA driver includes 2 parts: functional APIs and EDMA transactional APIs. Functional APIs are feature/property target low level APIs. User can use functional APIs for FLEXIO CAMERA initialization/configuration/operation purpose. Using the functional API require user get knowledge of the FLEXIO CAMERA peripheral and know how to organize functional APIs to meet the requirement of application. All functional API use the FLEXIO_CAMERA_Type * as the first parameter. FLEXIO CAMERA functional operation groups provide the functional APIs set.
EDMA transactional APIs are transaction target high level APIs. User can use the transactional API to enable the peripheral quickly and can also use in the application if the code size and performance of transactional APIs can satisfy requirement. If the code size and performance are critical requirement, user can refer to the transactional API implementation and write their own code. All transactional APIs use the flexio_camera_edma_handle_t as the second parameter and user need to initialize the handle by calling FLEXIO_CAMERA_TransferCreateHandleEDMA() API.
EDMA transactional APIs support asynchronized receive. It means, the functions FLEXIO_CAMERA_TransferReceiveEDMA() setup interrupt for data receive, when the receive complete, upper layer is notified through callback function with status kStatus_FLEXIO_CAMERA_RxIdle.
Typical use case
FLEXIO CAMERA Receive in EDMA way
volatile uint32_t isEDMAGetOnePictureFinish = false;
flexio_camera_edma_handle_t g_cameraEdmaHandle;
.datPinStartIdx = 24U,
struct FLEXIO_CAMERA_Type |
FLEXIO_Type* FLEXIO_CAMERA_Type::flexioBase |
uint32_t FLEXIO_CAMERA_Type::datPinStartIdx |
Then the successive following FLEXIO_CAMERA_DATA_WIDTH-1 pins would be used as D1-D7.
uint32_t FLEXIO_CAMERA_Type::pclkPinIdx |
uint32_t FLEXIO_CAMERA_Type::hrefPinIdx |
uint32_t FLEXIO_CAMERA_Type::shifterStartIdx |
uint32_t FLEXIO_CAMERA_Type::shifterCount |
uint32_t FLEXIO_CAMERA_Type::timerIdx |
struct flexio_camera_config_t |
Data Fields |
bool | enablecamera |
| Enable/disable FLEXIO camera TX & RX. More...
|
|
bool | enableInDoze |
| Enable/disable FLEXIO operation in doze mode.
|
|
bool | enableInDebug |
| Enable/disable FLEXIO operation in debug mode.
|
|
bool | enableFastAccess |
| Enable/disable fast access to FLEXIO registers, fast access requires the FLEXIO clock to be at least twice the frequency of the bus clock. More...
|
|
bool flexio_camera_config_t::enablecamera |
bool flexio_camera_config_t::enableFastAccess |
struct flexio_camera_transfer_t |
#define FSL_FLEXIO_CAMERA_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) |
#define FLEXIO_CAMERA_PARALLEL_DATA_WIDTH (8U) |
Enumerator |
---|
kStatus_FLEXIO_CAMERA_RxBusy |
Receiver is busy.
|
kStatus_FLEXIO_CAMERA_RxIdle |
CAMERA receiver is idle.
|
Enumerator |
---|
kFLEXIO_CAMERA_RxDataRegFullFlag |
Receive buffer full flag.
|
kFLEXIO_CAMERA_RxErrorFlag |
Receive buffer error flag.
|
- Note
- After calling this API, user need to call FLEXO_CAMERA_Init to use the FlexIO CAMERA module.
- Parameters
-
- Parameters
-
- Returns
- FlexIO shifter status flags
- FLEXIO_SHIFTSTAT_SSF_MASK
- 0
- Parameters
-
base | pointer to the device. |
mask | status flag The parameter could be any combination of the following values:
- kFLEXIO_CAMERA_RxDataRegFullFlag
- kFLEXIO_CAMERA_RxErrorFlag
|
- Parameters
-
base | pointer to the device. |
- Parameters
-
base | pointer to the device. |
- Parameters
-
The FlexIO camera mode can't work without the DMA or EDMA support, Usually, it needs at least two DMA or EDMA channel, one for transferring data from camera, such as 0V7670 to FlexIO buffer, another is for transferring data from FlexIO buffer to LCD.
- Parameters
-
base | pointer to the device. |
- Returns
- data pointer to the buffer that would keep the data with count of base->shifterCount .