Feature: Optionally decouple layout matrix and pin matrix via transform function #121
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.
The Project I am working on doesn't conform to the assumptions in keyberon about input/output pins being rows/columns. This PR does two things:
Option<fn...>
, which allows the caller to define a matrix transformationwhen the transformation is
None
, the behavior is unchanged: output pins are still assumed to correspond to rows, and similarly for input puns.If one passes in
Some<transpose>
,rowout-pins are now column pins andcolin-pins are now row-pins. One can also define their own transpose function of the signaturefn(u8, u8) -> (u8, u8)
, and wire up their key-matrix arbitrarily, and then being able to write out their layout ergonomically.This means that one can wire up their matrix to maximise pin-use, then independently choose how to define their layouts, and if the kb-matrix and layout are mismatched, it should be a simple matter of writing a transform to re-align the two.
For my project, specifically, this PR means that Instead of writing this (note the vertical qwerty):
I can write it out like so, so long as I call
Debouncer::events
withSome(transpose)
:Due to the addition of an argument in the public API, I've also bumped the minor version. To migrate to the minor version, users only have to add
None
to theirevents
calls.alternatively, we could add
events_transposed
, and events just calls that withNone
, and leaveevents
unchanged. That would preclude a version bump.