Data Capture Interface Library
This library provides routines for controlling the Data Capture Interface (DCAP) module. This is an 8-bit parallel interface that collects byte streaming data
from a sensor peripheral - e.g. a camera module in a 2Kbyte internal FIFO. The interface will provide a clock to the peripheral at a speed of 25MHz (max).
Library Routines
- DCAP_Init
- DCAP_setCount
- DCAP_setTrigpats
- DCAP_setThreshold
- DCAP_setClockPolarity
- DCAP_hasData
- DCAP_drain
- DCAP_ReadFIFO
DCAP_Init
Prototype |
void DCAP_Init(); |
---|---|
Description |
This function will initialize Data Capture Interface, enables camera module clock and configures corresponding pins. |
Parameters |
None. |
Returns |
Nothing. |
Requires |
Nothing. |
Example |
// Enable camera module clock and config corresponding pins DCAP_Init(); |
Notes |
None. |
DCAP_setCount
Prototype |
void DCAP_setCount(uint32_t v); |
---|---|
Description |
This function will set the number of bytes to capture after the last trigger event. This must be in multiple of 4 bytes. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
// Set number of bytes to capture after the last trigger event DCAP_setCount(32); |
Notes |
None. |
DCAP_setTrigpat
Prototype |
void DCAP_setTrigpat(uint32_t v); |
---|---|
Description |
This specifies the data capture trigger position. Data capture starts on the cycle when trigger transitions from 0 to 1. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
// Set data capture trigger position DCAP_setTrigpat(2); |
Notes |
None. |
DCAP_setThreshold
Prototype |
void DCAP_setThreshold(uint32_t v); |
---|---|
Description |
This function specifies the threshold value for the HAS_DATA signal. It must be a multiple of 4 bytes. |
Parameters |
|
Returns |
None. |
Requires |
Nothing. |
Example |
// Set the threshold value DCAP_setThreshold(64); |
Notes |
None. |
DCAP_setClockPolarity
Prototype |
void DCAP_setClockPolarity(uint32_t v); |
||||||
---|---|---|---|---|---|---|---|
Description |
This function sets clock edge polarity on which the data will be captured. |
||||||
Parameters |
|
||||||
Returns |
None. |
||||||
Requires |
Nothing. |
||||||
Example |
// Set the Falling edge polarity DCAP_setClockPolarity(0); |
||||||
Notes |
None. |
DCAP_hasData
Prototype |
uint8_t DCAP_hasData(); |
---|---|
Description |
This function checks if there is at least threshold number of bytes (set by the DCAP_setThreshold routine) in FIFO buffer. |
Parameters |
None. |
Returns |
|
Requires |
This routine requires threshold to be set by the DCAP_setThreshold routine. |
Example |
// Wait while FIFO is filled while(DCAP_hasData() == 0) ; |
Notes |
None. |
DCAP_drain
Prototype |
void DCAP_drain(); |
---|---|
Description |
This function empties FIFO buffer. |
Parameters |
None. |
Returns |
Nothing. |
Requires |
Nothing. |
Example |
// Empty FIFO buffer DCAP_drain(); |
Notes |
None. |
DCAP_ReadFIFO
Prototype |
void DCAP_ReadFIFO(uint8_t * buffIn, unsigned long numOfButes); |
---|---|
Description |
This function will read data brom the FIFO buffer and store it in the data buffer. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
uint8_t buffer[16]; DCAP_ReadFIFO(&buffer, numOfBytes); // Read data from FIFO |
Notes |
The data acquisition performance from the FIFO buffer will be increased if the input buffer is aligned to 4. |
What do you think about this topic ? Send us feedback!