8 releases

0.1.0 Dec 2, 2024
0.1.0-beta.5 Dec 1, 2024
0.0.1 Jun 30, 2024
0.0.0 Oct 26, 2024

#1043 in Hardware support


Used in 3 crates

MIT license

225KB
5.5K SLoC

rktk

Rust Keyboard Toolkit

rktk is a keyboard firmware framework written in Rust.

Currently, rktk supports nRF52840 and RP2040, and although there are bugs and performance issues (especially related to split keyboards), it can be used as a decent keyboard.

This firmware consists of two parts: the core functionality implemented in the rktk crate and the driver that actually interacts with the hardware. This makes it easy to extend.

Crates

Crate crates.io docs.rs
rktk Crates.io Version docs.rs
rktk-drivers-common Crates.io Version docs.rs
rktk-drivers-nrf Crates.io Version docs.rs
rktk-drivers-rp Crates.io Version docs.rs
rktk-keymanager Crates.io Version docs.rs
rktk-cli Crates.io Version
rktk-rrp Crates.io Version docs.rs
rktk-rrp-client-webhid Crates.io Version docs.rs

Features

  • ✅ : Working
  • 🔵 : Almost working
  • 🟡 : Partially working, missing some features
  • 🔴 : Planned.
  • ❌ : Not planned.
  • (blank): Not needed.

Core features

Feature Status
Keyscan
Mouse
Encoder 🔵
Key mapping 🟡 (See below table for detail)
Hook system 🟡
Split keyboard
Non-Split keyboard 🔵
Display 🟡
RGB led 🟡
USB
Bluetooth 🟡
Remapper support 🟡
Double-tap reset

Key mapping features

Key mapping features is implemented in rktk-keymanager and this crate does not depend on rktk or embassy. Keymap is defined as normal two-dimensional array. See keyball61's keymap for example.

Feature name Status
 
Key action
Mod-Tap Unlike QMK, any keycode can be specified as modifier.
Tap-Hold 🟡 Currently, this behaves like HOLD_ON_OTHER_KEY_PRESS.
Tap Dance
Oneshot key
 
KeyCode
Normal key
Modifier key
Media key
Mouse key
Mouse scroll momentary
Layer momentary (MO)
Layer toggle (TG)

Drivers

  • "Common" means that the driver is implemented in rktk-drivers-common. Drivers implemented in rktk-drivers-common use embassy traits, so they can be easily ported to various platforms.
Driver Common RP2040 NRF52840
Key scanner
Matrix 🔴 🔴 🔴
Matrix with shift register 🔵 🔴 🔵
(Japanese) Duplex-Matrix
 
Mouse
PMW3360
PAW3395
 
Host communication
USB
Bluetooth ✅ (SoftDevice)
 
Display
SSD1306
 
Split
Half-duplex single wire ✅ (PIO) ✅ (UART)
Full-duplex dual wire 🔴 (UART) 🔴 (UART)
Bluetooth 🔴
 
RGB led
WS2812 ✅ (PIO) ✅ (PWM)
 
Double-tap reset

Development

See cargo x --help and .vscode/tasks.json to build firmware and start development.

Dependencies

You need to install some tools to generate firmware.

  • arm-none-eabi-objcopy: Required to generate uf2 firmware for nRF52840
  • wasm-pack: Required to build rktk-client

MSRV

rktk actually doesn't depends on nightly feature of rustc, but uses nightly cargo features like per-package-target. So, it requires nightly toolchain.

Creating new keyboard

Currently, there is no guide for building a new keyboard, but you can refer to the following repository:

Please note that currently driver for regular matrix is not implemented.

Credits & Acknowledgements

  • rumcake: RP2040 double-tap-reset driver
  • uf2: uf2conv.py, uf2families.json
  • rust-dilemma: RP2040 Half-duplex communication
  • qmk: RP2040 Half-duplex communication
  • rmk: bluetooth implemention

Dependencies

~12MB
~198K SLoC