remove deprecated USE_USB macro
authorOlivier Matz <zer0@droids-corp.org>
Wed, 25 Sep 2013 18:56:09 +0000 (20:56 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Wed, 25 Sep 2013 18:57:22 +0000 (20:57 +0200)
Signed-off-by: Olivier Matz <zer0@droids-corp.org>
cmdline.c
cmdline.h
commands.c
main.c

index d9fd836..9f4129e 100644 (file)
--- a/cmdline.c
+++ b/cmdline.c
 #include "cmdline.h"
 
 
-#ifdef USE_USB
-#include "DualVirtualSerial.h"
-#endif
-
-
 extern const parse_ctx_t PROGMEM main_ctx[];
 
 
 int cmdline_dev_send(char c, FILE* f)
 {
        (void)f;
-#ifdef USE_USB
-       CDC_Device_SendByte(&VirtualSerial1_CDC_Interface, (uint8_t)c);
-#else
        uart_send(CMDLINE_UART, c);
-#endif
        return 0;
 }
 
@@ -61,12 +52,7 @@ int cmdline_dev_recv(FILE* f)
        int16_t c;
 
        (void)f;
-#ifdef USE_USB
-       /* non-blocking ! */
-       c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface);
-#else
        c = uart_recv_nowait(CMDLINE_UART);
-#endif
        if (c < 0)
                return _FDEV_EOF;
 
@@ -77,11 +63,7 @@ int cmdline_dev_recv(FILE* f)
 int xbee_dev_send(char c, FILE* f)
 {
        (void)f;
-#ifdef USE_USB
-       CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, (uint8_t)c);
-#else
        uart_send(XBEE_UART, c);
-#endif
        return 0;
 }
 
@@ -90,12 +72,7 @@ int xbee_dev_recv(FILE* f)
        int16_t c;
 
        (void)f;
-#ifdef USE_USB
-       /* non-blocking ! */
-       c = CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface);
-#else
        c = uart_recv_nowait(XBEE_UART);
-#endif
        if (c < 0)
                return _FDEV_EOF;
 
index 508d026..724f5ef 100644 (file)
--- a/cmdline.h
+++ b/cmdline.h
  */
 
 
-#ifdef USE_USB
-#include "DualVirtualSerial.h"
-#else
 #define CMDLINE_UART 0
 #define XBEE_UART 2
-#endif
 
 void cmdline_init(void);
 
@@ -45,30 +41,17 @@ int cmdline_dev_recv(FILE* f);
 int xbee_dev_send(char c, FILE* f);
 int xbee_dev_recv(FILE* f);
 
-static inline uint8_t cmdline_keypressed(void) {
-#ifdef USE_USB
-       return (CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface) >= 0);
-#else
+static inline uint8_t cmdline_keypressed(void)
+{
        return (uart_recv_nowait(CMDLINE_UART) != -1);
-#endif
 }
 
-static inline int16_t cmdline_getchar(void) {
-#ifdef USE_USB
-       return CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface);
-#else
+static inline int16_t cmdline_getchar(void)
+{
        return uart_recv_nowait(CMDLINE_UART);
-#endif
 }
 
-static inline uint8_t cmdline_getchar_wait(void) {
-#ifdef USE_USB
-       int16_t c;
-       do {
-               c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface);
-       } while (c < 0);
-       return c;
-#else
+static inline uint8_t cmdline_getchar_wait(void)
+{
        return uart_recv(CMDLINE_UART);
-#endif
 }
index fb67438..dee0693 100644 (file)
@@ -1260,7 +1260,6 @@ const parse_inst_t PROGMEM cmd_debug = {
        },
 };
 
-#ifndef USE_USB
 /**********************************************************/
 
 /* this structure is filled when cmd_baudrate is parsed successfully */
@@ -1299,7 +1298,6 @@ const parse_inst_t PROGMEM cmd_baudrate = {
                NULL,
        },
 };
-#endif
 
 /* this structure is filled when cmd_test_spi is parsed successfully */
 struct cmd_test_spi_result {
@@ -1379,9 +1377,7 @@ const parse_ctx_t PROGMEM main_ctx[] = {
        &cmd_raw,
        &cmd_dump,
        &cmd_debug,
-#ifndef USE_USB
        &cmd_baudrate,
-#endif
        &cmd_test_spi,
        NULL,
 };
diff --git a/main.c b/main.c
index 73a3409..2120a62 100644 (file)
--- a/main.c
+++ b/main.c
@@ -517,7 +517,6 @@ void xbee_unload_timeout(struct xbee_ctx *ctx)
 
 void bootloader(void)
 {
-#ifndef USE_USB
 #define BOOTLOADER_ADDR 0x3f000
        if (pgm_read_byte_far(BOOTLOADER_ADDR) == 0xff) {
                printf_P(PSTR("Bootloader is not present\r\n"));
@@ -541,7 +540,6 @@ void bootloader(void)
        /* __asm__ __volatile__ ("ldi r31,0xf8\n"); */
        /* __asm__ __volatile__ ("ldi r30,0x00\n"); */
        /* __asm__ __volatile__ ("eijmp\n"); */
-#endif
 }
 
 void xbee_mainloop(void)
@@ -577,12 +575,6 @@ void xbee_mainloop(void)
                                cmdline_poll();
                        xbee_proto_rx(xbee_dev);
                }
-
-#ifdef USE_USB
-               CDC_Device_USBTask(&VirtualSerial1_CDC_Interface);
-               CDC_Device_USBTask(&VirtualSerial2_CDC_Interface);
-               USB_USBTask();
-#endif
        }
 }
 
@@ -601,14 +593,7 @@ static void do_led_blink(struct callout_manager *cm,
        (void)clt;
        (void)dummy;
 
-#ifdef USE_USB
-       if (a & 1)
-               LEDs_SetAllLEDs(0);
-       else
-               LEDs_SetAllLEDs(0xff);
-#else
        /* XXX */
-#endif
        a++;
 }
 
@@ -637,14 +622,8 @@ int main(void)
        int8_t err;
        struct xbee_dev dev;
 
-#ifdef USE_USB
-       SetupHardware();
-
-       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-#else
        uart_init();
        uart_register_rx_event(CMDLINE_UART, emergency);
-#endif
 
        fdevopen(cmdline_dev_send, cmdline_dev_recv);
        xbee_file = fdevopen(xbee_dev_send, xbee_dev_recv);
@@ -657,11 +636,10 @@ int main(void)
                                                LED_PRIO);
        cmdline_init();
        spi_servo_init();
-#ifndef USE_USB
-       /* in usb mode, it's done in usb callback */
+
        printf_P(PSTR("\r\n"));
        rdline_newline(&xbeeboard.rdl, xbeeboard.prompt);
-#endif
+
        callout_manager_init(&cm, get_time_ms);
        callout_reset(&cm, &t1, 500, PERIODICAL, do_led_blink, NULL);