From 2fe7a4e7240095b30e37a303fc5eb3dbb1fc6e55 Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Fri, 18 Mar 2022 22:22:37 +0100
Subject: [PATCH] SLowly adding more from S8 co2.cpp

---
 ampel-firmware/co2_sensor.cpp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp
index 3264980..c947ca5 100644
--- a/ampel-firmware/co2_sensor.cpp
+++ b/ampel-firmware/co2_sensor.cpp
@@ -12,6 +12,29 @@
 
 #include "s8_uart.h" // Not used yet
 
+#if (defined USE_SOFTWARE_SERIAL || defined ARDUINO_ARCH_RP2040)
+  #define S8_RX_PIN 5         // Rx pin which the S8 Tx pin is attached to (change if it is needed)
+  #define S8_TX_PIN 4         // Tx pin which the S8 Rx pin is attached to (change if it is needed)
+#else
+  #define S8_UART_PORT  1     // Change UART port if it is needed
+#endif
+/* END CONFIGURATION */
+
+S8_UART *sensor_S8;
+S8_sensor sensor2;
+
+
+#ifdef USE_SOFTWARE_SERIAL
+  SoftwareSerial S8_serial(S8_RX_PIN, S8_TX_PIN);
+#else
+  #if defined(ARDUINO_ARCH_RP2040)
+    REDIRECT_STDOUT_TO(Serial)    // to use printf (Serial.printf not supported)
+    UART S8_serial(S8_TX_PIN, S8_RX_PIN, NC, NC);
+  #else
+    HardwareSerial S8_serial(S8_UART_PORT);   
+  #endif
+#endif
+
 namespace config {
   const uint16_t measurement_timestep_bootup = 5; // [s] Measurement timestep during acclimatization.
   const uint8_t max_deviation_during_bootup = 20; // [%]
-- 
GitLab