Allow product to override maximum number of command lists (NUM_CMDS)
[fw/altos] / src / core / ao_cmd.c
index 0c902f6be935368842f4e152bd062c295a90c182..fbf0c34778094ae08ec176525bc58d49318a2ec8 100644 (file)
@@ -121,10 +121,16 @@ ao_cmd_put8(uint8_t v)
        putnibble(v & 0xf);
 }
 
+uint8_t
+ao_cmd_is_white(void)
+{
+       return ao_cmd_lex_c == ' ' || ao_cmd_lex_c == '\t';
+}
+
 void
 ao_cmd_white(void)
 {
-       while (ao_cmd_lex_c == ' ' || ao_cmd_lex_c == '\t')
+       while (ao_cmd_is_white())
                ao_cmd_lex();
 }
 
@@ -245,11 +251,16 @@ version(void)
        printf("serial-number    %u\n", ao_serial_number);
 #if HAS_LOG
        printf("log-format       %u\n", ao_log_format);
+#endif
+#if HAS_MS5607
+       ao_ms5607_info();
 #endif
        printf("software-version %s\n", ao_version);
 }
 
+#ifndef NUM_CMDS
 #define NUM_CMDS       11
+#endif
 
 static __code struct ao_cmds   *__xdata (ao_cmds[NUM_CMDS]);
 static __pdata uint8_t         ao_ncmds;
@@ -257,9 +268,9 @@ static __pdata uint8_t              ao_ncmds;
 static void
 help(void)
 {
-       register uint8_t cmds;
-       register uint8_t cmd;
-       register __code struct ao_cmds * cs;
+       __pdata uint8_t cmds;
+       __pdata uint8_t cmd;
+       __code struct ao_cmds * __pdata cs;
 
        for (cmds = 0; cmds < ao_ncmds; cmds++) {
                cs = ao_cmds[cmds];
@@ -294,7 +305,7 @@ ao_cmd_register(__code struct ao_cmds *cmds)
 void
 ao_cmd(void)
 {
-       char    c;
+       __pdata char    c;
        uint8_t cmd, cmds;
        __code struct ao_cmds * __xdata cs;
        void (*__xdata func)(void);
@@ -330,8 +341,8 @@ __xdata struct ao_task ao_cmd_task;
 
 __code struct ao_cmds  ao_base_cmds[] = {
        { help,         "?\0Help" },
-       { ao_task_info, "T\0Show tasks" },
-       { echo,         "E <0 off, 1 on>\0Set echo mode" },
+       { ao_task_info, "T\0Tasks" },
+       { echo,         "E <0 off, 1 on>\0Echo" },
        { ao_reboot,    "r eboot\0Reboot" },
        { version,      "v\0Version" },
        { 0,    NULL },