rmk_q1_pro_iso/backlight/
lock_indicator.rs1use rmk::{
2 channel::{blocking_mutex::raw::CriticalSectionRawMutex, channel::Channel},
3 event::LedIndicatorEvent,
4 macros::processor,
5};
6
7pub static BACKLIGHT_CH: Channel<CriticalSectionRawMutex, BacklightCmd, 4> = Channel::new();
9
10#[derive(Copy, Clone)]
11pub enum BacklightCmd {
13 Indicators {
15 caps: bool,
17 },
18}
19
20#[processor(subscribe = [LedIndicatorEvent])]
21pub struct LedIndicatorProcessor;
23
24impl LedIndicatorProcessor {
25 pub const fn new() -> Self { Self }
27
28 async fn on_led_indicator_event(&self, event: LedIndicatorEvent) {
30 let caps = event.indicator.caps_lock();
31
32 BACKLIGHT_CH.sender().send(BacklightCmd::Indicators { caps }).await;
33 }
34}