new command to change the baudrate of the xbee
[protos/xbee-avr.git] / DualVirtualSerial.c
index f5f4053..df22741 100644 (file)
 #include "main.h"\r
 #include "cmdline.h"\r
 \r
-volatile uint16_t global_ms;\r
-struct callout_manager cm;\r
-\r
-\r
 /** LUFA CDC Class driver interface configuration and state information. This structure is\r
  *  passed to all CDC Class driver functions, so that multiple instances of the same class\r
  *  within a device can be differentiated from one another. This is for the first CDC interface,\r
@@ -113,90 +109,6 @@ USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface =
        };\r
 \r
 \r
-/* return time in milliseconds on unsigned 16 bits */\r
-static uint16_t get_time_ms(void)\r
-{\r
-       return global_ms;\r
-}\r
-\r
-static void do_led_blink(struct callout_manager *cm,\r
-                        struct callout *clt, void *dummy)\r
-{\r
-       static uint8_t a = 0;\r
-\r
-       if (a & 1)\r
-               LEDs_SetAllLEDs(0);\r
-       else\r
-               LEDs_SetAllLEDs(0xff);\r
-       a++;\r
-}\r
-\r
-static void increment_ms(void *dummy)\r
-{\r
-       global_ms++;\r
-}\r
-\r
-static void main_timer_interrupt(void)\r
-{\r
-       static uint8_t cpt = 0;\r
-       cpt++;\r
-       sei();\r
-       if ((cpt & 0x3) == 0)\r
-               scheduler_interrupt();\r
-}\r
-\r
-\r
-/** Main program entry point. This routine contains the overall program flow, including initial\r
- *  setup of all components and the main program loop.\r
- */\r
-int main(void)\r
-{\r
-       struct callout t1;\r
-       FILE *xbee_file;\r
-       int8_t err;\r
-       struct xbee_dev dev;\r
-\r
-       SetupHardware();\r
-\r
-       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
-\r
-       fdevopen(usbserial1_dev_send, usbserial1_dev_recv);\r
-       xbee_file = fdevopen(usbserial2_dev_send, usbserial2_dev_recv);\r
-       scheduler_init();\r
-       timer_init();\r
-       timer0_register_OV_intr(main_timer_interrupt);\r
-       sei();\r
-\r
-       scheduler_add_periodical_event_priority(increment_ms, NULL,\r
-                                               1000L / SCHEDULER_UNIT,\r
-                                               LED_PRIO);\r
-       cmdline_init();\r
-       callout_manager_init(&cm, get_time_ms);\r
-       callout_reset(&cm, &t1, 500, PERIODICAL, do_led_blink, NULL);\r
-\r
-       /* initialize libxbee */\r
-       err = xbee_init();\r
-       if (err < 0)\r
-               return -1;\r
-\r
-       xbee_dev = &dev;\r
-\r
-       /* open xbee device */\r
-       if (xbee_open(xbee_dev, xbee_file) < 0)\r
-               return -1;\r
-\r
-       /* register default channel with a callback */\r
-       if (xbee_register_channel(xbee_dev, XBEE_DEFAULT_CHANNEL,\r
-                                 xbee_rx, NULL) < 0) {\r
-               fprintf(stderr, "cannot register default channel\n");\r
-               return -1;\r
-       }\r
-\r
-       sei();\r
-       xbee_mainloop();\r
-       return 0;\r
-}\r
-\r
 /** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r