X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=cmdline.h;h=3b8bf50fbd845c8a6aa9b9cf98cc70291672ae8c;hp=508d0267ae49910f2069b9e5431ccce76f1b06e4;hb=a8c1b4c97c02a29a202362263597e90d36f25c18;hpb=0e1c93804369af27043c82ccc778c42bf54a9bd4 diff --git a/cmdline.h b/cmdline.h index 508d026..3b8bf50 100644 --- a/cmdline.h +++ b/cmdline.h @@ -21,12 +21,8 @@ */ -#ifdef USE_USB -#include "DualVirtualSerial.h" -#else -#define CMDLINE_UART 0 -#define XBEE_UART 2 -#endif +#define CMDLINE_UART 1 +#define XBEE_UART 0 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 }