add a complete rc_proto stack (not tested)
[protos/xbee-avr.git] / xbee_user.c
index a4cb84f..9d3da99 100644 (file)
@@ -56,6 +56,8 @@ int xbee_cmdline_input_enabled = 1;
 /* parameters */
 int xbee_raw = 0;
 
+static struct callout xbee_rx_poll_timer;
+
 static void __hexdump(const void *buf, unsigned int len)
 {
        unsigned int i, out, ofs;
@@ -235,7 +237,9 @@ static int parse_atcmd(struct xbee_ctx *ctx, struct xbee_atresp_hdr *frame,
 }
 
 
-/* main rx entry point for application */
+/* Main xbee rx entry point for application. It decodes the xbee frame type and
+ * dispatch to the application layer. Then "len" argument does not include the
+ * xbee_hdr structure (delimiter, len, type, id) and checksum. */
 int8_t xbeeapp_rx(struct xbee_dev *dev, int channel, int type,
             void *frame, unsigned len, void *opaque)
 {
@@ -544,8 +548,8 @@ void xbee_stdin_disable(void)
 
 void xbeeapp_init(void)
 {
-       callout_init(&xbeeboard.xbee_rx_poll_timer, xbee_rx_poll_timer_cb,
+       callout_init(&xbee_rx_poll_timer, xbee_rx_poll_timer_cb,
                NULL, XBEE_PRIO);
-       callout_schedule(&xbeeboard.intr_cm,
-               &xbeeboard.xbee_rx_poll_timer, XBEE_POLL_TIMER_MS);
+       callout_schedule(&xbeeboard.intr_cm, &xbee_rx_poll_timer,
+               XBEE_POLL_TIMER_MS);
 }