diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-11-03 19:13:00 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-11-03 19:13:00 +0100 |
commit | 4193ec1618230f7bbc927e1d2280976a9d5dd464 (patch) | |
tree | d4d9efedfd928d2ca365ecab46d94dc9040bf749 /sw/common.hpp | |
parent | 48ac857cc3082aee3300a4d39834e109bd909f82 (diff) | |
download | glutte-batteries-4193ec1618230f7bbc927e1d2280976a9d5dd464.tar.gz glutte-batteries-4193ec1618230f7bbc927e1d2280976a9d5dd464.tar.bz2 glutte-batteries-4193ec1618230f7bbc927e1d2280976a9d5dd464.zip |
Add relay toggle code
Diffstat (limited to 'sw/common.hpp')
-rw-r--r-- | sw/common.hpp | 12 |
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, +}; |