diff options
Diffstat (limited to 'include/arch/blinkenrocket/driver/uptime.h')
-rw-r--r-- | include/arch/blinkenrocket/driver/uptime.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/arch/blinkenrocket/driver/uptime.h b/include/arch/blinkenrocket/driver/uptime.h new file mode 100644 index 0000000..d5fdd2e --- /dev/null +++ b/include/arch/blinkenrocket/driver/uptime.h @@ -0,0 +1,28 @@ +#ifndef UPTIME_H +#define UPTIME_H + +#include <avr/io.h> + +class Uptime { + private: + Uptime(const Uptime ©); +#ifdef TIMER_S + uint8_t seconds; +#endif + + public: +#ifdef TIMER_S + Uptime () : seconds(0) {} +#else + Uptime () {} +#endif + inline uint8_t get_cycles() { return TCNT0; } +#ifdef TIMER_S + inline uint8_t get_s() { return seconds; } + inline void tick_s() { seconds++; } +#endif +}; + +extern Uptime uptime; + +#endif |