X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=cmdline.h;fp=cmdline.h;h=724f5ef9792d0bfbf2ff968e053f6a39259e007a;hp=508d0267ae49910f2069b9e5431ccce76f1b06e4;hb=701d7cbf7d30c49e1d21943ce47d00bf250c70e7;hpb=57895b3bb2fe0582c589685b7df34f3968b346ec diff --git a/cmdline.h b/cmdline.h index 508d026..724f5ef 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 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 }