mirror of https://github.com/Desuuuu/klipper.git
pca9632: Support using hardware I2C
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
61792e3e31
commit
f0700c0985
|
@ -2616,10 +2616,19 @@ PCA9632 LED support. The PCA9632 is used on the FlashForge Dreamer.
|
||||||
|
|
||||||
```
|
```
|
||||||
[pca9632 my_pca9632]
|
[pca9632 my_pca9632]
|
||||||
scl_pin:
|
#i2c_address: 98
|
||||||
# The SCL "clock" pin. This parameter must be provided.
|
# The i2c address that the chip is using on the i2c bus. This may be
|
||||||
sda_pin:
|
# 96, 97, 98, or 99. The default is 98.
|
||||||
# The SDA "data" pin. This parameter must be provided.
|
#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_RED: 0.0
|
||||||
#initial_GREEN: 0.0
|
#initial_GREEN: 0.0
|
||||||
#initial_BLUE: 0.0
|
#initial_BLUE: 0.0
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Copyright (C) 2022 Ricardo Alcantara <ricardo@vulcanolabs.com>
|
# Copyright (C) 2022 Ricardo Alcantara <ricardo@vulcanolabs.com>
|
||||||
#
|
#
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
from . import mcp4018
|
from . import bus, mcp4018
|
||||||
|
|
||||||
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
|
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
|
||||||
|
|
||||||
|
@ -25,7 +25,10 @@ PCA9632_WHT = 0x06
|
||||||
class PCA9632:
|
class PCA9632:
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.printer = printer = config.get_printer()
|
self.printer = printer = config.get_printer()
|
||||||
|
if config.get("scl_pin", None) is not None:
|
||||||
self.i2c = mcp4018.SoftwareI2C(config, 98)
|
self.i2c = mcp4018.SoftwareI2C(config, 98)
|
||||||
|
else:
|
||||||
|
self.i2c = bus.MCU_I2C_from_config(config, default_addr=98)
|
||||||
self.prev_regs = {}
|
self.prev_regs = {}
|
||||||
pled = printer.load_object(config, "led")
|
pled = printer.load_object(config, "led")
|
||||||
self.led_helper = pled.setup_helper(config, self.update_leds, 1, True)
|
self.led_helper = pled.setup_helper(config, self.update_leds, 1, True)
|
||||||
|
|
Loading…
Reference in New Issue