X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fao_serial.c;h=1e3ea3e39b2cd26852d30b18f5a8c5c095070f18;hp=4155e776934ac59f196e67642aa23d462d011025;hb=fb8f3fee6a1bab1e46d782e84405845cee2dadb4;hpb=d3f76ce58b9c0ed2e5a9fe3bbc7fb9cb38247714 diff --git a/src/ao_serial.c b/src/ao_serial.c index 4155e776..1e3ea3e3 100644 --- a/src/ao_serial.c +++ b/src/ao_serial.c @@ -60,7 +60,10 @@ ao_serial_getchar(void) __critical ao_sleep(&ao_usart1_rx_fifo); ao_fifo_remove(ao_usart1_rx_fifo, c); if (serial_echo) { - printf("%02x\n", ((int) c) & 0xff); + printf("%02x ", ((int) c) & 0xff); + if (c >= ' ') + putchar(c); + putchar('\n'); flush(); } return c; @@ -99,9 +102,17 @@ monitor_serial(void) serial_echo = ao_cmd_lex_i != 0; } +static void +serial_baud(void) +{ + ao_cmd_hex(); + ao_serial_set_speed(ao_cmd_lex_i); +} + __code struct ao_cmds ao_serial_cmds[] = { { 'S', send_serial, "S Send data to serial line" }, { 'M', monitor_serial, "M Monitor serial data" }, + { 'B', serial_baud, "B <0 = 4800, 1 = 57600> Set serial baud rate" }, { 0, send_serial, NULL }, }; @@ -113,6 +124,10 @@ static const struct { /* .baud = */ 163, /* .gcr = */ (7 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB }, + /* [AO_SERIAL_SPEED_9600] = */ { + /* .baud = */ 163, + /* .gcr = */ (8 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB + }, /* [AO_SERIAL_SPEED_57600] = */ { /* .baud = */ 59, /* .gcr = */ (11 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB