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

Add zmk_kscan_gpio_demux kscan driver & NIBBLE keyboard #292

Merged
merged 4 commits into from
Oct 27, 2020

Conversation

jaygreco
Copy link
Contributor

@jaygreco jaygreco commented Oct 21, 2020

Added NIBBLE keyboard folder and keymap. The biggest change is the addition of a new kscan driver, zmk_kscan_gpio_demux, along with some driver cleanup while porting from the standard matrix driver. I also added some comments to the driver.

The demux chip is active-low and the driver allows for both row2col and col2row configurations. Currently, polling is the only method that has been tested as working, but hooks for interrupt-based scanning were left in as well for the future.

Tested locally on a NIBBLE keyboard with nice!nano MCU.

@innovaker innovaker added core Core functionality/behavior of ZMK enhancement New feature or request shields PRs and issues related to shields labels Oct 21, 2020
@jaygreco jaygreco marked this pull request as draft October 21, 2020 21:12
@jaygreco jaygreco marked this pull request as ready for review October 22, 2020 03:46
Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fabulous start! One or two minor notes, and them some specific questions on the IO stuff.

Thanks!

app/boards/shields/nibble/nibble.overlay Outdated Show resolved Hide resolved
app/drivers/zephyr/Kconfig Outdated Show resolved Hide resolved
.github/workflows/build.yml Show resolved Hide resolved
@jaygreco
Copy link
Contributor Author

Fantastic feedback, thanks! I'm going to work on a rewrite over the next few days focusing on removing the unneeded features discussed above and adding the configurable polling rate. I'll push and update the PR when it's ready to go.

@jaygreco
Copy link
Contributor Author

Alright! Made the changes discussed above. In summary:

  • removed kscan interrupt mode
  • removed diode direction
  • added configurable polling time
  • removed unused functions, optimized driver.c with general cleanup
  • added the shield to docs/static/setup.sh and docs/static/setup.ps1

Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really close. A few remaining comments.

.vscode/settings.json Outdated Show resolved Hide resolved
app/boards/shields/nibble/Kconfig.defconfig Outdated Show resolved Hide resolved
app/drivers/zephyr/kscan_gpio_demux.c Outdated Show resolved Hide resolved
app/drivers/zephyr/kscan_gpio_demux.c Show resolved Hide resolved
Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@petejohanson
Copy link
Contributor

@jaygreco Some merge conflicts since someone else added a board recently too. Can you quickly rebase w/ fixes for the setup scripts, then we'll merge? Thanks!

@petejohanson
Copy link
Contributor

@jaygreco Looks like this rebase didn't quite work as intended. Happy to help you on Discord if you need it. Thanks!

+ zmk,kscan_gpio_demux is now a compatible kscan option
+ kscan_gpio_demux is based heavily off of the implementation of
kscan_gpio_matrix, modified to address cols using an n-to-1
demultiplexer chip instead of discrete IO
+ Added zmk,kscan_gpio_demux.yaml file
* modified CMakeLists to include new source files
+ Added required files for nullbits NIBBLE
- Revert accidental VS code settings change
- Remove kscan_gpio_irq_callback
- Remove kscan_gpio_irq_callback_handler
- Remove irq_callbacks
+ Add TODO noting timer and sleep state interactions
Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@petejohanson petejohanson merged commit f3153b1 into zmkfirmware:main Oct 27, 2020
MangoIV pushed a commit to MangoIV/zmk that referenced this pull request Dec 18, 2020
Add zmk_kscan_gpio_demux kscan driver & NIBBLE keyboard
@jaygreco jaygreco deleted the nullbitsco_nibble branch December 24, 2020 06:56
tyalie pushed a commit to tyalie/zmk that referenced this pull request Nov 15, 2022
Add zmk_kscan_gpio_demux kscan driver & NIBBLE keyboard
@myst729
Copy link

myst729 commented Jun 3, 2024

Is this possible to support analog multiplexers (e.g. CD74HC4067) that output analog values (work with hall effect sensors and magnet switches)?

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 shields PRs and issues related to shields
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants