diff options
author | neoraider <devnull@localhost> | 2007-04-19 01:00:05 +0200 |
---|---|---|
committer | neoraider <devnull@localhost> | 2007-04-19 01:00:05 +0200 |
commit | e7eeeb0d4e825a175c67cd1c0256c91362517ebb (patch) | |
tree | 32cd6997837c9decb909dc36824ea7abc896c88e /timer.cpp | |
parent | 847645b3cc8dd32b51f9c0a42d0b4308fa40e4a5 (diff) | |
download | rc2007-rescue-e7eeeb0d4e825a175c67cd1c0256c91362517ebb.tar rc2007-rescue-e7eeeb0d4e825a175c67cd1c0256c91362517ebb.zip |
Entfernungssensoren in Ordnung gebracht, Hindernisumfahrung implementiert.
Diffstat (limited to 'timer.cpp')
-rw-r--r-- | timer.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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 <avr/interrupt.h> + + +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); +} |