40 #include <inc/hw_memmap.h>
41 #include <inc/hw_aux_wuc.h>
42 #include <inc/hw_fcfg1.h>
54 #define AUXADCDisable NOROM_AUXADCDisable
55 #undef AUXADCEnableAsync
56 #define AUXADCEnableAsync NOROM_AUXADCEnableAsync
57 #undef AUXADCEnableSync
58 #define AUXADCEnableSync NOROM_AUXADCEnableSync
59 #undef AUXADCDisableInputScaling
60 #define AUXADCDisableInputScaling NOROM_AUXADCDisableInputScaling
61 #undef AUXADCFlushFifo
62 #define AUXADCFlushFifo NOROM_AUXADCFlushFifo
64 #define AUXADCReadFifo NOROM_AUXADCReadFifo
66 #define AUXADCPopFifo NOROM_AUXADCPopFifo
67 #undef AUXADCGetAdjustmentGain
68 #define AUXADCGetAdjustmentGain NOROM_AUXADCGetAdjustmentGain
69 #undef AUXADCGetAdjustmentOffset
70 #define AUXADCGetAdjustmentOffset NOROM_AUXADCGetAdjustmentOffset
71 #undef AUXADCValueToMicrovolts
72 #define AUXADCValueToMicrovolts NOROM_AUXADCValueToMicrovolts
73 #undef AUXADCMicrovoltsToValue
74 #define AUXADCMicrovoltsToValue NOROM_AUXADCMicrovoltsToValue
75 #undef AUXADCAdjustValueForGainAndOffset
76 #define AUXADCAdjustValueForGainAndOffset NOROM_AUXADCAdjustValueForGainAndOffset
77 #undef AUXADCUnadjustValueForGainAndOffset
78 #define AUXADCUnadjustValueForGainAndOffset NOROM_AUXADCUnadjustValueForGainAndOffset
275 fixedRefVoltage >>= 4;
276 return (((adcValue * fixedRefVoltage) + (2048 >> 4)) / 4095) << 4;
288 fixedRefVoltage >>= 4;
290 return ((microvolts * 4095) + (fixedRefVoltage / 2)) / fixedRefVoltage;
302 adcValue = (((adcValue + offset) * gain) + 16384) / 32768;
307 }
else if (adcValue > 4095) {
323 adcValue = (((adcValue * 32768) + (gain / 2)) / gain) - offset;
328 }
else if (adcValue > 4095) {
static void ADI8BitsClear(uint32_t ui32Base, uint32_t ui32Reg, uint8_t ui8Val)
Clear specific bits in an 8 bit ADI register.
int32_t AUXADCAdjustValueForGainAndOffset(int32_t adcValue, int32_t gain, int32_t offset)
Performs ADC value gain and offset adjustment.
int32_t AUXADCGetAdjustmentGain(uint32_t refSource)
Returns the gain value used when adjusting for ADC gain/offset.
void AUXADCEnableAsync(uint32_t refSource, uint32_t trigger)
Enables the ADC for asynchronous operation.
void AUXADCDisable(void)
Disables the ADC.
int32_t AUXADCMicrovoltsToValue(int32_t fixedRefVoltage, int32_t microvolts)
Converts a number of microvolts to corresponding "adjusted" ADC value.
int32_t AUXADCUnadjustValueForGainAndOffset(int32_t adcValue, int32_t gain, int32_t offset)
Performs the inverse of the ADC value gain and offset adjustment.
uint32_t AUXADCPopFifo(void)
Returns the first sample in the ADC FIFO, without waiting.
void AUXADCEnableSync(uint32_t refSource, uint32_t sampleTime, uint32_t trigger)
Enables the ADC for synchronous operation.
#define AUXADC_SAMPLE_TIME_21P3_US
void AUXADCDisableInputScaling(void)
Disables scaling of the ADC input.
int32_t AUXADCValueToMicrovolts(int32_t fixedRefVoltage, int32_t adcValue)
Converts an "adjusted" ADC value to microvolts.
int32_t AUXADCGetAdjustmentOffset(uint32_t refSource)
Returns the offset value used when adjusting for ADC gain/offset.
static void ADI8BitsSet(uint32_t ui32Base, uint32_t ui32Reg, uint8_t ui8Val)
Set specific bits in a single 8 bit ADI register.
#define AUXADC_TRIGGER_MANUAL
void AUXADCFlushFifo(void)
Flushes the ADC FIFO.
uint32_t AUXADCReadFifo(void)
Waits for and returns the first sample in the ADC FIFO.