diff options
author | Daniel Friesel <derf@finalrewind.org> | 2023-01-01 18:03:19 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2023-01-01 18:03:19 +0100 |
commit | 7f0db02066a7554b959fa264fcc200b2a2e4c929 (patch) | |
tree | a50fad76f732daa8938b0c06393a439f345ee14d /src/app/datalogger | |
parent | 2501cd668a26bf6d4e9153f18a6e14695c4b5ed1 (diff) |
Add driver for ADS111x 16-Bit ADC
Diffstat (limited to 'src/app/datalogger')
-rw-r--r-- | src/app/datalogger/main.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/app/datalogger/main.cc b/src/app/datalogger/main.cc index 251d1fa..1d41ee0 100644 --- a/src/app/datalogger/main.cc +++ b/src/app/datalogger/main.cc @@ -13,6 +13,9 @@ #include "driver/soft_i2c.h" #endif +#ifdef CONFIG_driver_ads111x +#include "driver/ads111x.h" +#endif #ifdef CONFIG_driver_lm75 #include "driver/lm75.h" #endif @@ -63,6 +66,12 @@ void loop(void) { +#ifdef CONFIG_driver_ads111x + kout << "Reading: "; + kout.printf_float(ads111x.readVoltage()); + kout << " V" << endl; +#endif + #ifdef CONFIG_driver_lm75 kout << "temperature_celsius: "; kout.printf_float(lm75.getTemp()); @@ -284,6 +293,10 @@ int main(void) kout << "I2C setup OK" << endl; #endif +#ifdef CONFIG_driver_ads111x + ads111x.configure(ADS111x::CONTINUOUS | ADS111x::FSR_4V | ADS111x::SPS_8 | ADS111x::SINGLE_3); +#endif + #ifdef CONFIG_driver_bme280 bme280.intf = BME280_I2C_INTF; bme280.read = bme680_i2c_read; |