ADS v2
ADS1015.h@0:94493b8b0fb0, 2018-06-26 (annotated)
- Committer:
- xorjoep
- Date:
- Tue Jun 26 13:30:53 2018 +0000
- Revision:
- 0:94493b8b0fb0
- Child:
- 1:c1ddf7c2d65b
ADS van Jasper geimplementeerd
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 | 0:94493b8b0fb0 | 4 | #define ADDR_ADS1015_2 0b10010110 //SDL |
xorjoep | 0:94493b8b0fb0 | 5 | |
xorjoep | 0:94493b8b0fb0 | 6 | #define AD1015_REG_CONVERSION_RESULT 0x00 |
xorjoep | 0:94493b8b0fb0 | 7 | #define AD1015_REG_CONFIG 0x01 |
xorjoep | 0:94493b8b0fb0 | 8 | |
xorjoep | 0:94493b8b0fb0 | 9 | #define AD1015_CONFIG_FSR_6144 0x0000 |
xorjoep | 0:94493b8b0fb0 | 10 | #define AD1015_CONFIG_FSR_4096 0x0200 |
xorjoep | 0:94493b8b0fb0 | 11 | #define AD1015_CONFIG_FSR_2048 0x0400 |
xorjoep | 0:94493b8b0fb0 | 12 | #define AD1015_CONFIG_FSR_1024 0x0600 |
xorjoep | 0:94493b8b0fb0 | 13 | #define AD1015_CONFIG_FSR_0512 0x0800 |
xorjoep | 0:94493b8b0fb0 | 14 | #define AD1015_CONFIG_FSR_0256 0x0A00 |
xorjoep | 0:94493b8b0fb0 | 15 | #define AD1015_CONFIG_MUX_AIN0_AIN1 0x0000 |
xorjoep | 0:94493b8b0fb0 | 16 | #define AD1015_CONFIG_MUX_AIN0_AIN3 0x1000 |
xorjoep | 0:94493b8b0fb0 | 17 | #define AD1015_CONFIG_MUX_AIN1_AIN3 0x2000 |
xorjoep | 0:94493b8b0fb0 | 18 | #define AD1015_CONFIG_MUX_AIN2_AIN3 0x3000 |
xorjoep | 0:94493b8b0fb0 | 19 | #define AD1015_CONFIG_MUX_AIN0_GND 0x4000 |
xorjoep | 0:94493b8b0fb0 | 20 | #define AD1015_CONFIG_MUX_AIN1_GND 0x5000 |
xorjoep | 0:94493b8b0fb0 | 21 | #define AD1015_CONFIG_MUX_AIN2_GND 0x6000 |
xorjoep | 0:94493b8b0fb0 | 22 | #define AD1015_CONFIG_MUX_AIN3_GND 0x7000 |
xorjoep | 0:94493b8b0fb0 | 23 | |
xorjoep | 0:94493b8b0fb0 | 24 | void startSingleShotConversion(I2C* i2c_plate, uint8_t address, uint16_t config); |
xorjoep | 0:94493b8b0fb0 | 25 | double readConversionResult(I2C* i2c_plate, uint8_t address, uint16_t config); |
xorjoep | 0:94493b8b0fb0 | 26 | double data_to_voltage(int16_t data, uint16_t config); |