aboutsummaryrefslogtreecommitdiffstats
path: root/sw/common.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'sw/common.hpp')
-rw-r--r--sw/common.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/common.hpp b/sw/common.hpp
index 345f34b..fa0ee8e 100644
--- a/sw/common.hpp
+++ b/sw/common.hpp
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdint.h>
+#include <avr/interrupt.h>
struct timer_t {
uint32_t seconds_ = 0; /* Timer in seconds */
@@ -58,6 +59,11 @@ struct timer_t {
(seconds_ == rhs.seconds_ and ticks_ > rhs.ticks_);
}
+ bool operator<(const timer_t& rhs) const {
+ return (seconds_ < rhs.seconds_) or
+ (seconds_ == rhs.seconds_ and ticks_ < rhs.ticks_);
+ }
+
void normalise() {
while (ticks_ >= 10) {
seconds_++;
@@ -91,3 +97,9 @@ struct timer_t {
static constexpr int ms_to_ticks(int ms) { return ms / 100; }
};
+
+enum class relay_id_t {
+ K1,
+ K2,
+ K3,
+};