35 #ifndef ADS1114_1_I2C_ADDR
36 #define ADS1114_1_I2C_ADDR 0x90
38 #ifndef ADS1114_2_I2C_ADDR
39 #define ADS1114_2_I2C_ADDR 0x92
43 #define ADS1114_POINTER_CONV_REG 0x00
44 #define ADS1114_POINTER_CONFIG_REG 0x01
48 #define ADS1114_1_OS 0x0
51 #define ADS1114_1_MUX 0x0
54 #define ADS1114_1_PGA 0x3
56 #ifndef ADS1114_1_MODE
57 #define ADS1114_1_MODE 0x0
60 #define ADS1114_1_DR 0x4
62 #ifndef ADS1114_1_COMP_MODE
63 #define ADS1114_1_COMP_MODE 0x0
65 #ifndef ADS1114_1_COMP_POL
66 #define ADS1114_1_COMP_POL 0x0
68 #ifndef ADS1114_1_COMP_LAT
69 #define ADS1114_1_COMP_LAT 0x0
71 #ifndef ADS1114_1_COMP_QUE
72 #define ADS1114_1_COMP_QUE 0x3
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
83 #define ADS1114_2_MUX 0x0
86 #define ADS1114_2_PGA 0x3
88 #ifndef ADS1114_2_MODE
89 #define ADS1114_2_MODE 0x0
92 #define ADS1114_2_DR 0x4
94 #ifndef ADS1114_2_COMP_MODE
95 #define ADS1114_2_COMP_MODE 0x0
97 #ifndef ADS1114_2_COMP_POL
98 #define ADS1114_2_COMP_POL 0x0
100 #ifndef ADS1114_2_COMP_LAT
101 #define ADS1114_2_COMP_LAT 0x0
103 #ifndef ADS1114_2_COMP_QUE
104 #define ADS1114_2_COMP_QUE 0x3
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]))
void ads1114_read(struct ads1114_periph *p)
struct i2c_transaction trans
I2C transaction structure.
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.