From f0700c09858b36fa1bf4c82992e5a0a245d4bc29 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 5 Apr 2022 20:48:08 -0400 Subject: pca9632: Support using hardware I2C Signed-off-by: Kevin O'Connor --- klippy/extras/pca9632.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'klippy/extras/pca9632.py') 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 # # 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) -- cgit v1.2.3-70-g09d2