1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-12-22 22:55:31 +02:00

fw/accel.c: fix update() add interrupt-friendly update_irq()

Still untested.
This commit is contained in:
Werner Almesberger 2012-06-21 16:14:56 -03:00
parent 7356fccbfd
commit c7494c80fa
2 changed files with 15 additions and 1 deletions

View File

@ -84,6 +84,17 @@ ISR(TIMER1_OVF_vect)
}
uint32_t uptime_irq(void)
{
uint32_t t;
t = t_up+TCNT1;
if (TIFR1 & TOV1)
t += ICR1;
return t;
}
uint32_t uptime(void)
{
uint32_t a, b;
@ -92,7 +103,8 @@ uint32_t uptime(void)
do {
cli();
a = t_up;
d = ICR1;
d = TCNT1;
cli();
b = t_up;
sei();
}

View File

@ -29,7 +29,9 @@ struct sweep {
extern volatile bool sweeping;
uint32_t uptime_irq(void);
uint32_t uptime(void);
void sweep_image(const struct sweep *sweep);
void sweep_init(void);