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 of 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:

[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.

Who should use the Rust API?

The Rust API is ideal if you:

  • Are familiar with Rust embedded programming
  • Need advanced features not available in TOML configuration
  • Want to implement complex keyboard behaviors

Checkout examples which use Rust API if you want to try fantastic Rust programming language.