*
*/
+#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);
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_ */