18 lines
268 B
C++
18 lines
268 B
C++
#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);
|
|
}
|