Skip to content

Commit a371f0c

Browse files
jilaypandyafabiobaltieri
authored andcommitted
drivers: stepper: tmc_spi: remove print_status_byte
print_status_byte is specific to tmc50xx and hence shoud not be placeed in common tmc_spi.c which is supposed to be reused by a variety of drivers Signed-off-by: Jilay Pandya <[email protected]>
1 parent bbeb01d commit a371f0c

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

drivers/stepper/adi_tmc/adi_tmc_spi.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,10 @@
44
*/
55

66
#include <zephyr/sys/util.h>
7-
87
#include "adi_tmc_spi.h"
98

109
#define BUFFER_SIZE 5U
1110

12-
#include <zephyr/logging/log.h>
13-
14-
LOG_MODULE_REGISTER(tmc_spi, CONFIG_SPI_LOG_LEVEL);
15-
16-
static void parse_tmc_spi_status(const uint8_t status_byte)
17-
{
18-
if ((status_byte & BIT_MASK(0)) != 0) {
19-
LOG_WRN("spi dataframe: reset_flag detected");
20-
}
21-
if ((status_byte & BIT_MASK(1)) != 0) {
22-
LOG_WRN("spi dataframe: driver_error(1) detected");
23-
}
24-
if ((status_byte & BIT_MASK(2)) != 0) {
25-
LOG_WRN("spi dataframe: driver_error(2) detected");
26-
}
27-
}
28-
29-
static void print_tx_rx_buffer(const uint8_t *const tx_buffer, const uint8_t *const rx_buffer)
30-
{
31-
LOG_HEXDUMP_DBG(tx_buffer, BUFFER_SIZE, "TX: ");
32-
LOG_HEXDUMP_DBG(rx_buffer, BUFFER_SIZE, "RX: ");
33-
}
34-
3511
int tmc_spi_read_register(const struct spi_dt_spec *bus, const uint8_t read_address_mask,
3612
const uint8_t register_address, uint32_t *data)
3713
{
@@ -63,9 +39,6 @@ int tmc_spi_read_register(const struct spi_dt_spec *bus, const uint8_t read_addr
6339
return status;
6440
}
6541

66-
print_tx_rx_buffer(tx_buffer, rx_buffer);
67-
parse_tmc_spi_status(rx_buffer[0]);
68-
6942
/** read the value from the address */
7043
status = spi_transceive_dt(bus, &spi_buffer_array_tx, &spi_buffer_array_rx);
7144
if (status < 0) {
@@ -75,8 +48,6 @@ int tmc_spi_read_register(const struct spi_dt_spec *bus, const uint8_t read_addr
7548
*data = ((uint32_t)rx_buffer[1] << 24) + ((uint32_t)rx_buffer[2] << 16) +
7649
((uint32_t)rx_buffer[3] << 8) + (uint32_t)rx_buffer[4];
7750

78-
print_tx_rx_buffer(tx_buffer, rx_buffer);
79-
parse_tmc_spi_status(rx_buffer[0]);
8051
return status;
8152
}
8253

@@ -111,8 +82,5 @@ int tmc_spi_write_register(const struct spi_dt_spec *bus, const uint8_t write_bi
11182
return status;
11283
}
11384

114-
print_tx_rx_buffer(tx_buffer, rx_buffer);
115-
parse_tmc_spi_status(rx_buffer[0]);
116-
11785
return status;
11886
}

0 commit comments

Comments
 (0)