From bdb1590839e5962741140ce2f4db722219f9d6f6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 26 Feb 2021 19:16:55 +0100 Subject: Add SCD4x driver and datalog integration --- src/app/datalogger/main.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/app/datalogger') diff --git a/src/app/datalogger/main.cc b/src/app/datalogger/main.cc index 8740035..46ff6b0 100644 --- a/src/app/datalogger/main.cc +++ b/src/app/datalogger/main.cc @@ -45,6 +45,9 @@ #ifdef DRIVER_TSL2591 #include "driver/tsl2591.h" #endif +#ifdef DRIVER_SCD4X +#include "driver/scd4x.h" +#endif void loop(void) { @@ -136,6 +139,17 @@ void loop(void) kout << dec << "TSL2591 CH0: " << tsl2591.ch0 << " / CH1: " << tsl2591.ch1; kout << hex << " (status: 0x" << tsl2591.getStatus() << ")" << endl; #endif + +#ifdef DRIVER_SCD4X + scd4x.read(); + kout << dec << "CO₂: " << scd4x.co2 << " ppm" << endl; + kout << "Temperature: "; + kout.printf_float(((175.0 * scd4x.rawTemperature) / 65536) - 45); + kout << " °c" << endl; + kout << "Humidity: "; + kout.printf_float((100.0 * scd4x.rawHumidity) / 65536); + kout << " %" << endl; +#endif } int main(void) @@ -224,6 +238,10 @@ int main(void) tsl2591.init(); #endif +#ifdef DRIVER_SCD4X + scd4x.start(); +#endif + arch.idle_loop(); return 0; -- cgit v1.2.3