diff options
author | Keith Packard <keithp@keithp.com> | 2010-11-21 14:03:17 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-11-21 14:03:17 -0800 |
commit | 377ee7e90ecd028f984cd1abce96b2efc3b5b977 (patch) | |
tree | f03b09418ca12d3fa73360bc47b511ebee18adcb /src | |
parent | 902735ffbfdd97672d52b09f17cdcd619193fd05 (diff) |
altos: Add on/off modes to 'C' command
This lets the user turn the radio on/off and then invoke other commands.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/ao_radio.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/ao_radio.c b/src/ao_radio.c index f4a9d3b2..3fb4afd7 100644 --- a/src/ao_radio.c +++ b/src/ao_radio.c @@ -448,19 +448,32 @@ ao_radio_rdf_abort(void) void ao_radio_test(void) { - ao_set_monitor(0); - ao_packet_slave_stop(); - ao_radio_get(); - printf ("Hit a character to stop..."); flush(); - RFST = RFST_STX; - getchar(); - ao_radio_idle(); - ao_radio_put(); - putchar('\n'); + uint8_t mode = 2; + ao_cmd_white(); + if (ao_cmd_lex_c != '\n') { + ao_cmd_decimal(); + mode = (uint8_t) ao_cmd_lex_u32; + } + mode++; + if (mode & 2) { + ao_set_monitor(0); + ao_packet_slave_stop(); + ao_radio_get(); + RFST = RFST_STX; + } + if (mode == 3) { + printf ("Hit a character to stop..."); flush(); + getchar(); + putchar('\n'); + } + if (mode & 1) { + ao_radio_idle(); + ao_radio_put(); + } } __code struct ao_cmds ao_radio_cmds[] = { - { 'C', ao_radio_test, "C Radio carrier test" }, + { 'C', ao_radio_test, "C <1 start, 0 stop, none both> Radio carrier test" }, { 0, ao_radio_test, NULL }, }; |