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

Investigate matrix_keypad linux driver #127

Open
amclain opened this issue Oct 9, 2020 · 2 comments
Open

Investigate matrix_keypad linux driver #127

amclain opened this issue Oct 9, 2020 · 2 comments

Comments

@amclain
Copy link
Member

amclain commented Oct 9, 2020

Linux has a built-in matrix_keypad driver that we may be able to use for scanning and programming the keyboard matrix.

Example device tree:

        matrix_keypad: matrix_keypad0 {
                compatible = "gpio-matrix-keypad";
                debounce-delay-ms = <5>;
                col-scan-delay-us = <2>;
                row-gpios = <&gpio1 25 GPIO_ACTIVE_HIGH         /* Bank1, pin25 */
                             &gpio1 26 GPIO_ACTIVE_HIGH         /* Bank1, pin26 */
                             &gpio1 27 GPIO_ACTIVE_HIGH>;       /* Bank1, pin27 */
                col-gpios = <&gpio1 21 GPIO_ACTIVE_HIGH         /* Bank1, pin21 */
                             &gpio1 22 GPIO_ACTIVE_HIGH>;       /* Bank1, pin22 */
                linux,keymap = <0x0000008b      /* MENU */
                                0x0100009e      /* BACK */
                                0x02000069      /* LEFT */
                                0x0001006a      /* RIGHT */
                                0x0101001c      /* ENTER */
                                0x0201006c>;    /* DOWN */
        };  

See dt-bindings/input/linux-event-codes.h.

@doughsay
Copy link
Member

This is interesting, but I don't like how they turn it into keycodes; I'd rather get back the raw info of which key in the matrix was pressed and not have it impose opinions about which keys correspond to which keycodes. Is it also not possible to distinguish between key-up and key-down events? Also, this is still running in linux, and therefore susceptible to fair scheduling. We still like the PRU idea better because it's real-time, right?

@amclain
Copy link
Member Author

amclain commented Oct 12, 2020

I titled this issue as "investigate" because I don't know the answers to all of those questions yet. This came as a suggestion from Frank, so I wanted to capture it so we can evaluate it at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants