1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-01 11:28:26 +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 uptime(void)
{ {
uint32_t a, b; uint32_t a, b;
@ -92,7 +103,8 @@ uint32_t uptime(void)
do { do {
cli(); cli();
a = t_up; a = t_up;
d = ICR1; d = TCNT1;
cli();
b = t_up; b = t_up;
sei(); sei();
} }

View File

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