summaryrefslogtreecommitdiff
path: root/src/app/datalogger
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-02-26 19:16:55 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-02-26 19:16:55 +0100
commitbdb1590839e5962741140ce2f4db722219f9d6f6 (patch)
treedb565f530096ad63c82640150718fb144c47d9c9 /src/app/datalogger
parent9a3d3bcc93f8cefea74af2a86b5834a57738e2c3 (diff)
Add SCD4x driver and datalog integration
Diffstat (limited to 'src/app/datalogger')
-rw-r--r--src/app/datalogger/main.cc18
1 files changed, 18 insertions, 0 deletions
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;