Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox
[fw/altos] / src / ao_radio.c
index 0849349edb1d10a59208aebad7929c523da414f4..3fb4afd7d4831d87c556a201634655e70ba95b3c 100644 (file)
@@ -275,7 +275,7 @@ __xdata uint8_t ao_radio_done;
 __xdata uint8_t ao_radio_mutex;
 
 void
-ao_radio_general_isr(void) interrupt 16
+ao_radio_general_isr(void) __interrupt 16
 {
        S1CON &= ~0x03;
        if (RFIF & RFIF_IM_TIMEOUT) {
@@ -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 },
 };