Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Releases: rgoulter/smart-keymap

v0.12.0: Automation (Macro) Keys, more Layer Modifiers,

03 Oct 09:35

Choose a tag to compare

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

27 Sep 12:51

Choose a tag to compare

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

17 Sep 11:44

Choose a tag to compare

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

21 Aug 11:30

Choose a tag to compare

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

28 Apr 14:30

Choose a tag to compare

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

20 Apr 02:44

Choose a tag to compare

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 test in #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.

  • Clarify Licensing in #301
  • Devenv: add lsp server: nickel in #297
  • Devenv: add uf2conv in #322
  • Makefile: add rust stm32f4 target in #321
  • Makefile: targets for STM32F4-RTIC UF2 in #323
  • Smart keymap nickel helper: refactor common functionality in #332

v0.6.0

12 Apr 01:36

Choose a tag to compare

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

  • ci: add nickel-format CI job in #267
  • ci: add step which builds pico42 example in #268
  • ci: add workflow which builds STM32F4 RTIC, and bins in #269
  • ci: rust: fail doc step if warnings generated in #271

v0.5.0

04 Apr 02:08

Choose a tag to compare

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 0 to refer to base layer, 1 to refer to first layer above that.
  • Various cleanup, fixes, and refactoring.

Pull Requests:

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:

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:

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:

usbd-smart-keyboard

Pull Requests:

  • usbd-smart-keyboard: feature flag usbd-serial by @rgoulter in #235
  • usbd-smart-keyboard: remove old ser/de code by @rgoulter in #257

v0.4.0: rewrite pressed key state

21 Mar 02:41

Choose a tag to compare

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

12 Mar 01:17

Choose a tag to compare

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:

    • ncl: keymap-codegen: rearrange tap_hold to before layered in #206
    • ncl: keymap-codegen: factor out keyboard_modifiers in #207
    • ncl: rewrite codegen type unification in #208
    • features: add "chords" ncl feature to generated docs in #209
  • Minor fixes & refactoring to Rust code:

    • rust: simplify impl LayeredNestable for TapHold<> in #204
    • tests: cucumber: use filter_run_and_exit, so cargo test fails in #205

Full Changelog: v0.2.0...v0.3.0