AIROC™ BTSDK v4.9 - Documentation | ||||
Defines functions to access ADC peripheral. More...
Functions | |
void | adc_config (void) |
Initialize the ADC HW block. | |
void | adc_adcCalibrate (UINT32 refVoltageInMicroVolts, ADC_INPUT_CHANNEL_SEL referenceInput) |
Calibrate the ADC against a known (external) voltage. More... | |
INT16 | adc_readSampleRaw (ADC_INPUT_CHANNEL_SEL channel_idx) |
Read the analog to digital value on a given channel. More... | |
UINT32 | adc_readVoltage (ADC_INPUT_CHANNEL_SEL idx) |
Read the analog to digital value converted to volts on a given channel. More... | |
ADC_POWER_TYPE | adc_setPower (ADC_POWER_TYPE pwr) |
Powers on/off the ADC HW block. More... | |
void | adc_SetInputRange (ADC_INPUT_RANGE_SEL range_idx) |
Selects the input range of the ADC input channel. More... | |
UINT8 | adc_convertGPIOtoADCInput (UINT8 gpio) |
Convert GPIO to ADC input channel number. More... | |
UINT8 | adc_convertADCInputtoGPIO (UINT8 adcInput) |
Convert ADC input channel number to GPIO. More... | |
static INLINE void | adc_setAdcSampleFrequency (ADC_SAMPLE_FREQUENCY sample_frequency) |
Set the sampling frequency to use. More... | |
Defines functions to access ADC peripheral.
The ADC provides one-shot conversion of and input analog signal to a digital value (raw or converted to Volts). The maximum sampling rate is 187 KHz with 10 ENOB and the minimum conversion rate is 5.859 KHz.
void adc_adcCalibrate | ( | UINT32 | refVoltageInMicroVolts, |
ADC_INPUT_CHANNEL_SEL | referenceInput | ||
) |
Calibrate the ADC against a known (external) voltage.
refVoltageInMicroVolts | The voltage of the reference in uV. |
referenceInput | The ADC channel to which the reference is connected to. |
UINT8 adc_convertADCInputtoGPIO | ( | UINT8 | adcInput | ) |
Convert ADC input channel number to GPIO.
adcInput | The ADC input channel number. |
UINT8 adc_convertGPIOtoADCInput | ( | UINT8 | gpio | ) |
Convert GPIO to ADC input channel number.
gpio | The GPIO logical pin number from gpiodriver.h. |
INT16 adc_readSampleRaw | ( | ADC_INPUT_CHANNEL_SEL | channel_idx | ) |
Read the analog to digital value on a given channel.
If the ADC is power off, this function will power it on, read and then power it off.
channel_idx | The input channel to read from. |
UINT32 adc_readVoltage | ( | ADC_INPUT_CHANNEL_SEL | idx | ) |
Read the analog to digital value converted to volts on a given channel.
Uncalibrated readings are expected to be within +/-10% while calibrated values are expected to be better than +/-3%. Uses adc_readSampleRaw internally.
idx | The input channel to read from. |
|
static |
Set the sampling frequency to use.
Default is 5.859 KHz.
sample_frequency | The sample frequency to use. |
void adc_SetInputRange | ( | ADC_INPUT_RANGE_SEL | range_idx | ) |
Selects the input range of the ADC input channel.
This applies to all channels. Choose a range that will cover all ADC input channels.
range_idx | The input range of th signal being measured. |
ADC_POWER_TYPE adc_setPower | ( | ADC_POWER_TYPE | pwr | ) |
Powers on/off the ADC HW block.
When reading from a channel, it is not required to power on the ADC before the read.
pwr | On or off. |