Configuration

RMK provides a simple and declarative way to configure your keyboard using a TOML configuration file, requiring no Rust programming knowledge. You can also use Rust API which offers maximum flexibility and control over your keyboard's behavior.

RMK provides many examples for various microcontrollers using both configuration methods. See the examples folder in the RMK repository.

INFO

This section is a brief introduction to RMK's configuration system. For the complete configuration specification, please refer to the Configuration section.

TOML configuration

Keyboard configuration in RMK is managed using a keyboard.toml file that defines nearly every aspect of your keyboard setup. TOML is a human-readable configuration format that's easy to understand and edit.

New to TOML?

If you're unfamiliar with TOML syntax, check out the TOML Specification.

keyboard.toml is the default configuration method when your keyboard project is generated by rmkit.

If you create your project manually, enable the keyboard.toml support by using #[rmk_keyboard] macro:

#![no_std]
#![no_main]

use rmk::macros::rmk_keyboard;

#[rmk_keyboard]
mod keyboard {}

You should also specify the path to your keyboard.toml file in .cargo/config.toml, so that the build system can locate it:

.cargo/config.toml
[env]
KEYBOARD_TOML_PATH =  { value = "keyboard.toml", relative = true }

Rust API

For developers who want full programmatic control over the keyboard's behavior, RMK provides a comprehensive Rust API. This approach offers maximum flexibility and customization capabilities, allowing you to leverage Rust's powerful type system and compile-time guarantees to build sophisticated keyboard firmware.

The RMK code is organized in a modular way, consisting of several crates. Therefore, documentation for Rust types and APIs is organized under different crates, as follows:

  • rmk-types: Contains all types used in RMK, such as KeyCode, KeyAction, etc.
  • rmk: The main RMK crate, which exposes most of the APIs.

Check out examples that use Rust API if you want to try the fantastic Rust programming language. Configuration documentation also includes Rust API usage.