SPI continued

This commit is contained in:
anschrammh 2022-07-25 08:22:02 +02:00
parent e625328d58
commit d4c9ffd223

View File

@ -132,6 +132,7 @@ int _reset(const shell_cmd_t *pcmd, int argc, char *const argv[])
int _bus(const shell_cmd_t *pcmd, int argc, char *const argv[])
{
char spi_recv_buff[32] = "";
if(argc > 1)
{
if(strcmp(argv[1], "spi_init") == 0)
@ -146,30 +147,24 @@ int _bus(const shell_cmd_t *pcmd, int argc, char *const argv[])
}
else if(strcmp(argv[1], "spi_w") == 0)
{
}
else if(strcmp(argv[1], "spi_r") == 0)
{
}
else if(strcmp(argv[1], "spi_wr") == 0)
{
char spi_recv_buff[32] = "";
/*shell_printf("Writing [%s](len : %d) to SPI"NEW_LINE, argv[2], strlen(argv[2]));
shell_printf("Writing [%s](len : %d) to SPI"NEW_LINE, argv[2], strlen(argv[2]));
if(tls_spi_write((u8*)argv[2], strlen(argv[2])) != TLS_SPI_STATUS_OK)
{
shell_printf("Failed to write to SPI"NEW_LINE);
return 0;
}
tls_os_time_delay(1000);*/
/*if(tls_spi_read((u8*)spi_recv_buff, sizeof(spi_recv_buff) - 1) != TLS_SPI_STATUS_OK)
}
else if(strcmp(argv[1], "spi_r") == 0)
{
if(tls_spi_read((u8*)spi_recv_buff, sizeof(spi_recv_buff) - 1) != TLS_SPI_STATUS_OK)
{
shell_printf("Failed to read from SPI"NEW_LINE);
return 0;
}*/
}
shell_printf("Received [%s](len : %d) from SPI"NEW_LINE, spi_recv_buff, strlen(spi_recv_buff));
}
else if(strcmp(argv[1], "spi_wr") == 0)
{
if(tls_spi_read_with_cmd((u8 *) argv[2], strlen(argv[2]), (u8 *) spi_recv_buff, sizeof(spi_recv_buff) - 1) != TLS_SPI_STATUS_OK)
{
shell_printf("Failed to write & read combo using SPI"NEW_LINE);