ADS v2
ADS1015.h@3:6ee79a02cf4c, 2018-07-02 (annotated)
- Committer:
- xorjoep
- Date:
- Mon Jul 02 10:18:02 2018 +0000
- Revision:
- 3:6ee79a02cf4c
- Parent:
- 2:2bf91fd23a1a
doet he tnu
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xorjoep | 0:94493b8b0fb0 | 1 | #define ADDR_ADS1015_0 0b10010010 //VDD |
xorjoep | 0:94493b8b0fb0 | 2 | #define ADDR_ADS1015_1 0b10010000 //GND |
xorjoep | 0:94493b8b0fb0 | 3 | #define ADDR_ADS1015_2 0b10010100 //SDA |
xorjoep | 3:6ee79a02cf4c | 4 | #define ADDR_ADS1015_3 0b10010110 //SCL |
xorjoep | 0:94493b8b0fb0 | 5 | |
xorjoep | 0:94493b8b0fb0 | 6 | #define AD1015_REG_CONVERSION_RESULT 0x00 |
xorjoep | 0:94493b8b0fb0 | 7 | #define AD1015_REG_CONFIG 0x01 |
xorjoep | 2:2bf91fd23a1a | 8 | #define ADS1015_REG_CONFIG_OS_SINGLE (0x8000) |
xorjoep | 2:2bf91fd23a1a | 9 | |
xorjoep | 2:2bf91fd23a1a | 10 | #define ADS1015_REG_CONFIG_MUX_SINGLE_0 (0x4000) // Single-ended AIN0 |
xorjoep | 2:2bf91fd23a1a | 11 | #define ADS1015_REG_CONFIG_MUX_SINGLE_1 (0x5000) // Single-ended AIN1 |
xorjoep | 2:2bf91fd23a1a | 12 | #define ADS1015_REG_CONFIG_MUX_SINGLE_2 (0x6000) // Single-ended AIN2 |
xorjoep | 2:2bf91fd23a1a | 13 | #define ADS1015_REG_CONFIG_MUX_SINGLE_3 (0x7000) // Single-ended AIN3 |
xorjoep | 0:94493b8b0fb0 | 14 | |
xorjoep | 0:94493b8b0fb0 | 15 | #define AD1015_CONFIG_FSR_6144 0x0000 |
xorjoep | 0:94493b8b0fb0 | 16 | #define AD1015_CONFIG_FSR_4096 0x0200 |
xorjoep | 0:94493b8b0fb0 | 17 | #define AD1015_CONFIG_FSR_2048 0x0400 |
xorjoep | 0:94493b8b0fb0 | 18 | #define AD1015_CONFIG_FSR_1024 0x0600 |
xorjoep | 0:94493b8b0fb0 | 19 | #define AD1015_CONFIG_FSR_0512 0x0800 |
xorjoep | 0:94493b8b0fb0 | 20 | #define AD1015_CONFIG_FSR_0256 0x0A00 |
xorjoep | 0:94493b8b0fb0 | 21 | #define AD1015_CONFIG_MUX_AIN0_AIN1 0x0000 |
xorjoep | 0:94493b8b0fb0 | 22 | #define AD1015_CONFIG_MUX_AIN0_AIN3 0x1000 |
xorjoep | 0:94493b8b0fb0 | 23 | #define AD1015_CONFIG_MUX_AIN1_AIN3 0x2000 |
xorjoep | 0:94493b8b0fb0 | 24 | #define AD1015_CONFIG_MUX_AIN2_AIN3 0x3000 |
xorjoep | 0:94493b8b0fb0 | 25 | #define AD1015_CONFIG_MUX_AIN0_GND 0x4000 |
xorjoep | 0:94493b8b0fb0 | 26 | #define AD1015_CONFIG_MUX_AIN1_GND 0x5000 |
xorjoep | 0:94493b8b0fb0 | 27 | #define AD1015_CONFIG_MUX_AIN2_GND 0x6000 |
xorjoep | 0:94493b8b0fb0 | 28 | #define AD1015_CONFIG_MUX_AIN3_GND 0x7000 |
xorjoep | 0:94493b8b0fb0 | 29 | |
xorjoep | 2:2bf91fd23a1a | 30 | double getDifSample(I2C* i2c_plate, uint8_t ADC_address, uint16_t sensor_address); |
xorjoep | 2:2bf91fd23a1a | 31 | double getSingleSample(I2C* i2c_plate, uint8_t ADC_address, uint16_t channel); |
xorjoep | 0:94493b8b0fb0 | 32 | void startSingleShotConversion(I2C* i2c_plate, uint8_t address, uint16_t config); |
xorjoep | 0:94493b8b0fb0 | 33 | double readConversionResult(I2C* i2c_plate, uint8_t address, uint16_t config); |
xorjoep | 0:94493b8b0fb0 | 34 | double data_to_voltage(int16_t data, uint16_t config); |