]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/commitdiff
Print SPI chip name in portlist output
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 29 Aug 2015 08:48:42 +0000 (10:48 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 3 Sep 2015 08:30:59 +0000 (10:30 +0200)
rpp-test-sw/commands/cmd_port.c

index e20d83502fff92100ab974806bfcdaa795ce969c..471b2c6679dffd437a1af1df8b71387e2e954f99 100644 (file)
@@ -43,18 +43,18 @@ int cmd_do_port_list(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
        for (i = 0; i < ARRAY_SIZE(port_desc); i++) {
                const struct port_desc *port = &port_desc[i];
                const char *rw[4] = { "N/A", "WO", "RO", "RW" };
-               const char *type = "";
+               char note[30] = "";
 #ifdef TARGET_HAS_SPI
                if (port->set == port_spi_set)
-                       type = "SPI";
+                       snprintf(note, sizeof(note), "SPI, %s", port->cfg.spi.chip);
 #endif
                rpp_sci_printf("%-10s %s %dx%db%s%s%s\r\n",
                                           port->name,
                                           rw[(port->set ? 1 : 0) | (port->get ? 2 : 0)],
                                           port->numchn, port->bpch,
-                                          *type ? " (": "",
-                                          type,
-                                          *type ? ")" : "");
+                                          *note ? " (": "",
+                                          note,
+                                          *note ? ")" : "");
        }
        return 1;
 }