mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-22 22:24:02 -06:00
tmc2240: Adding UART interface support to tmc2240 (#6305)
Signed-off-by: Christoph Frei <fryakatkop@gmail.com>
This commit is contained in:
parent
8f178b892a
commit
2acfa28294
2 changed files with 13 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
import math, logging
|
||||
from . import bus, tmc, tmc2130
|
||||
from . import bus, tmc, tmc2130, tmc_uart
|
||||
|
||||
TMC_FREQUENCY=12500000.
|
||||
|
||||
|
@ -343,8 +343,14 @@ class TMC2240:
|
|||
def __init__(self, config):
|
||||
# Setup mcu communication
|
||||
self.fields = tmc.FieldHelper(Fields, SignedFields, FieldFormatters)
|
||||
self.mcu_tmc = tmc2130.MCU_TMC_SPI(config, Registers, self.fields,
|
||||
TMC_FREQUENCY)
|
||||
if config.get("uart_pin", None) is not None:
|
||||
# use UART for communication
|
||||
self.mcu_tmc = tmc_uart.MCU_TMC_uart(config, Registers, self.fields,
|
||||
3, TMC_FREQUENCY)
|
||||
else:
|
||||
# Use SPI bus for communication
|
||||
self.mcu_tmc = tmc2130.MCU_TMC_SPI(config, Registers, self.fields,
|
||||
TMC_FREQUENCY)
|
||||
# Allow virtual pins to be created
|
||||
tmc.TMCVirtualPinHelper(config, self.mcu_tmc)
|
||||
# Register commands
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue