system/spi: Print sent data in the same way as received.

This eases the comparison for testing SPI with looped back MOSI and MISO
signals.
This commit is contained in:
Gustavo Henrique Nihei 2021-04-26 14:52:09 -03:00 committed by Xiang Xiao
parent 267aba6467
commit 63d59b0acf

View File

@ -132,6 +132,21 @@ int spicmd_exch(FAR struct spitool_s *spitool, int argc, FAR char **argv)
argndx += 1; argndx += 1;
} }
spitool_printf(spitool, "Sending:\t");
for (d = 0; d < spitool->count; d++)
{
if (spitool->width <= 8)
{
spitool_printf(spitool, "%02X ", txdata[d]);
}
else
{
spitool_printf(spitool, "%04X ", ((uint16_t *)txdata)[d]);
}
}
spitool_printf(spitool, "\n");
/* Get a handle to the SPI bus */ /* Get a handle to the SPI bus */
fd = spidev_open(spitool->bus); fd = spidev_open(spitool->bus);
@ -168,7 +183,7 @@ int spicmd_exch(FAR struct spitool_s *spitool, int argc, FAR char **argv)
return ret; return ret;
} }
spitool_printf(spitool, "Received: "); spitool_printf(spitool, "Received:\t");
for (d = 0; d < spitool->count; d++) for (d = 0; d < spitool->count; d++)
{ {
if (spitool->width <= 8) if (spitool->width <= 8)