summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gyronardo.cpp5
-rw-r--r--src/status.cpp13
-rw-r--r--src/status.hpp9
3 files changed, 27 insertions, 0 deletions
diff --git a/src/gyronardo.cpp b/src/gyronardo.cpp
index bee13b6..9b1aa24 100644
--- a/src/gyronardo.cpp
+++ b/src/gyronardo.cpp
@@ -2,6 +2,7 @@
#include "sensor/calibration.hpp"
#include "sensor/sensor.hpp"
#include "serial.hpp"
+#include "status.hpp"
#include "utils.hpp"
#include <Wire.h>
@@ -15,6 +16,8 @@ constexpr unsigned int BAUD_RATE = 9600U;
void setup()
{
+ initialize_status_leds();
+
auto sout = common::make_shared<SerialStream>(Serial, BAUD_RATE);
auto sensor = common::make_shared<Sensor>(SENSOR_ADDRESS, Wire, SENSOR_THROTTLE_TIME);
@@ -58,6 +61,8 @@ void setup()
stop();
}
+ set_led_positive(HIGH);
+
*sout << "Finished calibrating sensor\n";
*sout << "Calibration values:\n"
diff --git a/src/status.cpp b/src/status.cpp
new file mode 100644
index 0000000..2712895
--- /dev/null
+++ b/src/status.cpp
@@ -0,0 +1,13 @@
+#include "status.hpp"
+
+#include <Arduino.h>
+
+void initialize_status_leds() noexcept
+{
+ pinMode(STATUS_LED_POSITIVE, OUTPUT);
+}
+
+void set_led_positive(uint8_t value) noexcept
+{
+ digitalWrite(STATUS_LED_POSITIVE, value);
+}
diff --git a/src/status.hpp b/src/status.hpp
new file mode 100644
index 0000000..ff8980e
--- /dev/null
+++ b/src/status.hpp
@@ -0,0 +1,9 @@
+#pragma once
+
+#include <stdint.h>
+
+constexpr uint8_t STATUS_LED_POSITIVE = 5U;
+
+void initialize_status_leds() noexcept;
+
+void set_led_positive(uint8_t value) noexcept;