aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/pca9632.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-04-05 20:48:08 -0400
committerKevin O'Connor <kevin@koconnor.net>2022-04-07 11:43:52 -0400
commitf0700c09858b36fa1bf4c82992e5a0a245d4bc29 (patch)
tree37b8c8bca708509ce66b3848b07001c92b005b65 /klippy/extras/pca9632.py
parent61792e3e31bf919fb5afe988abdfab2f06e97e6d (diff)
downloadkutter-f0700c09858b36fa1bf4c82992e5a0a245d4bc29.tar.gz
kutter-f0700c09858b36fa1bf4c82992e5a0a245d4bc29.tar.xz
kutter-f0700c09858b36fa1bf4c82992e5a0a245d4bc29.zip
pca9632: Support using hardware I2C
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/pca9632.py')
-rw-r--r--klippy/extras/pca9632.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/klippy/extras/pca9632.py b/klippy/extras/pca9632.py
index a5659cfe..2016b006 100644
--- a/klippy/extras/pca9632.py
+++ b/klippy/extras/pca9632.py
@@ -3,7 +3,7 @@
# Copyright (C) 2022 Ricardo Alcantara <ricardo@vulcanolabs.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-from . import mcp4018
+from . import bus, mcp4018
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
@@ -25,7 +25,10 @@ PCA9632_WHT = 0x06
class PCA9632:
def __init__(self, config):
self.printer = printer = config.get_printer()
- self.i2c = mcp4018.SoftwareI2C(config, 98)
+ if config.get("scl_pin", None) is not None:
+ self.i2c = mcp4018.SoftwareI2C(config, 98)
+ else:
+ self.i2c = bus.MCU_I2C_from_config(config, default_addr=98)
self.prev_regs = {}
pled = printer.load_object(config, "led")
self.led_helper = pled.setup_helper(config, self.update_leds, 1, True)