X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=main.h;h=7ee9ed7df139aa48df5d6e7beb42810ba9cb4bbb;hp=30a92625037217d99d831535318d612279a1e196;hb=refs%2Fheads%2Fmaster;hpb=a53014b7f52462e163a7d7ac64866aa75977422f diff --git a/main.h b/main.h index 30a9262..7ee9ed7 100644 --- a/main.h +++ b/main.h @@ -35,9 +35,9 @@ #include #include #include +#include #include "cmdline.h" -#include "callout.h" #include "rc_proto.h" #include "spi_servo.h" @@ -45,6 +45,9 @@ /** ERROR NUMS */ #define E_USER_DEFAULT 194 +#define E_USER_XBEE 195 +#define E_USER_RC_PROTO 196 +#define E_USER_I2C_PROTO 197 #define LED1_ON() sbi(PORTA, 2) #define LED1_OFF() cbi(PORTA, 2) @@ -59,10 +62,13 @@ #define BUZZER_OFF() cbi(PORTA, 4) /* highest priority */ -#define LED_PRIO 170 -#define TIME_PRIO 160 -#define BEEP_PRIO 130 +#define LED_PRIO 160 +#define TIME_PRIO 140 +#define BEEP_PRIO 120 #define SPI_PRIO 100 /* users of spi_servo must have lower prio */ +#define XBEE_PRIO 80 +#define I2C_PRIO 70 +#define LOW_PRIO 60 /* lowest priority */ #define MAX_POWER_LEVEL 5 @@ -72,10 +78,7 @@ struct xbeeboard { struct rdline rdl; char prompt[RDLINE_PROMPT_SIZE]; - struct callout_mgr mainloop_cm; struct callout_mgr intr_cm; - struct callout spi_timer; - struct callout beep_timer; /* log */ uint8_t logs[NB_LOGS+1]; @@ -84,39 +87,7 @@ struct xbeeboard { }; extern struct xbeeboard xbeeboard; - -/* used for timeouts and xbee rx callback */ -struct xbee_ctx { - int foreground; - int channel; - char atcmd_query[2]; - int (*func)(void *frame, unsigned len, void *arg); - void *arg; - struct callout timeout; -}; - -//extern cmdline_parse_ctx_t main_ctx; -extern struct xbee_dev *xbee_dev; -extern int xbee_raw; -extern int xbee_hexdump; -extern int xbee_debug; extern volatile uint32_t global_ms; void bootloader(void); - -int8_t xbeeapp_rx(struct xbee_dev *dev, int channel, int type, - void *frame, unsigned len, void *opaque); -int xbeeapp_send_atcmd(const char *atcmd_str, - void *param, unsigned param_len, int foreground, - int (*func)(void *frame, unsigned len, void *arg), - void *arg); -int xbeeapp_send_msg(uint64_t addr, void *data, - unsigned data_len, int foreground); - -void xbee_stdin_enable(void); -void xbee_stdin_disable(void); - -void xbee_load_timeout(struct xbee_ctx *ctx); -void xbee_unload_timeout(struct xbee_ctx *ctx); - -void xbee_mainloop(void); +uint16_t get_time_ms(void);