mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-01 07:24:58 +02:00
fw/accel.c: fix update() add interrupt-friendly update_irq()
Still untested.
This commit is contained in:
parent
7356fccbfd
commit
c7494c80fa
14
fw/sweep.c
14
fw/sweep.c
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user