The ADC driver provides API to configure the ADC module. Below are the high level features supported by the ADC driver.
Features Supported
- Configuration of parameters: mode, open delay etc
- Configuration of FIFO threshold levels
- Configuration of range of data for the ADC conversion result
- Generation of interrupt when the the conversion result exceeds the range
- Programmable averaging of input samples. The number of samples taken for averaging can be configured
- Support for getting the number of words present in the FIFO and also reading the FIFO data
- Support for enabling/disabling various interrupts
- Get ADC interrupt status register to determine the source of interrupt
SysConfig Features
- Note
- It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
- Selection of input channels.
Features NOT Supported
Important Usage Guidelines
- Global initialization of surrounding modules must be done after a device reset (Please refer TRM)
- A minimum wait for 4 us is required before starting a conversion to provide time for AFE to power up. The user needs to ensure this.
Example Usage
Include the below file to access the APIs
Initialize ADC
uint32_t errOffset = 1;
uint32_t calibration = 1;
ADCInit(adcBaseAddr, TRUE, errOffset, calibration);
Get FIFO threshold level
DebugP_log(
"Number of words after which interrupt to CPU will be generated for FIFO0 is : %i\r\n", level);
Check if ADC is powered up or not
if(TRUE == status)
{
}
else
{
}
API
APIs for ADC