X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao.h;h=d31928647dbfac5e769107db990ad88871e292b6;hp=fdf6b027bd46e57ff257d758574a550c42c188e1;hb=f3f25a1cec7d2a034aa544569cfd23bea1a996c5;hpb=e14f07bfdb8824fc7ed6df1129c66ee39ffd6d54 diff --git a/ao.h b/ao.h index fdf6b027..d3192864 100644 --- a/ao.h +++ b/ao.h @@ -54,6 +54,9 @@ void ao_panic(uint8_t reason); volatile __data uint16_t ao_time; +#define AO_MS_TO_TICKS(ms) ((ms) / 10) +#define AO_SEC_TO_TICKS(s) ((s) * 100) + void ao_timer_isr(void) interrupt 9; void ao_timer_init(void); uint16_t ao_time_atomic(void); @@ -73,12 +76,49 @@ struct ao_adc { int16_t sense_m; }; -extern __xdata struct ao_adc ao_adc_ring[ADC_RING]; -extern __data uint8_t ao_adc_head; +extern volatile __xdata struct ao_adc ao_adc_ring[ADC_RING]; +extern volatile __data uint8_t ao_adc_head; void ao_adc_isr(void) interrupt 1; void ao_adc_init(void); void ao_adc_poll(void); void ao_adc_get(__xdata struct ao_adc *packet); +/* ao_beep.c */ + +#define AO_BEEP_LOW 150 +#define AO_BEEP_MID 94 +#define AO_BEEP_HIGH 75 +#define AO_BEEP_OFF 0 + +void +ao_beep_init(void); + +void +ao_beep(uint8_t beep); + +void +ao_beep_for(uint8_t beep, uint16_t ticks); + +/* ao_led.c */ + +#define AO_LED_NONE 0 +#define AO_LED_GREEN 1 +#define AO_LED_RED 2 + +void +ao_led_init(void); + +void +ao_led_on(uint8_t colors); + +void +ao_led_off(uint8_t colors); + +void +ao_led_set(uint8_t colors); + +void +ao_led_for(uint8_t colors, uint16_t ticks); + #endif /* _AO_H_ */