6 releases

0.1.0 Dec 2, 2024
0.1.0-beta.5 Dec 1, 2024

#2431 in Hardware support

Download history

91 downloads per month

MIT license

145KB
4K SLoC

rktk

Rust Keyboard Toolkit

Crates.io Version GitHub Actions Workflow Status Doc build status Ask DeepWiki

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.

Documents

  • Main site: Very incomplete documentation site
  • API Docs: RKTK Rust API docs
  • Deepwiki: It contains some incorrect content, but considering it is AI-generated, it is excellent.

Tools

  • RKTK client: rktk remote protocol (rrp) online configurator (remapper)

Example keyboards

The /keyboards directory in this repository contains firmware code using rktk for each keyboard.

Code for a specific platform and keyboard constitutes a single crate. Crates can be used as both libraries and binaries. The library serves as a collection of useful code for that keyboard. The binary is the actual keyboard firmware built using it.

Features

Below is an overview of the features included in rktk.

  • ✅ : Working
  • 🟡 : Basic implementation only or known bugs.
  • 🔴 : Planned.
  • (blank): N/A.

Core features

Feature Status Note
Keyscan
Key mapping 🟡 See below table for detail
Mouse
Encoder 🟡
Hook system 🟡
USB
Bluetooth 🟡
Split keyboard
Display 🟡
Storage 🟡
RGB led 🟡
Remapper (rktk-client) 🟡

Key mapping features

Key mapping features is implemented in kmsm and this crate does not depend on rktk or embassy.

Feature name Status Note
Key action
Tap-Hold Called as Mod-Tap or Layer-Tap in QMK
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

Driver that is available in the rktk-drivers-common crate is available for all platforms which have embassy compatible HAL.

Driver Common RP2040 NRF52840
Key scanner
Matrix 🟡 - -
Matrix with shift register - -
(Japanese) Duplex-Matrix 🟡 - -
 
Mouse
PMW3360 - -
PAW3395 - -
 
Encoder 🟡 - -
 
Debouncer
Eager debouncer 🟡 - -
 
Host communication
USB - -
Bluetooth 🟡 (Trouble) 🟡 (SoftDevice)
 
Split communication
Half-duplex (single wire, TRS) 🟡 (PIO) 🟡 (UART)
Full-duplex (dual wire, TRRS) ✅ (UART)
Bluetooth 🔴
 
Display
SSD1306 - -
 
Storage
sequential-storage (NorFlash) 🟡 - -
 
RGB led
WS2812 ✅ (PIO) ✅ (PWM)

Development

Dependencies

In addition to the dependencies specified here, to develop rktk, you need to install the following dependencies:

MSRV

As library

rktk's MSRV is the latest stable version of Rust.

Although, a nightly compiler is required to minimize the binary size.

For development

As a library, rktk does not depend on unstable feature, but the rktk repository workspace depends on cargo's unstable feature. Therefore, nightly is required to develop rktk.

Credits & Acknowledgements

  • rumcake: RP2040 double-tap-reset driver
  • rust-dilemma: RP2040 Half-duplex communication
  • qmk: RP2040 Half-duplex communication
  • rmk: BLE implemention

Dependencies

~17MB
~308K SLoC