Enable packet-based communcation to command processor
[fw/altos] / src / ao_timer.c
index 78c6e063f0991eb5c71e628b652cca08e928c02b..e81f937d9604096bc3995620a0b17730d55d74c9 100644 (file)
@@ -24,13 +24,13 @@ uint16_t ao_time(void) __critical
        return ao_tick_count;
 }
 
+static __xdata uint8_t ao_forever;
+
 void
 ao_delay(uint16_t ticks)
 {
-       uint16_t until = ao_time() + ticks;
-
-       while ((int16_t) (until - ao_time()) > 0)
-               ao_sleep(DATA_TO_XDATA(&ao_tick_count));
+       ao_alarm(ticks);
+       ao_sleep(&ao_forever);
 }
 
 #define T1_CLOCK_DIVISOR       8       /* 24e6/8 = 3e6 */
@@ -46,7 +46,6 @@ void ao_timer_isr(void) interrupt 9
                ao_adc_count = 0;
                ao_adc_poll();
        }
-       ao_wakeup(DATA_TO_XDATA(&ao_tick_count));
 }
 
 void