mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-07 14:04:17 -06:00
tmc: Move common TMC stepper driver code to new file tmc.py
Move common code from tmc2130.py to tmc.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
10c0da9a6c
commit
b21a22d744
5 changed files with 267 additions and 261 deletions
|
@ -3,8 +3,8 @@
|
|||
# Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
import math, logging, collections
|
||||
import bus, tmc2130
|
||||
import math, logging
|
||||
import bus, tmc, tmc2130
|
||||
|
||||
TMC_FREQUENCY=12000000.
|
||||
|
||||
|
@ -289,19 +289,19 @@ class TMC5160CurrentHelper:
|
|||
class TMC5160:
|
||||
def __init__(self, config):
|
||||
# Setup mcu communication
|
||||
self.fields = tmc2130.FieldHelper(Fields, SignedFields, FieldFormatters)
|
||||
self.fields = tmc.FieldHelper(Fields, SignedFields, FieldFormatters)
|
||||
self.mcu_tmc = tmc2130.MCU_TMC_SPI(config, Registers, self.fields)
|
||||
# Allow virtual endstop to be created
|
||||
diag1_pin = config.get('diag1_pin', None)
|
||||
tmc2130.TMCEndstopHelper(config, self.mcu_tmc, diag1_pin)
|
||||
tmc.TMCEndstopHelper(config, self.mcu_tmc, diag1_pin)
|
||||
# Register commands
|
||||
cmdhelper = tmc2130.TMCCommandHelper(config, self.mcu_tmc)
|
||||
cmdhelper = tmc.TMCCommandHelper(config, self.mcu_tmc)
|
||||
cmdhelper.setup_register_dump(self.query_registers)
|
||||
# Setup basic register values
|
||||
mh = tmc2130.TMCMicrostepHelper(config, self.mcu_tmc)
|
||||
mh = tmc.TMCMicrostepHelper(config, self.mcu_tmc)
|
||||
self.get_microsteps = mh.get_microsteps
|
||||
self.get_phase = mh.get_phase
|
||||
tmc2130.TMCStealthchopHelper(config, self.mcu_tmc, TMC_FREQUENCY)
|
||||
tmc.TMCStealthchopHelper(config, self.mcu_tmc, TMC_FREQUENCY)
|
||||
# CHOPCONF
|
||||
set_config_field = self.fields.set_config_field
|
||||
set_config_field(config, "toff", 3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue