From 025a38a1f743fd9e89cbd477abe3f79a8d098097 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 19 Nov 2011 17:21:31 +0100 Subject: Moved os and hal related files into subdirectories. --- os/time.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 os/time.h (limited to 'os/time.h') diff --git a/os/time.h b/os/time.h new file mode 100644 index 0000000..f4706e0 --- /dev/null +++ b/os/time.h @@ -0,0 +1,23 @@ +#ifndef TIME_H +#define TIME_H + +#include "thread.h" + +class Time { + private: + static volatile uint32_t systime; + + public: + inline static void tick() { + systime++; + } + + inline static void sleep(uint32_t ms) { + ms += systime; + while(systime < ms) { + Thread::yield(); + } + } +}; + +#endif -- cgit v1.2.3