X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao.h;h=6de3339f605423ed8c617edf96e994ddda59ade1;hp=2d434134b8ea4f6f01c63a2a2179daac127e3d99;hb=cdaf3fc5802acf2ddc7972a15649ab0e1b31b873;hpb=823f4f92de0c1f8dd7a644a8e56ffe9822bee6e2 diff --git a/ao.h b/ao.h index 2d434134..6de3339f 100644 --- a/ao.h +++ b/ao.h @@ -20,11 +20,12 @@ #include #include +#include #include "cc1111.h" #define DATA_TO_XDATA(a) ((void __xdata *) ((uint8_t) (a) | 0xff00)) -#define AO_STACK_START 0x21 +#define AO_STACK_START 0x34 #define AO_STACK_END 0xfe #define AO_STACK_SIZE (AO_STACK_END - AO_STACK_START + 1) @@ -53,9 +54,88 @@ 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); void ao_delay(uint16_t ticks); +/* ao_adc.c */ + +#define ADC_RING 32 + +struct ao_adc { + uint16_t tick; + int16_t accel; + int16_t pres; + int16_t temp; + int16_t v_batt; + int16_t sense_d; + int16_t sense_m; +}; + +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); + +/* ao_usb.c */ + +void +ao_usb_isr(void) interrupt 6; + +void +ao_usb_flush(void); + +void +ao_usb_putchar(uint8_t c); + +uint8_t +ao_usb_getchar(void); + +void +ao_usb_init(void); + #endif /* _AO_H_ */