altos: add the 'L' command to show the status of a linked companion board
authorKeith Packard <keithp@keithp.com>
Fri, 12 Aug 2011 12:42:05 +0000 (05:42 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 14 Aug 2011 01:46:12 +0000 (18:46 -0700)
This prints out whether there is a board connected, along with the
various values fetched from it.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_companion.c

index e2e6d05ae81c0f6b468dd044b0857e3af16821cb..b424dd896078c468e09759311546181647771ac8 100644 (file)
@@ -85,6 +85,15 @@ ao_companion(void)
 void
 ao_companion_status(void) __reentrant
 {
+       uint8_t i;
+       printf("Companion running: %d\n", ao_companion_running);
+       printf("device: %d\n", ao_companion_setup.board_id);
+       printf("update period: %d\n", ao_companion_setup.update_period);
+       printf("channels: %d\n", ao_companion_setup.channels);
+       printf("data:");
+       for(i = 0; i < ao_companion_setup.channels; i++)
+               printf(" %5u", ao_companion_data[i]);
+       printf("\n");
 }
 
 __code struct ao_cmds ao_companion_cmds[] = {
@@ -102,6 +111,5 @@ ao_companion_init(void)
        COMPANION_CS_SEL &= ~COMPANION_CS_MASK; /* set CS pins as GPIO */
 
        ao_cmd_register(&ao_companion_cmds[0]);
-
        ao_add_task(&ao_companion_task, ao_companion, "companion");
 }