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

feat(kscan): Add config to control int trigger #2699

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

petejohanson
Copy link
Contributor

@petejohanson petejohanson commented Dec 7, 2024

  • Allow using either level or edge interrupts for matrix/direct kscan drivers.

This came up while working on the XIAO MG24 and found that the gecko GPIO driver (and the platform itself) does not support "level" interrupts, only edge interrupts, so this adds a set of Kconfig choices/configs to select which interrupt type to use for matrix/direct kscan drivers.

PR check-list

  • Branch has a clean commit history
  • Additional tests are included, if changing behaviors/core code that is testable.
  • Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
  • Pre-commit used to check formatting of files, commit messages, etc.

@petejohanson petejohanson added enhancement New feature or request core Core functionality/behavior of ZMK labels Dec 7, 2024
@petejohanson petejohanson self-assigned this Dec 7, 2024
@petejohanson petejohanson requested review from a team as code owners December 7, 2024 03:51
* Allow using either level or edge interrupts for matrix/direct
  kscan drivers.
@petejohanson petejohanson force-pushed the drivers/kscan-add-int-type-config branch from 48f0bb7 to 4865e12 Compare December 7, 2024 03:52
@Nick-Munnich
Copy link
Contributor

Am I wrong, or is there no default being applied currently? I think we're probably happy for this flag to be set/overwritten designer-side so no need for a Kconfig.defaults, but I think we should have the default choice set in the Kconfig already.

I'm not entirely sure we need different Kconfig flags for the different Kscans. How would this interact if the XIAO MG24 or an alternative MCU that this applies to is using a GPIO expander? If there is a case for different flags for different Kscans, then the Charlieplex driver also needs one.

@petejohanson
Copy link
Contributor Author

Am I wrong, or is there no default being applied currently? I think we're probably happy for this flag to be set/overwritten designer-side so no need for a Kconfig.defaults, but I think we should have the default choice set in the Kconfig already.

For choices, if no default is explicitly set, then the first choice is defaulted. This avoids needing to worry about ordering, and allows a default to be set elsewhere if needed

I'm not entirely sure we need different Kconfig flags for the different Kscans. How would this interact if the XIAO MG24 or an alternative MCU that this applies to is using a GPIO expander? If there is a case for different flags for different Kscans, then the Charlieplex driver also needs one.

I was on the fence on this. I am open to changing it, but I'm always wary of starting with something more limited/shared without seriously considering implications/edge cases.

@Nick-Munnich
Copy link
Contributor

I was on the fence on this. I am open to changing it, but I'm always wary of starting with something more limited/shared without seriously considering implications/edge cases.

I think if you want to be certain that all edge cases are covered, then it should be a kscan property.

The case for having them be different flags is if you have a composite kscan and you want different interrupts for different child scans. I can't think of a scenario when you'd actually want that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionality/behavior of ZMK enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants