35 #ifndef ADS1114_1_I2C_ADDR
36 #define ADS1114_1_I2C_ADDR 0x90 // slave address byte (I2c address(7bits) + R/W @ 0)
38 #ifndef ADS1114_2_I2C_ADDR
39 #define ADS1114_2_I2C_ADDR 0x92 // slave address byte (I2c address(7bits) + R/W @ 0)
43 #define ADS1114_POINTER_CONV_REG 0x00 // access to the Conversion register (16bits)
44 #define ADS1114_POINTER_CONFIG_REG 0x01 // access to the Configuration register (16bits)
48 #define ADS1114_1_OS 0x0 // Operational status
51 #define ADS1114_1_MUX 0x0 // Input multiplexer
54 #define ADS1114_1_PGA 0x3 // Programable gain amplifier (= 4 with a Full Scale of +/- 1.024V)
56 #ifndef ADS1114_1_MODE
57 #define ADS1114_1_MODE 0x0 // Continuous conversion mode
60 #define ADS1114_1_DR 0x4 // Data rate (128 SPS)
62 #ifndef ADS1114_1_COMP_MODE
63 #define ADS1114_1_COMP_MODE 0x0 // Comparator mode
65 #ifndef ADS1114_1_COMP_POL
66 #define ADS1114_1_COMP_POL 0x0 // Comparator polarity
68 #ifndef ADS1114_1_COMP_LAT
69 #define ADS1114_1_COMP_LAT 0x0 // Latching comparator
71 #ifndef ADS1114_1_COMP_QUE
72 #define ADS1114_1_COMP_QUE 0x3 // Comparator queue (disable)
75 #define ADS1114_1_CONFIG_MSB ((ADS1114_1_OS<<7)|(ADS1114_1_MUX<<4)|(ADS1114_1_PGA<<1)|(ADS1114_1_MODE))
76 #define ADS1114_1_CONFIG_LSB ((ADS1114_1_DR<<5)|(ADS1114_1_COMP_MODE<<4)|(ADS1114_1_COMP_POL<<3)|(ADS1114_1_COMP_LAT<<2)|(ADS1114_1_COMP_QUE))
80 #define ADS1114_2_OS 0x0 // Operational status
83 #define ADS1114_2_MUX 0x0 // Input multiplexer
86 #define ADS1114_2_PGA 0x3 // Programable gain amplifier (= 4 with a Full Scale of +/- 1.024V)
88 #ifndef ADS1114_2_MODE
89 #define ADS1114_2_MODE 0x0 // Continuous conversion mode
92 #define ADS1114_2_DR 0x4 // Data rate (128 SPS)
94 #ifndef ADS1114_2_COMP_MODE
95 #define ADS1114_2_COMP_MODE 0x0 // Comparator mode
97 #ifndef ADS1114_2_COMP_POL
98 #define ADS1114_2_COMP_POL 0x0 // Comparator polarity
100 #ifndef ADS1114_2_COMP_LAT
101 #define ADS1114_2_COMP_LAT 0x0 // Latching comparator
103 #ifndef ADS1114_2_COMP_QUE
104 #define ADS1114_2_COMP_QUE 0x3 // Comparator queue (disable)
107 #define ADS1114_2_CONFIG_MSB ((ADS1114_2_OS<<7)|(ADS1114_2_MUX<<4)|(ADS1114_2_PGA<<1)|(ADS1114_2_MODE))
108 #define ADS1114_2_CONFIG_LSB ((ADS1114_2_DR<<5)|(ADS1114_2_COMP_MODE<<4)|(ADS1114_2_COMP_POL<<3)|(ADS1114_2_COMP_LAT<<2)|(ADS1114_2_COMP_QUE))
112 #ifndef ADS1114_I2C_DEV
113 #define ADS1114_I2C_DEV i2c1
135 #define _Ads1114Event(_p) {\
136 if (!_p.config_done) { \
137 if (_p.trans.status == I2CTransSuccess) { _p.config_done = TRUE; _p.trans.status = I2CTransDone; } \
138 if (_p.trans.status == I2CTransFailed) { _p.trans.status = I2CTransDone; } \
140 if (_p.trans.status == I2CTransSuccess) { _p.data_available = TRUE; _p.trans.status = I2CTransDone; } \
141 if (_p.trans.status == I2CTransFailed) { _p.trans.status = I2CTransDone; } \
146 #define Ads1114_1Event() _Ads1114Event(ads1114_1)
148 #define Ads1114_1Event() {}
152 #define Ads1114_2Event() _Ads1114Event(ads1114_2)
154 #define Ads1114_2Event() {}
158 #define Ads1114Event() { \
165 #define Ads1114GetValue(_p) ((int16_t)(((int16_t)_p.trans.buf[0]<<8)|_p.trans.buf[1]))
struct i2c_transaction trans
I2C transaction structure.
void ads1114_read(struct ads1114_periph *p)
Architecture independent I2C (Inter-Integrated Circuit Bus) API.