The MCUXpresso SDK provides a driver for the camera function using Flexible I/O.
FlexIO Camera driver includes functional APIs and eDMA transactional APIs. Functional APIs target low level APIs. Users can use functional APIs for FlexIO Camera initialization/configuration/operation purpose. Using the functional API requires knowledge of the FlexIO Camera peripheral and how to organize functional APIs to meet the requirements of the 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 target high-level APIs. Users 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 satisfy requirements. If the code size and performance are critical requirements, see the transactional API implementation and write custom code. All transactional APIs use the flexio_camera_edma_handle_t as the second parameter. Users need to initialize the handle by calling the FLEXIO_CAMERA_TransferCreateHandleEDMA() API.
eDMA transactional APIs support asynchronous receive. This means that the functions FLEXIO_CAMERA_TransferReceiveEDMA() set up an interrupt for data receive. When the receive is complete, the upper layer is notified through a callback function with the status kStatus_FLEXIO_CAMERA_RxIdle.
Typical use case
FlexIO Camera Receive using eDMA method
volatile uint32_t isEDMAGetOnePictureFinish = false;
flexio_camera_edma_handle_t g_cameraEdmaHandle;
.datPinStartIdx = 24U,
.pclkPinIdx = 1U,
.hrefPinIdx = 18U,
.shifterStartIdx = 0U,
.shifterCount = 8U,
.timerIdx = 0U};
&g_edmaHandle);
cameraTransfer.dataAddress = (uint32_t)u16CameraFrameBuffer;
cameraTransfer.dataNum = sizeof(u16CameraFrameBuffer);
while (!(isEDMAGetOnePictureFinish))
{
;
}
flexio_camera_edma_handle_t *handle,
void *userData)
{
userData = userData;
{
isEDMAGetOnePictureFinish = true;
}
}
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 are 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, 3)) |
#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, call FLEXO_CAMERA_Init to use the FlexIO Camera module.
- Parameters
-
- Parameters
-
base | Pointer to the FLEXIO_CAMERA_Type |
enable | True to enable, false does not have any effect. |
- Parameters
-
- Returns
- FlexIO shifter status flags
- FLEXIO_SHIFTSTAT_SSF_MASK
- 0
- Parameters
-
base | Pointer to the device. |
mask | status flag The parameter can 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 channels, 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 keeps the data with count of base->shifterCount .