29 #define ADC121C021_I2C_BUS 0
30 #define ADC121C021_DEFAULT_I2C_ADDR 0x55
32 #define ADC121C021_RESOLUTION 4096 // 12 bits
38 #define ADC121C021_REG_RESULT 0x00
39 #define ADC121C021_REG_ALERT_STATUS 0x01
40 #define ADC121C021_REG_CONFIG 0x02
41 #define ADC121C021_REG_ALERT_LIM_UNDER 0x03
42 #define ADC121C021_REG_ALERT_LIM_OVER 0x04
43 #define ADC121C021_REG_ALERT_HYS 0x05
44 #define ADC121C021_REG_LOWEST_CONV 0x06
45 #define ADC121C021_REG_HIGHEST_CONV 0x07
48 #define ADC121C021_DEFAULT_VREF 3.0
62 typedef enum { ADC121C021_CYCLE_NONE = 0,
63 ADC121C021_CYCLE_32 = 1,
64 ADC121C021_CYCLE_64 = 2,
65 ADC121C021_CYCLE_128 = 3,
66 ADC121C021_CYCLE_256 = 4,
67 ADC121C021_CYCLE_512 = 5,
68 ADC121C021_CYCLE_1024 = 6,
69 ADC121C021_CYCLE_2048 = 7
70 } ADC121C021_CYCLE_TIME_T;
98 ADC121C021(
int bus, uint8_t address = ADC121C021_DEFAULT_I2C_ADDR,
99 float vref = ADC121C021_DEFAULT_VREF);
113 mraa_result_t
writeByte(uint8_t reg, uint8_t byte);
122 mraa_result_t
writeWord(uint8_t reg, uint16_t word);
300 mraa_i2c_context m_i2c;
void setAutomaticConversion(ADC121C021_CYCLE_TIME_T cycleTime)
Definition: adc121c021.cxx:192
mraa_result_t writeWord(uint8_t reg, uint16_t word)
Definition: adc121c021.cxx:59
mraa_result_t clearHighestConversion()
Definition: adc121c021.cxx:242
bool getAlertStatus()
Definition: adc121c021.cxx:103
bool alertHighTriggered()
Definition: adc121c021.h:179
ADC121C021(int bus, uint8_t address=ADC121C021_DEFAULT_I2C_ADDR, float vref=ADC121C021_DEFAULT_VREF)
Definition: adc121c021.cxx:34
mraa_result_t writeByte(uint8_t reg, uint8_t byte)
Definition: adc121c021.cxx:54
float valueToVolts(uint16_t val)
Definition: adc121c021.cxx:93
mraa_result_t setHysteresis(uint16_t limit)
Definition: adc121c021.cxx:223
~ADC121C021()
Definition: adc121c021.cxx:49
void enableAlertHold(bool enable)
Definition: adc121c021.cxx:164
uint16_t getLowestConversion()
Definition: adc121c021.cxx:237
bool alertLowTriggered()
Definition: adc121c021.h:171
mraa_result_t clearLowestConversion()
Definition: adc121c021.cxx:247
void clearAlertStatus()
Definition: adc121c021.cxx:127
void enableAlertPinPolarityHigh(bool enable)
Definition: adc121c021.cxx:178
void enableAlertFlag(bool enable)
Definition: adc121c021.cxx:136
mraa_result_t setAlertHighLimit(uint16_t limit)
Definition: adc121c021.cxx:214
C++ API for the ADC121C021 I2C ADC.
Definition: adc121c021.h:89
uint16_t value()
Definition: adc121c021.cxx:87
uint16_t getHighestConversion()
Definition: adc121c021.cxx:232
uint16_t readWord(uint8_t reg)
Definition: adc121c021.cxx:74
uint8_t readByte(uint8_t reg)
Definition: adc121c021.cxx:69
mraa_result_t setAlertLowLimit(uint16_t limit)
Definition: adc121c021.cxx:205
void enableAlertPin(bool enable)
Definition: adc121c021.cxx:150