RKTK API Docs RKTK Home Repo

Crate rktk

Source
Expand description

§rktk

§Overview

rktk is a framework to build keyboard firmware. Using rktk, you can easily make feature-rich highly customizable keyboard firmware.

§rktk crate

This rktk crate is the main crate of the project. It contains the main logic of the keyboard firmware and does not depend on any specific hardware.

This crate consists of the following modules:

  • task: The main task that runs the keyboard firmware.
  • drivers: Drivers that are used by the task.
  • hooks: Hooks that can be used to customize the behavior of the application.
  • config: Configuration of the keyboard.

Basically, by passing drivers::Drivers, hooks::Hooks and config::keymap::Keymap to task::start, you can start the keyboard firmware.

§Feature flags

  • alloc — Uses alloc to spawn arbitary tasks. For more detail, see next section.
  • rrp — Enables rrp
  • rrp-log — Set rrp-over-usb logger of log crate
  • defmt — Logging using defmt. Intended for debugging.
  • log — Logging using log. Required to send logs via rrp.

§alloc feature

Embassy has the limitation that tasks with generics cannot be spawned. For this reason, rktk, which makes heavy use of generics, uses the join method of embassy-sync to execute all tasks instead of spawning them. However, this may be inferior to using spawning in terms of performance and power consumption.

So if we enable alloc feature and provide an allocator, we can remove this limitation by spawning tasks in the heap.

§Note about statically configured value

You may see hard-coded values is used in some places (ex: config::keymap::Keymap). These types are actually not hardcoded, but are configurable using json file. Just a random value is provided because it is required to generate docs.

For more detail, see config.

Modules§

config
Rktk configuration management.
dongle_task
drivers
Drivers for the keyboard.
hooks
Hooks are used to customize the behavior of the application.
task
Program entrypoint.
utils
Util types

Macros§

print
Print to the display
print_str
Print to the display without formatting.
singleton