summaryrefslogtreecommitdiff
path: root/include/arch/stm32f446re-nucleo/driver/uptime.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/arch/stm32f446re-nucleo/driver/uptime.h')
-rw-r--r--include/arch/stm32f446re-nucleo/driver/uptime.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/arch/stm32f446re-nucleo/driver/uptime.h b/include/arch/stm32f446re-nucleo/driver/uptime.h
new file mode 100644
index 0000000..adace98
--- /dev/null
+++ b/include/arch/stm32f446re-nucleo/driver/uptime.h
@@ -0,0 +1,27 @@
+#ifndef UPTIME_H
+#define UPTIME_H
+
+#include <stdint.h>
+
+class Uptime {
+ private:
+ Uptime(const Uptime &copy);
+#ifdef TIMER_S
+ uint32_t seconds;
+#endif
+
+ public:
+#ifdef TIMER_S
+ Uptime () : seconds(0) {}
+#else
+ Uptime () {}
+#endif
+#ifdef TIMER_S
+ inline uint32_t get_s() { return seconds; }
+ inline void tick_s() { seconds++; }
+#endif
+};
+
+extern Uptime uptime;
+
+#endif