zmk icon indicating copy to clipboard operation
zmk copied to clipboard

WIP. feat(kscan): Add Hall keyscan driver

Open Samsuper12 opened this issue 6 months ago • 7 comments

Hall sensors introduce a new dimension to keyboards. It's easier to list the things you can’t do without them than the things you can, because they have almost unlimited applications: accessibility, gaming, and high-tech devices, to name a few. So let ZMK support them.

This PR is still under development. There's a lot of work to be done. Everyone can contribute and help speed up progress.

TODO:

  • [x] Basic input (ADC, base settings, EMA, limits & normalization)
  • [x] Support different polarity switches (Outemu, Haimu, etc.).
  • [ ] Behaviors
    • [ ] Dynamic (10%: &kp A; 20%: &kp B; etc). Almost done
    • [ ] Rapid trigger
    • [ ] Variable output
  • [ ] Multi ADC input (e.g. &adc from the MCU and several &mcp3204)
  • [ ] Docs
  • [ ] ZMK Studio
  • [ ] Display widget

Setup

Donor board: SayoDevice O3C board: nice nano v2 shield: custom Sensor: AH49E (datasheet)

Rate my setup btw

1

Samsuper12 avatar Jun 23 '25 12:06 Samsuper12

The next step requires modifications outside of the driver. ~~I'm not sure, but I think the best option is to create a new event to signal sensor changes immediately after zmk_keycode_state_changed.~~

The input_report() function was exactly what I needed.

Samsuper12 avatar Jun 24 '25 13:06 Samsuper12

related: https://github.com/zmkfirmware/zmk/issues/2096

Samsuper12 avatar Jul 04 '25 09:07 Samsuper12

I think I would recommend to make this a module similar to https://github.com/petejohanson/ec-support-zmk-module/tree/main for the time being. I don't foresee the capacity to properly review and consider this for addition anytime soon, considering the backlog of PRs, and growing the number of hall effect keyboards running ZMK in the meantime would be good justification for the future.

nmunnich avatar Jul 04 '25 09:07 nmunnich

I think I would recommend to make this a module similar to https://github.com/petejohanson/ec-support-zmk-module/tree/main for the time being. I don't foresee the capacity to properly review and consider this for addition anytime soon, considering the backlog of PRs, and growing the number of hall effect keyboards running ZMK in the meantime would be good justification for the future.

Yeah, sure. Would you mind if I continued making progress here for now and then moved all the changes to a separate repository?

Samsuper12 avatar Jul 04 '25 09:07 Samsuper12

Proceed as you wish, I merely wanted to give a heads up about timeline and provide a reasonable alternative as a suggestion.

nmunnich avatar Jul 04 '25 09:07 nmunnich

If it can be of any help, I've created a module that supports HE switches (for now only direct-wired) and most of the features commonly found on analog keyboards. It's certainly not ready for a final product (the data flow and configuration is quite convoluted) but it could help to implement something directly in zmk. zmk-feature-hall-effect

cr3eperall avatar Jul 05 '25 15:07 cr3eperall

I'm not presently in a position to contribute directly but wanted to say how happy I am to see this work being done!

unprolix avatar Jul 06 '25 00:07 unprolix