From v0.8 to v0.9

RMK v0.9 introduces a unified event and processor system, consolidating the previously separate controller and input_processor APIs into a single, cohesive architecture.

Breaking Changes

Macro Changes

OldNew
#[controller_event]#[event]
#[input_event]#[event]
#[controller]#[processor]
#[input_processor]#[processor]
#[derive(InputEvent)]#[derive(Event)]
#[register_controller]#[register_processor]

Function Changes

OldNew
publish_controller_event()publish_event()
publish_controller_event_async()publish_event_async()
publish_input_event()publish_event()
publish_input_event_async()publish_event_async()

Migration Examples

Migrating a Controller to Processor

Before (v0.8):

use rmk_macro::controller;

#[controller(subscribe = [LayerChangeEvent])]
pub struct DisplayController {
    display: Display,
}

impl DisplayController {
    async fn on_layer_change_event(&mut self, event: LayerChangeEvent) {
        // Handle layer change
    }
}

After (v0.9):

use rmk_macro::processor;

#[processor(subscribe = [LayerChangeEvent])]
pub struct DisplayProcessor {
    display: Display,
}

impl DisplayProcessor {
    async fn on_layer_change_event(&mut self, event: LayerChangeEvent) {
        // Handle layer change
    }
}

Migrating Registration

Before (v0.8):

#[rmk_keyboard]
mod my_keyboard {
    #[register_controller(event)]
    fn display_controller() -> DisplayController {
        DisplayController::new()
    }
}

After (v0.9):

#[rmk_keyboard]
mod my_keyboard {
    #[register_processor(event)]
    fn display_processor() -> DisplayProcessor {
        DisplayProcessor::new()
    }
}

Migrating Custom Events

Before (v0.8):

use rmk_macro::controller_event;

#[controller_event(channel_size = 8, subs = 2, pubs = 1)]
#[derive(Clone, Copy, Debug)]
pub struct MyCustomEvent {
    pub data: u8,
}

After (v0.9):

use rmk_macro::event;

#[event(channel_size = 8, subs = 2, pubs = 1)]
#[derive(Clone, Copy, Debug)]
pub struct MyCustomEvent {
    pub data: u8,
}

Migrating Multi-Event Enums

Before (v0.8):

use rmk_macro::InputEvent;

#[derive(InputEvent, Clone, Debug)]
pub enum MyEvents {
    Battery(BatteryEvent),
    Pointing(PointingEvent),
}

After (v0.9):

use rmk_macro::Event;

#[derive(Event, Clone, Debug)]
pub enum MyEvents {
    Battery(BatteryEvent),
    Pointing(PointingEvent),
}

Why This Change?

The unified API simplifies the mental model for RMK users:

  • One macro for events: #[event] replaces both #[controller_event] and #[input_event]
  • One macro for processors: #[processor] replaces both #[controller] and #[input_processor]
  • Consistent naming: All event-related functions now use publish_event() instead of separate names for different event types

This consolidation reduces confusion and makes the codebase more maintainable while preserving all existing functionality.