12 #ifndef __ADC_DEVICE_H__
13 #define __ADC_DEVICE_H__
43 #define ADC_MODE_STREAM ((uint32_t)(1<<0))
44 #define ADC_MODE_SINGLE ((uint32_t)(1<<1))
45 #define ADC_MODE_NORMAL ((uint32_t)(1<<2))
46 #define ADC_MODE_CALIBRATION ((uint32_t)(1<<3))
47 #define ADC_MODE_REF_VDD ((uint32_t)(1<<4))
48 #define ADC_MODE_REF_BANDGAP ((uint32_t)(1<<5))
ADC_Device_t * ADC_devRequest(const char *name)
ADC Request Device.
Definition: adc_device.c:136
int32_t ADC_devStart(ADC_Device_t *dev)
Start a ADC conversion.
Definition: adc_device.c:69
void(* SetReferenceGain)(uint8_t val)
Definition: adc_device.h:29
void(* SetCalibrationMode)(void)
Definition: adc_device.h:35
void(* SetRefSourceVDD)(void)
Definition: adc_device.h:31
const char * Name
Definition: adc_device.h:37
void(* SampleCycle)(uint8_t val)
Definition: adc_device.h:24
void(* SetReferenceLow)(uint8_t val)
Definition: adc_device.h:28
int32_t ADC_devInit(ADC_Device_t *dev, uint8_t div, uint8_t cycle, uint32_t mode)
Initialize ADC device.
Definition: adc_device.c:97
void(* SetRefSourceBandGap)(void)
Definition: adc_device.h:32
void(* SelectChannel)(uint8_t channel)
Definition: adc_device.h:22
void(* SetNormalMode)(void)
Definition: adc_device.h:36
int32_t ADC_devConfigReference(ADC_Device_t *dev, uint8_t refh, uint8_t refl, uint8_t refg)
Initialize ADC reference settings. It sets the dynamic range and the gain.
Definition: adc_device.c:126
const struct ADC_Device_t ADC_Device_t
A structure to represent ADC device.
void(* SetStreamingMode)(void)
Definition: adc_device.h:33
void(* SetReferenceHigh)(uint8_t val)
Definition: adc_device.h:27
uint8_t(* Read)(void)
Definition: adc_device.h:25
A structure to represent ADC device.
Definition: adc_device.h:21
int32_t ADC_devRead(ADC_Device_t *dev, uint8_t *val)
Read ADC result from a ADC device.
Definition: adc_device.c:61
void(* Start)(void)
Definition: adc_device.h:26
int32_t ADC_devSelectChannel(ADC_Device_t *dev, uint8_t channel)
Select ADC channel for a ADC device.
Definition: adc_device.c:53
int32_t ADC_devTake(ADC_Device_t *dev, uint8_t channel, uint8_t *val)
Start a ADC conversion, wait for its completion and read result back.
Definition: adc_device.c:85
uint8_t(* ConversionInProgress)(void)
Definition: adc_device.h:30
int32_t ADC_devConversionInProgress(ADC_Device_t *dev)
Check status of a ADC conversion.
Definition: adc_device.c:78
void(* ClkDiv)(uint8_t div)
Definition: adc_device.h:23
void(* SetSingleMode)(void)
Definition: adc_device.h:34