Feature; toggle switch kscan driver #980
Labels
core
Core functionality/behavior of ZMK
enhancement
New feature or request
Hacktoberfest
help wanted
Extra attention is needed
It would be useful to support a single pole, #-throw toggle switch in ZMK in a way that doesn't impact battery life drastically w/ quiescent current from pull up/down on the connected throw line. There's a way to do this by only enabling the pull up/downs on the not selected pin, combined w/ smart interrupts.
For wiring, you'd have the single pole wired to ground, and each of the polls wired to a GPIO pin.
The DT for this would look something like:
On init, the code should apply the pull direction to each pin, then read each pin to detect which is active LOW.
whichever is active low, should have a kscan event raised for it being pressed, then disable the pull on that pin to stop the quiescent drain.
We should then also configure interrupts for the other pins so the interrupt fires when the toggle is changed.
Once we get an interrrupt, scan other pins, find the new active one, and:
This can then be combined w/ the composite kscan driver, or leveraged as a separate kscan, to do things like switch primary output, or BT profile, etc.
The text was updated successfully, but these errors were encountered: