Allow using SX1509 and MCP23017 IO expander for buttons #382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow using I2C IO expanders to be used as inputs for buttons / filament sensors / etc.
The implementation relies on an interrupt pin provided by the I2C expander board to detect change in the input pins. Once change is detected, Klipper would read the state of the buttons via I2C and invoke callbacks as needed.
To integrate with the existing buttons support, simulates MCU and handles the commands used to setup buttons (
config_buttons
,buttons_add
,buttons_ack
,buttons_query
andbuttons_state
). The motivation of this approach is that it does not require changes to Klipper code.The I2C board thus requires three GPIO pins to be connected to any Klipper board: two pins for I2C (SDA and SCL) and one GPIO pin for the interrupt.
Add support for inputs pins to SX1509 implementation. The new implementation uses configuration name
[mmu_sx1509 ...]
.Also, implement support for MCP23017 I2C expander board. This implementation uses configuration name [
mmu_mcp23017 ...
].Example configuration for the SX1509:
Example configuration for the MCP23017: