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;
100 ADC121C021(
int bus, uint8_t address = ADC121C021_DEFAULT_I2C_ADDR,
101 float vref = ADC121C021_DEFAULT_VREF);
115 mraa_result_t
writeByte(uint8_t reg, uint8_t byte);
124 mraa_result_t
writeWord(uint8_t reg, uint16_t word);
306 mraa_i2c_context m_i2c;
void setAutomaticConversion(ADC121C021_CYCLE_TIME_T cycleTime)
Definition: adc121c021.cxx:203
mraa_result_t writeWord(uint8_t reg, uint16_t word)
Definition: adc121c021.cxx:70
mraa_result_t clearHighestConversion()
Definition: adc121c021.cxx:253
bool getAlertStatus()
Definition: adc121c021.cxx:114
bool alertHighTriggered()
Definition: adc121c021.h:181
ADC121C021(int bus, uint8_t address=ADC121C021_DEFAULT_I2C_ADDR, float vref=ADC121C021_DEFAULT_VREF)
Definition: adc121c021.cxx:35
mraa_result_t writeByte(uint8_t reg, uint8_t byte)
Definition: adc121c021.cxx:65
float valueToVolts(uint16_t val)
Definition: adc121c021.cxx:104
mraa_result_t setHysteresis(uint16_t limit)
Definition: adc121c021.cxx:234
~ADC121C021()
Definition: adc121c021.cxx:60
void enableAlertHold(bool enable)
Definition: adc121c021.cxx:175
uint16_t getLowestConversion()
Definition: adc121c021.cxx:248
bool alertLowTriggered()
Definition: adc121c021.h:173
mraa_result_t clearLowestConversion()
Definition: adc121c021.cxx:258
void clearAlertStatus()
Definition: adc121c021.cxx:138
void enableAlertPinPolarityHigh(bool enable)
Definition: adc121c021.cxx:189
void enableAlertFlag(bool enable)
Definition: adc121c021.cxx:147
mraa_result_t setAlertHighLimit(uint16_t limit)
Definition: adc121c021.cxx:225
API for the ADC121C021 I2C Analog-to-Digital Converter.
Definition: adc121c021.h:91
uint16_t value()
Definition: adc121c021.cxx:98
uint16_t getHighestConversion()
Definition: adc121c021.cxx:243
uint16_t readWord(uint8_t reg)
Definition: adc121c021.cxx:85
uint8_t readByte(uint8_t reg)
Definition: adc121c021.cxx:80
mraa_result_t setAlertLowLimit(uint16_t limit)
Definition: adc121c021.cxx:216
void enableAlertPin(bool enable)
Definition: adc121c021.cxx:161