-
Notifications
You must be signed in to change notification settings - Fork 72
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
kbscan: Switch from GPIO mode to KBS (Normal) mode #362
Conversation
ba1aba5
to
48400e0
Compare
d691750
to
2709450
Compare
c05d9d2
to
dedd488
Compare
7d7ffca
to
7847c67
Compare
Increases XRAM use by 18 bytes. --- build/system76/oryp8/0/ec.mem 2023-07-17 13:57:23.967001078 -0600
+++ build/system76/oryp8/1/ec.mem 2023-07-17 13:57:34.875145986 -0600
@@ -25,5 +25,5 @@
Name Start End Size Max
---------------- -------- -------- -------- --------
PAGED EXT. RAM 0 256
- EXTERNAL RAM 0x0001 0x051e 1310 2048
- ROM/EPROM/FLASH 0x0000 0x8f8e 36218 65536
+ EXTERNAL RAM 0x0001 0x0530 1328 2048
+ ROM/EPROM/FLASH 0x0000 0x8ed4 36032 65536 |
Use the default mode for reading the keyboard scan matrix when being used as a keyboard. There should be no perceived change in behavior, but should make the code easier to understand. Note: `KSO[17:16]` are configured by `GPCRC` on boards that use them. They are now set to alternate function to use in KBS mode rather than GPIO mode, with the pull-up enabled to prevent them from floating when configured as open-drain. As part of this change, we now only read the hardware matrix state once upfront, instead of on every iteration through the loop applying the logic. Tested by verifying that typing still works on darp9. Signed-off-by: Tim Crawford <tcrawford@system76.com>
Remove checking against the real keys declared in the keymap. It appears to have no effect on behavior. Signed-off-by: Tim Crawford <tcrawford@system76.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on bonw14's NKRO keyboard, and it can keep up with as fast as I can type. I think this is working great.
May be better to use push-pull (ITE default) rather than open-drain? I can't tell what the ENE chip does. I tried and it was buggy. Open-drain is working so I'll just leave it for now. |
Use the default mode for reading the keyboard scan matrix when being used as a keyboard. There should be no perceived change in behavior, but should make the code easier to understand.
Note:
KSO[17:16]
are configured byGPRCRC
on boards that use them. They are now set to alternate function to use in KBS mode rather than GPIO mode, with the pull-up enabled to prevent them from floating when configured as open-drain.As part of this change, we now only read the hardware matrix state once upfront, instead of on every iteration through the loop applying the logic.
Tested by cherry-picking to darp9 and verifying that typing still worked.
Need to test:
TODO:
kbscan_row_has_ghost()
)kbscan_get_real_keys()
is even needed