From e7eeeb0d4e825a175c67cd1c0256c91362517ebb Mon Sep 17 00:00:00 2001 From: neoraider Date: Wed, 18 Apr 2007 23:00:05 +0000 Subject: Entfernungssensoren in Ordnung gebracht, Hindernisumfahrung implementiert. --- timer.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 timer.cpp (limited to 'timer.cpp') diff --git a/timer.cpp b/timer.cpp new file mode 100644 index 0000000..b4a1b12 --- /dev/null +++ b/timer.cpp @@ -0,0 +1,18 @@ +#include "timer.h" +#include "global.h" + +#include + + +static volatile unsigned long ticks = 0; + + +SIGNAL(SIG_OVERFLOW0) { + ticks++; +} + +void sleep(unsigned long ms) { + unsigned long t = ticks + ms * (F_CPU/TIMER_PRESCALER/256000); + + while(ticks < t); +} -- cgit v1.2.3