git.droids-corp.org
/
protos
/
xbee-avr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add missing #ifndef to protect header files
[protos/xbee-avr.git]
/
cmdline.c
diff --git
a/cmdline.c
b/cmdline.c
index
60dc9a6
..
5745b9c
100644
(file)
--- a/
cmdline.c
+++ b/
cmdline.c
@@
-37,32
+37,22
@@
#include "cmdline.h"
#include "cmdline.h"
-#ifdef USE_USB
-#include "DualVirtualSerial.h"
-#endif
-
+extern const parse_ctx_t PROGMEM main_ctx[];
-extern parse_pgm_ctx_t main_ctx[];
int cmdline_dev_send(char c, FILE* f)
{
int cmdline_dev_send(char c, FILE* f)
{
-#ifdef USE_USB
- CDC_Device_SendByte(&VirtualSerial1_CDC_Interface, (uint8_t)c);
-#else
+ (void)f;
uart_send(CMDLINE_UART, c);
uart_send(CMDLINE_UART, c);
-#endif
return 0;
}
int cmdline_dev_recv(FILE* f)
{
int16_t c;
return 0;
}
int cmdline_dev_recv(FILE* f)
{
int16_t c;
-#ifdef USE_USB
- /* non-blocking ! */
- c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface);
-#else
+
+ (void)f;
c = uart_recv_nowait(CMDLINE_UART);
c = uart_recv_nowait(CMDLINE_UART);
-#endif
if (c < 0)
return _FDEV_EOF;
if (c < 0)
return _FDEV_EOF;
@@
-72,11
+62,8
@@
int cmdline_dev_recv(FILE* f)
int xbee_dev_send(char c, FILE* f)
{
int xbee_dev_send(char c, FILE* f)
{
-#ifdef USE_USB
- CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, (uint8_t)c);
-#else
+ (void)f;
uart_send(XBEE_UART, c);
uart_send(XBEE_UART, c);
-#endif
return 0;
}
return 0;
}
@@
-84,12
+71,8
@@
int xbee_dev_recv(FILE* f)
{
int16_t c;
{
int16_t c;
-#ifdef USE_USB
- /* non-blocking ! */
- c = CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface);
-#else
+ (void)f;
c = uart_recv_nowait(XBEE_UART);
c = uart_recv_nowait(XBEE_UART);
-#endif
if (c < 0)
return _FDEV_EOF;
if (c < 0)
return _FDEV_EOF;
@@
-100,8
+83,10
@@
static void
valid_buffer(const char *buf, uint8_t size)
{
int8_t ret;
valid_buffer(const char *buf, uint8_t size)
{
int8_t ret;
+ PGM_P ctx = (PGM_P)main_ctx;
- ret = parse(main_ctx, buf);
+ (void)size;
+ ret = parse(ctx, buf);
if (ret == PARSE_AMBIGUOUS)
printf_P(PSTR("Ambiguous command\r\n"));
else if (ret == PARSE_NOMATCH)
if (ret == PARSE_AMBIGUOUS)
printf_P(PSTR("Ambiguous command\r\n"));
else if (ret == PARSE_NOMATCH)
@@
-114,7
+99,8
@@
static int8_t
complete_buffer(const char *buf, char *dstbuf, uint8_t dstsize,
int16_t *state)
{
complete_buffer(const char *buf, char *dstbuf, uint8_t dstsize,
int16_t *state)
{
- return complete(main_ctx, buf, state, dstbuf, dstsize);
+ PGM_P ctx = (PGM_P)main_ctx;
+ return complete(ctx, buf, state, dstbuf, dstsize);
}
}
@@
-142,8
+128,10
@@
void emergency(char c)
i++;
else if ( !(i == 1 && c == 'p') )
i = 0;
i++;
else if ( !(i == 1 && c == 'p') )
i = 0;
- if (i == 3)
- bootloader();
+ if (i == 3) {
+ //bootloader();
+ reset();
+ }
}
/* log function, add a command to configure
}
/* log function, add a command to configure