diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-08-12 13:20:23 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-08-12 13:20:23 +0200 |
commit | 23f7b0e4ed05685e89c5c1d8d92556106b0845ff (patch) | |
tree | 39c5ef116ef274fd38c7d6ef15d78711517e89ee /include/arch | |
parent | 8458978ad5512dc813ac700d59983c56917fa205 (diff) |
stm32f446re: Add uptime counter and proper loop mode with standby in between
Diffstat (limited to 'include/arch')
-rw-r--r-- | include/arch/stm32f446re-nucleo/driver/uptime.h | 27 |
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 ©); +#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 |