|
void | AUXADCDisable (void) |
| Disables the ADC. More...
|
|
void | AUXADCEnableAsync (uint32_t refSource, uint32_t trigger) |
| Enables the ADC for asynchronous operation. More...
|
|
void | AUXADCEnableSync (uint32_t refSource, uint32_t sampleTime, uint32_t trigger) |
| Enables the ADC for synchronous operation. More...
|
|
void | AUXADCEnableSyncNoBugWorkaround (uint32_t refSource, uint32_t sampleTime, uint32_t trigger) |
| Enables the ADC for synchronous operation. More...
|
|
void | AUXADCDisableInputScaling (void) |
| Disables scaling of the ADC input. More...
|
|
void | AUXADCFlushFifo (void) |
| Flushes the ADC FIFO. More...
|
|
static void | AUXADCGenManualTrigger (void) |
| Generates a single manual ADC trigger. More...
|
|
static uint32_t | AUXADCGetFifoStatus (void) |
| Returns flags indicating the status of the ADC FIFO. More...
|
|
uint32_t | AUXADCReadFifo (void) |
| Waits for and returns the first sample in the ADC FIFO. More...
|
|
uint32_t | AUXADCPopFifo (void) |
| Returns the first sample in the ADC FIFO, without waiting. More...
|
|
static void | AUXADCSelectInput (uint32_t input) |
| Selects internal or external input for the ADC. More...
|
|
int32_t | AUXADCGetAdjustmentGain (uint32_t refSource) |
| Returns the gain value used when adjusting for ADC gain/offset. More...
|
|
int32_t | AUXADCGetAdjustmentOffset (uint32_t refSource) |
| Returns the offset value used when adjusting for ADC gain/offset. More...
|
|
int32_t | AUXADCValueToMicrovolts (int32_t fixedRefVoltage, int32_t adcValue) |
| Converts an "adjusted" ADC value to microvolts. More...
|
|
int32_t | AUXADCMicrovoltsToValue (int32_t fixedRefVoltage, int32_t microvolts) |
| Converts a number of microvolts to corresponding "adjusted" ADC value. More...
|
|
int32_t | AUXADCAdjustValueForGainAndOffset (int32_t adcValue, int32_t gain, int32_t offset) |
| Performs ADC value gain and offset adjustment. More...
|
|
int32_t | AUXADCUnadjustValueForGainAndOffset (int32_t adcValue, int32_t gain, int32_t offset) |
| Performs the inverse of the ADC value gain and offset adjustment. More...
|
|
void AUXADCEnableAsync |
( |
uint32_t |
refSource, |
|
|
uint32_t |
trigger |
|
) |
| |
Enables the ADC for asynchronous operation.
In asynchronous operation, the ADC samples continuously between conversions.
The ADC trigger starts the conversion. Note that the first conversion may be invalid if the sampling period is too short.
ADC input scaling is enabled by default after device reset, and is also re- enabled by AUXADCDisable(). To disable input scaling, call AUXADCDisableInputScaling() before calling AUXADCEnableAsync().
- Parameters
-
refSource | ADC reference source:
|
trigger | ADC conversion trigger:
|
120 ADI8BitsSet(AUX_ADI4_BASE, ADI_4_AUX_O_ADCREF0, refSource | ADI_4_AUX_ADCREF0_EN_M);
123 HWREG(AUX_SYSIF_BASE + AUX_SYSIF_O_ADCCLKCTL) = AUX_SYSIF_ADCCLKCTL_REQ_M;
124 while (!(HWREG(AUX_SYSIF_BASE + AUX_SYSIF_O_ADCCLKCTL) & AUX_SYSIF_ADCCLKCTL_ACK_M));
129 HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCCTL) = AUX_ANAIF_ADCCTL_START_SRC_NO_EVENT | AUX_ANAIF_ADCCTL_CMD_EN;
132 HWREG(EVENT_BASE + EVENT_O_AUXSEL0) = trigger;
133 HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCCTL) = AUX_ANAIF_ADCCTL_START_SRC_MCU_EV | AUX_ANAIF_ADCCTL_CMD_EN;
137 ADI8BitsSet(AUX_ADI4_BASE, ADI_4_AUX_O_ADC0, ADI_4_AUX_ADC0_SMPL_MODE_M);
140 ADI8BitsSet(AUX_ADI4_BASE, ADI_4_AUX_O_ADC0, ADI_4_AUX_ADC0_EN_M | ADI_4_AUX_ADC0_RESET_N_M);
static void ADI8BitsSet(uint32_t ui32Base, uint32_t ui32Reg, uint8_t ui8Val)
Set specific bits in a single 8 bit ADI register.
Definition: adi.h:371
#define AUXADC_TRIGGER_MANUAL
Definition: aux_adc.h:125
void AUXADCEnableSyncNoBugWorkaround |
( |
uint32_t |
refSource, |
|
|
uint32_t |
sampleTime, |
|
|
uint32_t |
trigger |
|
) |
| |
Enables the ADC for synchronous operation.
The device can hang if we generate a manual ADC trigger immediately after enabling the ADC with this function and the Sensor Controller turns on or off the XOSC_HF as a reference for the TDC at the same time.
An application should be calling AUXADCEnableSync() instead.
In synchronous operation, the ADC is idle between a conversion and subsequent samplings.
The ADC trigger starts sampling with specified duration, followed by the conversion. Note that the first conversion may be invalid if the initial sampling period is too short.
ADC input scaling is enabled by default after device reset, and is also re- enabled by AUXADCDisable(). To disable input scaling, call AUXADCDisableInputScaling() before calling AUXADCEnableSync().
- Parameters
-
refSource | ADC reference source:
|
sampleTime | ADC sampling time:
|
trigger | ADC conversion trigger:
|
Referenced by AUXADCEnableSync().
156 uint8_t adcref0 = refSource | ADI_4_AUX_ADCREF0_EN_M;
158 adcref0 |= ADI_4_AUX_ADCREF0_REF_ON_IDLE_M;
160 ADI8BitsSet(AUX_ADI4_BASE, ADI_4_AUX_O_ADCREF0, adcref0);
163 HWREG(AUX_SYSIF_BASE + AUX_SYSIF_O_ADCCLKCTL) = AUX_SYSIF_ADCCLKCTL_REQ_M;
164 while (!(HWREG(AUX_SYSIF_BASE + AUX_SYSIF_O_ADCCLKCTL) & AUX_SYSIF_ADCCLKCTL_ACK_M));
169 HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCCTL) = AUX_ANAIF_ADCCTL_START_SRC_NO_EVENT | AUX_ANAIF_ADCCTL_CMD_EN;
172 HWREG(EVENT_BASE + EVENT_O_AUXSEL0) = trigger;
173 HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCCTL) = AUX_ANAIF_ADCCTL_START_SRC_MCU_EV | AUX_ANAIF_ADCCTL_CMD_EN;
177 ADI8BitsSet(AUX_ADI4_BASE, ADI_4_AUX_O_ADC0, sampleTime << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S);
180 ADI8BitsSet(AUX_ADI4_BASE, ADI_4_AUX_O_ADC0, ADI_4_AUX_ADC0_EN_M | ADI_4_AUX_ADC0_RESET_N_M);
#define AUXADC_SAMPLE_TIME_21P3_US
Definition: aux_adc.h:151
static void ADI8BitsSet(uint32_t ui32Base, uint32_t ui32Reg, uint8_t ui8Val)
Set specific bits in a single 8 bit ADI register.
Definition: adi.h:371
#define AUXADC_TRIGGER_MANUAL
Definition: aux_adc.h:125