Event Configuration

RMK allows you to tune event channel parameters in keyboard.toml based on your specific needs and hardware constraints.

For an overview of events and how to define custom events, see the Event documentation.

Configuration Parameters

Each event channel has three configurable parameters:

  • channel_size: Buffer size - how many events can be queued
  • pubs: Number of publishers - how many concurrent tasks can publish
  • subs: Number of subscribers - how many concurrent tasks can subscribe

Each event has default values for typical use cases. You can view all defaults in rmk-config/src/default_config/event_default.toml.

Configuration Syntax

Add an [event] section to your keyboard.toml:

[event]
# Configure specific parameters for individual events
event_name.channel_size = <value>
event_name.pubs = <value>
event_name.subs = <value>

Examples:

[event]
# Increase key event buffer for fast typing
keyboard.channel_size = 16

# Add more subscribers for multiple displays monitoring layer changes
layer_change.subs = 8

# Reduce subscribers to save memory on constrained devices
battery_state.subs = 2
led_indicator.subs = 2

# Configure multiple parameters for one event
peripheral_battery.channel_size = 4
peripheral_battery.subs = 4

Configurable Event Names

Config NameEvent TypeDefault Notes
Input Events
keyboardKeyboardEventchannel_size=16
modifierModifierEvent
pointingPointingEventchannel_size=8
State Events
layer_changeLayerChangeEventsubs=4
wpm_updateWpmUpdateEvent
led_indicatorLedIndicatorEvent
sleep_stateSleepStateEvent
Battery Events
battery_adcBatteryAdcEventchannel_size=2
charging_stateChargingStateEventchannel_size=2
battery_stateBatteryStateEventsubs=4
Connection Events
connection_changeConnectionChangeEvent
ble_status_changeBleStatusChangeEventpubs=2
Split Events
peripheral_connectedPeripheralConnectedEvent
central_connectedCentralConnectedEvent
peripheral_batteryPeripheralBatteryEventchannel_size=2, subs=2
clear_peerClearPeerEvent
  • Event - Event concepts, built-in events, and custom event definition
  • Input Device - How to create input devices that publish events
  • Processor - How to create processors that subscribe to events