diff options
Diffstat (limited to 'time.h')
-rw-r--r-- | time.h | 28 |
1 files changed, 0 insertions, 28 deletions
@@ -1,28 +0,0 @@ -#ifndef TIME_H -#define TIME_H - -#include "stm32.h" -#include "interrupt.h" -#include "thread.h" - -class Time { - friend void interrupt<Interrupt::SysTick>(); - - private: - static volatile uint32_t systime; - - public: - static void init() { - STK.LOAD = 72000000 / 8 / 1000; // 1000 Hz. - STK.CTRL = 0x03; - } - - inline static void sleep(uint32_t ms) { - ms += systime; - while(systime < ms) { - Thread::yield(); - } - } -}; - -#endif |