From 7f0db02066a7554b959fa264fcc200b2a2e4c929 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 1 Jan 2023 18:03:19 +0100 Subject: Add driver for ADS111x 16-Bit ADC --- src/app/datalogger/main.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/app/datalogger') 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; -- cgit v1.2.3