Releases: rgoulter/smart-keymap
v0.12.0: Automation (Macro) Keys, more Layer Modifiers,
v0.12.0 has some new smart keys:
- Automation (Macro) keys,
- More Layer Modifiers: Toggle layer, Sticky layer.
The release also saw a bunch of implementation code cleanup and improvements,
such as improved DX for the Rust integration tests.
Automation Keys
Automation keys serve the same role as "macro" keys in other firmware.
Basic macros can be constructed with the simple K.string_macro function:
let K = import "keys.ncl" in
let MY_MACRO = K.string_macro "hello world" in
[
tap MY_MACRO,
]
"""
or more sophisticated macros can be constructed by forming smart_keymap::key::automation::Key values
with { automation_instructions = { on_press, while_pressed, on_release } } values.
let K = import "keys.ncl" in
let { string_to_instructions, .. } = import "smart_keys/automation/lib.ncl" in
let MY_MACRO = {
automation_instructions = {
on_press = "ab" |> string_to_instructions,
while_pressed = [
{ Tap = { key_code = { Keyboard = 0x06 } } },
{ Wait = 1000 },
],
on_release = "de" |> string_to_instructions,
},
} in
{
keys = [
MY_MACRO,
],
}
Layer Modifiers
This release added the toggle layer
modifier
and the sticky layer
modifier.
Firmware Improvements: Nickel Board Codegen Readability
This release made changes to the board codegen Nickel files throughout the project,
improving their readability.
keymap_index_for_key = fun { column_index, row_index } =>
let [
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09,
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19,
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29,
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39,
k40, k41,
] = std.array.generate (fun i => 'Key i) 42 in
let NO = 'NoKey in
let matrix = [
[k00, k01, k02, k03, k04, NO, NO, k05, k06, k07, k08, k09],
[k10, k11, k12, k13, k14, NO, NO, k15, k16, k17, k18, k19],
[k20, k21, k22, k23, k24, NO, NO, k25, k26, k27, k28, k29],
[k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k40, k41],
]
in
matrix
|> std.array.at row_index
|> std.array.at column_index,
Firmware Improvements: CH58x BLE HID keyboard
The code for the CH58x HID keyboard was updated to call
keymap_set_ms_per_tick. This smooths over configuration issues, so that the
timeout values are now in milliseconds.
Full Changelog: v0.11.0...v0.12.0
v0.11.0: Mouse/Media Keys, Reducing Code Maintenance Effort
v0.11.0 covers changes which re-organize the key::composite and Nickel support code, as well as adding Mouse and Consumer key outputs and updating the firmware examples to output these.
Mouse and Consumer (Media) Keys
Previously, arbitrary keymap behaviour was already possible with either key::custom or key::callback.
However, for common cases like Mouse Keys or Media Keys (Consumer Keys), it makes sense to have dedicated Rust key implementations, providing dedicated output.
Nickel key fields for the mouse & consumer keys have also been added.
The firmware examples provided in this repository have also been updated to work with Mouse, Media keys.
Code Reorganising
The code in key::composite has been tidied, so as to reduce maintenance effort for adding new keys.
Similarly, the Nickel support code has been tidied, with each key::*-related Nickel code being moved into its own file.
Changes to using Keymap in Rust Firmware:
For Rust firmware (like the examples given in the repo), Keymap::new has an improved API. Instead of:
let backend = {
use smart_keymap::init;
use smart_keymap::keymap::Keymap;
let keymap = Keymap::new(init::KEY_REFS, init::CONTEXT, init::SYSTEM);
KeyboardBackend::new(keymap)
};
It's sufficient to:
let backend = KeyboardBackend::new()
Full Changelog: v0.10.0...v0.11.0
v0.10.0 Firmware Size Optimization
v0.10.0 covers a significant rewrite of the key storage implementation, resulting in a significant reduction in firmware size, and significant reduction in implementation boilerplate for new smart keys.
Breaking Change: using Keymap in Rust Firmware:
For Rust firmware (like the examples given in the repo), Keymap::new has changed:
@@ -209,7 +209,7 @@ mod app {
let backend = {
use smart_keymap::init;
use smart_keymap::keymap::Keymap;
- let keymap = Keymap::new(init::KEY_DEFINITIONS, init::CONTEXT);
+ let keymap = Keymap::new(init::KEY_REFS, init::CONTEXT, init::SYSTEM);
KeyboardBackend::new(keymap)
};nickel Requirement Updated
nickel has been updated to 1.12.2. Particularly, keymap-codegen.ncl now makes use of field punning, which requires a newer version of nickel.
Full Changelog: v0.9.0...v0.10.0
v0.9.0: Overlapping Chords
v0.9.0 includes several significant changes:
Some highlights:
- Custom key codes. #340
- StickyKeyRelease::OnNextKeyPress sticky config option. #346
- Fix CH32X firmware for xpack riscv gcc distribution. #348
- Added seniply example keymap. #353
- Added miryoku example keymap. #354
- Friendier chording indices in keymap.ncl. #359
- Added "Set Active Layers" layer modifier key. #360
- Support chords longer than 2-keys. #361
- Overlapping chord support #368
Full Changelog: v0.8.0...v0.9.0
v0.8.0: Tap Dance, Custom Callback keys, TapHold Required Idle Time
v0.8.0 includes several significant changes:
- An example keyboard firmware for split keyboards with half-duplex USART was added with STM32F4-Embassy. This should help those with split keyboards using RP2040 MCUs and 1-wire split communication.
- The Tap Hold config now supports "required idle time", which should reduce false 'hold' resolutions with tap-hold keys when typing quickly.
- Callback keys now have a
Custom(i, j)variant, in addition to reset/boot. This should allow implementing arbitrary smart keyboard effects (e.g. toggle RGB lighting, etc.). - Fixed a bug in CH32X firmware related to disabling SWD.
- Added CH32X-36 keyboard implementation in the CH32X firmware.
- Implemented another smart key: the tap dance key.
Full Changelog: v0.7.0...v0.8.0
v0.7.0
Changes since the v0.6.0 release have been focused on brushing up the code, towards supporting efforts towards embassy keyboard firmware, and firmware for the CH32X-36.
What's Changed
Full Changelog: v0.6.0...v0.7.0
Keymap Codegen
Some quality of life improvements: added some more Nickel contracts, layout remapping now remaps the chord indices.
- ncl: codegen improvements to config defaults in #292
- ncl: validators: add is_elem_of in #294
- ncl: keymap-ncl-to-json: add contract for chords in #293
- ncl: add contract for config for keymap.ncl in #296
- ncl: keymap-codegen: describe keymap_json.config with Contracts in #295
- ncl: layouts: remap chord indices in #305
CH32X, CH58X Firmware
Rearranged the codegen Nickel code as Nickel modules, and added indirection so that the codegen can output
more files (CMakeLists, include headers, multiple sources), more Nickel contract use.
- CH32X firmware: Refactor Codegen Generation (Codegen modules). in #306
- CH32X firmware: fix
make testin #308 - CH32X firmware: move codegen files in #307
- CH32X firmware: rearrange codegen modules in #309
- CH32X firmware: support debug with tx4_1 in #314
- CH32X firmware: codegen: keyboard_matrix: use KeymapInputEvent in #315
- CH32X firmware: Makefile: stamp board, tidy output in #316
- CH32X firmware: add keyboard_matrix to codegen contracts in #333
- CH58X firmware: nickel codegen improvements in #334
Keyberon Smart Keyboard (Renamed from usbd-smart-keyboard)
Renamed usbd-smart-keyboard to keyberon-smart-keyboard, removing the usage/dependency on usb-device.
- usbd-smart-keyboard: allow access to keymap output in #303
- usbd-smart-keyboard: rm unused mod in #304
- rp2040-rtic: replace use of backend.write_reports in #324
- stm32f4-rtic: replace use of backend.write_reports in #325
- rp2040-rtic: replace use of KeymapBackend::pressed_key_codes in #326
- stm32f4-rtic: replace use of KeymapBackend::pressed_key_codes in #327
- usbd-smart-keyboard: remove usb-device dependencies in #328
- usbd-smart-keyboard: rename LayoutMessage in #329
- rename usbd-smart-keyboard crate to keyberon-smart-keyboard in #330
- rust: build.rs: ignore SMART_KEYMAP_CUSTOM_KEYMAP if empty in #331
- keyberon smart keyboard: use actual types in doctests in #335
Misc
Finally clarified the project license, using a permissive MIT or ASL2.
Added .uf2 targets to the makefile, supporting e.g. make minif4_36-rev2021_4-lhs.uf2.
v0.6.0
Various changes since the v0.5.0 release.
New smart key added: sticky modifier keys.
Most of the work involved refactoring the code.
e.g. moving key::Key impls out of key::composite and into their
respective key module, or renaming "serialized json" to "json value".
What's Changed
Full Changelog: v0.5.0...v0.6.0
Smart Keymap
- justfile: use 'keymap' var for SMART_KEYMAP_CUSTOM_KEYMAP in #262
- virtual keys use key::KeyOutput in #263
- libsmart_keymap: remove copy hid report function in #270
- rust: add bin/sizeof in #278
- rust: remove deserialize_ron unit tests in #280
- add keymap_index to keymap::KeymapEvent::ResolvedKeyOutput in #281
- keymap: emit ResolvedKeyOutput for resolved pending state in #282
- bugfix: key::caps_word::handle_event only if active in #283
- resolve PendingKeyState from PendingKeyState in #286
- sticky modifier keys in #261
- codegen: add sticky config in #291
Refactoring / Improvements
- ncl: keymap-codegen: splat with the default config in #264
- rust: move key/mod.rs to key.rs in #265
- rust: rename key::pressedkeyevents to key::keyevents in #266
- ncl: rename "serialized json" to "json value" in #272
- ncl: Improve consistency in keymap-codegen.ncl in #273
- keymap: use ChordResolution in chorded::Event::ChordResolved in #274
- restore key events map in #277
- rust: add abstraction to KeyboardModifiers in #279
- make Context fields private in #284
- decouple key::Key impls from key::composite in #276
- genericize keymap::Keymap associated key types in #285
- pass Context by Reference in #287
- use TryInto<&mut> for PendingKeyState variants in #288
- move keymap.rs code into modules in #289
- codegen: config defaults in #290
CI
v0.5.0
Various changes since the v0.4.0 release.
Code was written to support the CH32X-75 keyboard, as well as split keyboard functionality.
Some smart keys were implemented (Set default layer, BOOT/RESET, Caps Word).
What's Changed
Full Changelog: v0.4.0...v0.5.0
Smart Keymap
The core smart keymap:
- New smart key: "Set Default Layer" layer modifier key.
- New smart key: Caps Word.
- New smart key: BOOT/RESET callback keys.
- Layers now intuitively & consistently use
0to refer to base layer,1to refer to first layer above that. - Various cleanup, fixes, and refactoring.
Pull Requests:
- Fix warnings in docs by @rgoulter in #223
- keymaps: add 75-key keymap by @rgoulter in #227
- keymap.ncl use more intuitive layer index by @rgoulter in #232
- Layer Modifier Key: Set Default Layer by @rgoulter in #233
- Split Keyboard support by @rgoulter in #229
- Feature: layer "default" layer modifier key by @rgoulter in #240
- Fix keymap.ncl codegen bug by @rgoulter in #241
- add devenv.nix to firmware/* directories by @rgoulter in #243
- Fix keymap tick-less input handling by @rgoulter in #244
- Rust, transform values, remove unused methods by @rgoulter in #249
- Add Keymap Event for Key Output by @rgoulter in #255
- Context emit events by @rgoulter in #258
- Add Key: Caps Word by @rgoulter in #259
- Feature Spec: Caps Word Key by @rgoulter in #260
libsmart_keymap
libsmart_keymap:
- added functions for supporting split keyboards.
- added functions to register input events with structs.
- added indirection the HID keyboard reporting, using a struct wrapped around the
uint8_t*.
Pull Requests:
- Split Keyboard support by @rgoulter in #229
- libsmart_keymap: Report using KeymapHidReport struct by @rgoulter in #247
Firmware
CH32X and CH58X firmware
The firmware/ch32x code saw improvements to its keyboard codegen, and added support for the CH32X-75 keyboard.
The firmware/ch58x code saw the same refactoring.
Pull Requests:
- CH32X firmware codegen improvements by @rgoulter in #222
- CH32X Firmware: Refactor board / matrix scanning by @rgoulter in #224
- CH32X firmware: matrix scan col to row by @rgoulter in #225
- firmware: ch32x: add ch32x-75 board. by @rgoulter in #226
- CH58x firmware: NCL codegen improvements by @rgoulter in #246
RP2040-RTIC firmware
Pull Requests:
- rust: rp2040-rtic-keyboard: add usb_serial to pico42 example by @rgoulter in #230
- rp2040-rtic: codegen board.ncl field by @rgoulter in #245
- RP2040 RTIC: bootloader keymap callback by @rgoulter in #250
STM32F4-RTIC
v0.5.0 introduces stm32f4-rtic-smart-keyboard. This is keyboard firmware for STM32F4, using RTIC,
and usbd-smart-keyboard (which uses smart-keymap).
Binaries are provided for the MiniF4-36 rev2021.4 LHS & RHS, as well as a
"onekey" for the WeAct MiniF4 "Blackpill" devboard.
Pull Requests:
- Add rust target thumbv7em none eabihf by @rgoulter in #234
- Add STM32F4-rtic-smart-keyboard by @rgoulter in #236
- STM32f4 rtic: minif4 36 rev2024 1 by @rgoulter in #237
- STM32F4 rtic: use smart_keymap::split::Message by @rgoulter in #238
usbd-smart-keyboard
Pull Requests:
v0.4.0: rewrite pressed key state
What's Changed
v0.4.0 tags a rewrite of how keys manage pressed key state.
Full Changelog: v0.3.0...v0.4.0
v0.3.0: introduce Chords
What's Changed
v0.3.0 adds chords to the smart keymap library.
Current implementation of chords:
- Layer-independent.
- 2-key chords only.
-
Add key::chorded to Rust smart keymap library in #194
-
Nickel refactoring:
-
Minor fixes & refactoring to Rust code:
Full Changelog: v0.2.0...v0.3.0