Feature: Optionally decouple layout matrix and pin matrix via transform function#121
Draft
Ben-PH wants to merge 4 commits intoTeXitoi:masterfrom
Draft
Feature: Optionally decouple layout matrix and pin matrix via transform function#121Ben-PH wants to merge 4 commits intoTeXitoi:masterfrom
Ben-PH wants to merge 4 commits intoTeXitoi:masterfrom
Conversation
Owner
|
First, sorry to the very late review. I don’t understand why you don’t just do a map to transform the event between the debounce and the layout. Something like https://github.com/TeXitoi/keyseebee/blob/master/firmware/src/main.rs#L231 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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::eventswithSome(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
Noneto theireventscalls.alternatively, we could add
events_transposed, and events just calls that withNone, and leaveeventsunchanged. That would preclude a version bump.