aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/Config_Reference.md17
-rw-r--r--klippy/extras/pca9632.py7
2 files changed, 18 insertions, 6 deletions
diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md
index 780d5707..3763aaf8 100644
--- a/docs/Config_Reference.md
+++ b/docs/Config_Reference.md
@@ -2616,10 +2616,19 @@ PCA9632 LED support. The PCA9632 is used on the FlashForge Dreamer.
```
[pca9632 my_pca9632]
-scl_pin:
-# The SCL "clock" pin. This parameter must be provided.
-sda_pin:
-# The SDA "data" pin. This parameter must be provided.
+#i2c_address: 98
+# The i2c address that the chip is using on the i2c bus. This may be
+# 96, 97, 98, or 99. The default is 98.
+#i2c_mcu:
+#i2c_bus:
+#i2c_speed:
+# See the "common I2C settings" section for a description of the
+# above parameters.
+#scl_pin:
+#sda_pin:
+# Alternatively, if the pca9632 is not connected to a hardware I2C
+# bus, then one may specify the "clock" (scl_pin) and "data"
+# (sda_pin) pins. The default is to use hardware I2C.
#initial_RED: 0.0
#initial_GREEN: 0.0
#initial_BLUE: 0.0
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)