Go to the documentation of this file.
39 #ifndef ADCXX1C_I2C_ADDRESS
40 #define ADCXX1C_I2C_ADDRESS (0x54)
55 #if defined(MODULE_ADC081C)
56 #define ADCXX1C_RES_DEFAULT ADCXX1C_RES_8BITS
57 #elif defined(MODULE_ADC101C)
58 #define ADCXX1C_RES_DEFAULT ADCXX1C_RES_10BITS
59 #elif defined(MODULE_ADC121C)
60 #define ADCXX1C_RES_DEFAULT ADCXX1C_RES_12BITS
62 #define ADCXX1C_RES_DEFAULT (-1)
63 #error "ADCXX1C: Failed to select resolution: unknown ADCXX1C device variant!"
168 int16_t high_limit, int16_t hysteresis);
struct adcxx1c adcxx1c_t
ADCxx1C device descriptor.
int16_t high_limit
alert high value
@ ADCXX1C_CYCLE_128
Conversion cycle = Tconvert x 128.
@ ADCXX1C_NODATA
no data available
@ ADCXX1C_ALERT_UNDER_RANGE
Measured voltage fell below Vlow.
@ ADCXX1C_RES_10BITS
10 bits resolution (ADC101C family)
@ ADCXX1C_CYCLE_256
Conversion cycle = Tconvert x 256.
@ ADCXX1C_CYCLE_1024
Conversion cycle = Tconvert x 1024.
unsigned int i2c_t
Default i2c_t type definition.
int adcxx1c_get_and_clear_alert(const adcxx1c_t *dev)
Get alert source and clear it.
void(* adcxx1c_cb_t)(void *)
ADCxx1C alert callback.
adcxx1c_params_t params
device driver configuration
@ ADCXX1C_NOI2C
I2C communication failed.
@ ADCXX1C_ALERT_OVER_RANGE
Measured voltage exceeded Vhigh.
@ ADCXX1C_RES_8BITS
8 bits resolution (ADC081C family)
@ ADCXX1C_CYCLE_DISABLED
No cycle conversion.
@ ADCXX1C_RES_12BITS
12 bits resolution (ADC121C family)
@ ADCXX1C_OK
everything was fine
int adcxx1c_init(adcxx1c_t *dev, const adcxx1c_params_t *params)
Initialize an ADCxx1C ADC device.
gpio_t alert_pin
alert pin (GPIO_UNDEF if not connected)
struct adcxx1c_params adcxx1c_params_t
ADCxx1C params.
@ ADCXX1C_CYCLE_512
Conversion cycle = Tconvert x 512.
int16_t low_limit
alert low value
int adcxx1c_read_raw(const adcxx1c_t *dev, int16_t *raw)
Read a raw ADC value.
uint8_t cycle
conversion interval
adcxx1c_cb_t cb
alert callback
Low-level GPIO peripheral driver interface definitions.
int adcxx1c_enable_alert(adcxx1c_t *dev, adcxx1c_cb_t cb, void *arg)
Enable alert interrupt.
void * arg
alert callback param
@ ADCXX1C_CYCLE_2048
Conversion cycle = Tconvert x 2048.
@ ADCXX1C_CYCLE_32
Conversion cycle = Tconvert x 32.
Low-level I2C peripheral driver interface definition.
ADCxx1C device descriptor.
int adcxx1c_set_alert_parameters(const adcxx1c_t *dev, int16_t low_limit, int16_t high_limit, int16_t hysteresis)
Set the alert parameters.
@ ADCXX1C_NODEV
no ADCXX1C device found on the bus
@ ADCXX1C_CYCLE_64
Conversion cycle = Tconvert x 64.
int16_t hysteresis
alert hysteresis