aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/samd_sercom.py
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/extras/samd_sercom.py')
-rw-r--r--klippy/extras/samd_sercom.py33
1 files changed, 20 insertions, 13 deletions
diff --git a/klippy/extras/samd_sercom.py b/klippy/extras/samd_sercom.py
index 44a9263c..0f17b78b 100644
--- a/klippy/extras/samd_sercom.py
+++ b/klippy/extras/samd_sercom.py
@@ -4,6 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
+
class SamdSERCOM:
def __init__(self, config):
self.printer = config.get_printer()
@@ -15,27 +16,33 @@ class SamdSERCOM:
ppins = self.printer.lookup_object("pins")
tx_pin_params = ppins.lookup_pin(self.tx_pin)
- self.mcu = tx_pin_params['chip']
+ self.mcu = tx_pin_params["chip"]
self.mcu.add_config_cmd(
- "set_sercom_pin bus=%s sercom_pin_type=tx pin=%s" % (
- self.sercom, tx_pin_params['pin']))
+ "set_sercom_pin bus=%s sercom_pin_type=tx pin=%s"
+ % (self.sercom, tx_pin_params["pin"])
+ )
clk_pin_params = ppins.lookup_pin(self.clk_pin)
- if self.mcu is not clk_pin_params['chip']:
- raise ppins.error("%s: SERCOM pins must be on same mcu" % (
- config.get_name(),))
+ if self.mcu is not clk_pin_params["chip"]:
+ raise ppins.error(
+ "%s: SERCOM pins must be on same mcu" % (config.get_name(),)
+ )
self.mcu.add_config_cmd(
- "set_sercom_pin bus=%s sercom_pin_type=clk pin=%s" % (
- self.sercom, clk_pin_params['pin']))
+ "set_sercom_pin bus=%s sercom_pin_type=clk pin=%s"
+ % (self.sercom, clk_pin_params["pin"])
+ )
if self.rx_pin:
rx_pin_params = ppins.lookup_pin(self.rx_pin)
- if self.mcu is not rx_pin_params['chip']:
- raise ppins.error("%s: SERCOM pins must be on same mcu" % (
- config.get_name(),))
+ if self.mcu is not rx_pin_params["chip"]:
+ raise ppins.error(
+ "%s: SERCOM pins must be on same mcu" % (config.get_name(),)
+ )
self.mcu.add_config_cmd(
- "set_sercom_pin bus=%s sercom_pin_type=rx pin=%s" % (
- self.sercom, rx_pin_params['pin']))
+ "set_sercom_pin bus=%s sercom_pin_type=rx pin=%s"
+ % (self.sercom, rx_pin_params["pin"])
+ )
+
def load_config_prefix(config):
return SamdSERCOM(config)