Add support for ZMK Studio, rotary encoders, and LEDs #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add the following features to the ZMK module for the Keyboardio Preonic:
Update the default keymap to match the default keymap provided in the box with the Preonic more closely.
This doesn't quite bring the ZMK implementation to feature parity with Kaleidoscope, but it does reduce the feature gap quite a bit.
Note
Per the clean room documentation on ZMK, I have NOT reviewed any QMK or Kaleidoscope source code to inform these changes. The pinout is clearly articulated here under the MIT license, and the rest of this information came from other users, ZMK docs, the Zephyr docs, and trial and error.
Additionally, to the extent of my ability according to the licenses of this repository, my contributions here are explicitly provided under the terms of the MIT license.
Details
ZMK Studio
Add support for ZMK Studio for the Preonic module. This allows users to store and adjust keymaps without recompiling firmware.
Support has been added for both the MIT and the Ortho layouts, but since the keyboard ships with the MIT layout by default, I selected that as the default physical layout. (My keyboard uses the ortho / full-grid layout, so I haven't gotten a true test of the MIT layout; however, to the best of my ability, it seems to work as expected.)
Screenshots
Available layouts:

Layer template:

Rotary Encoders
Add support for rotary encoders on the keyboard.
Once again following the principle of least surprise, I wired up all of the available sockets, but by default, I chose to enable only the single encoder that ships with the keyboard.
Butterfly LEDs
Note
Huge thanks to @ujl123 for getting this working!
Add support for the beautiful butterfly LEDs. ZMK uses the "RGB Underglow" feature for any addressable RGB LEDs, so that's the feature in use here. ZMK users can customize this using the RGB Underglow behavior in their keymaps.
I personally think the "swirl" effect looks absolutely great on this butterfly!
Default Keymap
Rewrite the default keymap to align fairly closely with the laminated card shipped with the Preonic. A couple layers aren't exact (mouse keys especially) but it's fairly close. Obviously, users can adjust this however they like, but this may help ease the barrier of entry for people that just want to get something working.
Testing
How Have I Tested This?
I've updated my own ZMK config to point to my fork and this branch of this ZMK module, so I've been dogfooding the changes as I've made them. I'm actually typing this PR on the Preonic!
How Can Reviewers Test This?
Assuming reviewers already have the version of this module in main, update
build.ymlto point to my fork and branch:Then build the keymap as normal.
What Haven't I Tested?
The main thing I have not tested is that I have not tried ZMK Studio with a board using the default 2u spacebar. Having converted my board once, I just don't feel the urge to undo the change, test that feature, and then redo the change all over again.
I have set my keyboard to that layout and confirmed that the left "space" key fires correctly, and the other keys are still mapped as they should be. Based on my reading, I think that's the expected behavior, but I haven't actually tested it.
Final Thoughts
Once again, special thanks to @ujl123 for writing the LED code. They'd also written working encoder code before I got around to submitting my version.
Additionally, thanks to @petejohanson for their work getting so much of ZMK working on the Keyboardio Preonic!