mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
spitool: add support for 32-bit SPI BUS width
Link: https://git.motec.com.au/id/I62920d28ab9804d52d25af3bcdd0f1ceb87be93f
This commit is contained in:
parent
6a5912c76c
commit
be55ea7869
2 changed files with 11 additions and 3 deletions
|
|
@ -192,7 +192,7 @@ int spitool_common_args(FAR struct spitool_s *spitool, FAR char **arg)
|
|||
|
||||
case 'w':
|
||||
ret = arg_decimal(arg, &value);
|
||||
if (value != 8 && value != 16)
|
||||
if (value != 8 && value != 16 && value != 32)
|
||||
{
|
||||
goto out_of_range;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,10 +124,14 @@ int spicmd_exch(FAR struct spitool_s *spitool, int argc, FAR char **argv)
|
|||
{
|
||||
spitool_printf(spitool, "%02X ", txdata[d]);
|
||||
}
|
||||
else
|
||||
else if (spitool->width <= 16)
|
||||
{
|
||||
spitool_printf(spitool, "%04X ", ((uint16_t *)txdata)[d]);
|
||||
}
|
||||
else
|
||||
{
|
||||
spitool_printf(spitool, "%08" PRIX32 " ", ((uint32_t *)txdata)[d]);
|
||||
}
|
||||
}
|
||||
|
||||
spitool_printf(spitool, "\n");
|
||||
|
|
@ -175,10 +179,14 @@ int spicmd_exch(FAR struct spitool_s *spitool, int argc, FAR char **argv)
|
|||
{
|
||||
spitool_printf(spitool, "%02X ", rxdata[d]);
|
||||
}
|
||||
else
|
||||
else if (spitool->width <= 16)
|
||||
{
|
||||
spitool_printf(spitool, "%04X ", ((uint16_t *)rxdata)[d]);
|
||||
}
|
||||
else
|
||||
{
|
||||
spitool_printf(spitool, "%08" PRIX32 " ", ((uint32_t *)rxdata)[d]);
|
||||
}
|
||||
}
|
||||
|
||||
spitool_printf(spitool, "\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue