mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-05 04:54:11 -06:00
tmc: add spi status decode
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
parent
8d67e1a4e9
commit
5923a2e3a1
1 changed files with 7 additions and 0 deletions
|
@ -272,6 +272,13 @@ class MCU_TMC_SPI:
|
|||
with self.mutex:
|
||||
resp = self.tmc_spi.reg_read(reg, self.chain_pos)
|
||||
return resp
|
||||
def decode_spi_status(spi_status):
|
||||
return {
|
||||
"standstill": spi_status >> 3 & 0x1,
|
||||
"sg2": spi_status >> 2 & 0x1,
|
||||
"driver_error": spi_status >> 1 & 0x1,
|
||||
"reset_flag": spi_status & 0x1
|
||||
}
|
||||
def get_register(self, reg_name):
|
||||
return self.get_register_raw(reg_name)["data"]
|
||||
def set_register(self, reg_name, val, print_time=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue