X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=cmdline.h;h=034244a6003a7409fee2fd609db28c08cb4d6891;hp=508d0267ae49910f2069b9e5431ccce76f1b06e4;hb=HEAD;hpb=0e1c93804369af27043c82ccc778c42bf54a9bd4 diff --git a/cmdline.h b/cmdline.h index 508d026..034244a 100644 --- a/cmdline.h +++ b/cmdline.h @@ -20,13 +20,11 @@ * */ +#ifndef _CMDLINE_H_ +#define _CMDLINE_H_ -#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); @@ -41,34 +39,25 @@ int cmdline_poll(void); int cmdline_dev_send(char c, FILE* f); int cmdline_dev_recv(FILE* f); +void cmdline_write_char(char c); +void cmdline_valid_buffer(const char *buf, uint8_t size); 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 } + +#endif /* _CMDLINE_H_ */