6 releases
0.1.0 | Dec 2, 2024 |
---|---|
0.1.0-beta.5 | Dec 1, 2024 |
#1298 in Hardware support
338 downloads per month
125KB
3K
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.
Libraries
Crate | crates.io | docs.rs | repo |
---|---|---|---|
rktk | link | ||
rktk-drivers-common | link | ||
rktk-drivers-nrf | link | ||
rktk-drivers-rp | link | ||
rktk-keymanager | link | ||
rktk-rrp | link | ||
rktk-rrp-client-webhid | link | ||
rktk-cli | link | ||
rktk-client | link |
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 | Note |
---|---|---|
Key action | ||
Mod-Tap | ✅ | Unlike QMK, any keycode can be specified as modifier. |
Tap-Hold | ✅ | |
Tap Dance | ✅ | |
Oneshot key | ✅ | |
Combo key | 🟡 | |
Key code | ||
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 inrktk-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 | ✅ |
Examples
You can find examples in the examples
directory.
Development
See cargo rktk --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 file.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 examples in this repo or the following repository:
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
~18MB
~320K SLoC