Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macropad (RP2040) 'matrix-less' switch support? #39

Open
erdii opened this issue May 27, 2024 · 4 comments
Open

Macropad (RP2040) 'matrix-less' switch support? #39

erdii opened this issue May 27, 2024 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@erdii
Copy link

erdii commented May 27, 2024

Heya 👋

I was wondering: does this firmware support the "matrix-less" inputs on the Adafruit Macropad [1]?
The macropad has 12 keyboard switches, each connected to it's own GPIO pin.

Cheers,
Josh

[1] https://www.adafruit.com/product/5128

@HaoboGu
Copy link
Owner

HaoboGu commented May 27, 2024

Hi!

Direct pin is not supported right now, but adding this feature isn't hard imo. If you really want it, I can add it in next weeks, or you can do a PR and I'm happy to review it :D

@erdii
Copy link
Author

erdii commented May 29, 2024

Ah that's a bummer.

I haven't written any rust actively and my experience only revolves around gargabe-collected languages so far, so I'm not sure if my rust-foo is good enough to contribute without getting overwhelmed by the steep learning curves of rust, cross-compiling rust for embedded and embassy but I'll dabble a few more hours to try and find out. :)

Thanks for creating this project and being a maintainer of it and I'd like to acknowledge that I don't have any entitlement to ask you for adding this feature (in the next weeks or at all).

That said, If you'd like to share any pointers on where to start, I'd happily take them. I'd also happily download a version of rmk that includes the feature.

Cheers! :)

@HaoboGu
Copy link
Owner

HaoboGu commented May 30, 2024

You can follow the first two sections of user guide to setup Rust and RMK environment.

If you're not familiar with Rust nor Rust embedded, the official Rust book and the Rust embedded book are the good start points of your Rust journey.

Happy coding! :D

@HaoboGu HaoboGu added enhancement New feature or request help wanted Extra attention is needed labels Jun 13, 2024
@HaoboGu
Copy link
Owner

HaoboGu commented Jun 13, 2024

I just did some investigation. Current matrix.rs implementation is limited to traditional keyboard matrix, but it can be abstracted easily to a trait which is used in keyboard.rs:

pub(crate) trait KeyboardMatrix {
    fn new() -> Self;
    fn get_key_state(&mut self, row: usize, col: usize) -> KeyState;
    fn update_timer(&mut self, row: usize, col: usize);
    async fn scan(&mut self);
    #[cfg(feature = "async_matrix")]
    async fn wait_for_key(&mut self); 
}

Then the direct pin matrix can be implemented with very little effort. I currently just doesn't have enough time to implement it. But if anyone want to do, I'd happy to give suggestions & guidance about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants