4
4
*/
5
5
6
6
#include <zephyr/sys/util.h>
7
-
8
7
#include "adi_tmc_spi.h"
9
8
10
9
#define BUFFER_SIZE 5U
11
10
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
-
35
11
int tmc_spi_read_register (const struct spi_dt_spec * bus , const uint8_t read_address_mask ,
36
12
const uint8_t register_address , uint32_t * data )
37
13
{
@@ -63,9 +39,6 @@ int tmc_spi_read_register(const struct spi_dt_spec *bus, const uint8_t read_addr
63
39
return status ;
64
40
}
65
41
66
- print_tx_rx_buffer (tx_buffer , rx_buffer );
67
- parse_tmc_spi_status (rx_buffer [0 ]);
68
-
69
42
/** read the value from the address */
70
43
status = spi_transceive_dt (bus , & spi_buffer_array_tx , & spi_buffer_array_rx );
71
44
if (status < 0 ) {
@@ -75,8 +48,6 @@ int tmc_spi_read_register(const struct spi_dt_spec *bus, const uint8_t read_addr
75
48
* data = ((uint32_t )rx_buffer [1 ] << 24 ) + ((uint32_t )rx_buffer [2 ] << 16 ) +
76
49
((uint32_t )rx_buffer [3 ] << 8 ) + (uint32_t )rx_buffer [4 ];
77
50
78
- print_tx_rx_buffer (tx_buffer , rx_buffer );
79
- parse_tmc_spi_status (rx_buffer [0 ]);
80
51
return status ;
81
52
}
82
53
@@ -111,8 +82,5 @@ int tmc_spi_write_register(const struct spi_dt_spec *bus, const uint8_t write_bi
111
82
return status ;
112
83
}
113
84
114
- print_tx_rx_buffer (tx_buffer , rx_buffer );
115
- parse_tmc_spi_status (rx_buffer [0 ]);
116
-
117
85
return status ;
118
86
}
0 commit comments