use crate::ir::mapping::IrMappingStatic;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum KeplerKeys {
Power,
Mode,
Mute,
PlayPause,
Prev,
Next,
Eq,
Minus,
Plus,
Num(u8),
Repeat,
USd,
}
#[allow(async_fn_in_trait)]
pub trait IrKepler {
async fn wait_for_press(&self) -> KeplerKeys;
}
impl<T> IrKepler for &T
where
T: IrKepler + ?Sized,
{
async fn wait_for_press(&self) -> KeplerKeys {
(*self).wait_for_press().await
}
}
#[doc(hidden)]
pub struct IrKeplerStatic(IrMappingStatic);
impl IrKeplerStatic {
#[must_use]
pub const fn new() -> Self {
Self(IrMappingStatic::new())
}
#[must_use]
pub const fn inner(&self) -> &IrMappingStatic {
&self.0
}
}
#[doc(hidden)]
pub const KEPLER_MAPPING: [(u16, u8, KeplerKeys); 21] = [
(0x0000, 0x45, KeplerKeys::Power),
(0x0000, 0x46, KeplerKeys::Mode),
(0x0000, 0x47, KeplerKeys::Mute),
(0x0000, 0x44, KeplerKeys::PlayPause),
(0x0000, 0x40, KeplerKeys::Prev),
(0x0000, 0x43, KeplerKeys::Next),
(0x0000, 0x07, KeplerKeys::Eq),
(0x0000, 0x15, KeplerKeys::Minus),
(0x0000, 0x09, KeplerKeys::Plus),
(0x0000, 0x16, KeplerKeys::Num(0)),
(0x0000, 0x19, KeplerKeys::Repeat),
(0x0000, 0x0D, KeplerKeys::USd),
(0x0000, 0x0C, KeplerKeys::Num(1)),
(0x0000, 0x18, KeplerKeys::Num(2)),
(0x0000, 0x5E, KeplerKeys::Num(3)),
(0x0000, 0x08, KeplerKeys::Num(4)),
(0x0000, 0x1C, KeplerKeys::Num(5)),
(0x0000, 0x5A, KeplerKeys::Num(6)),
(0x0000, 0x42, KeplerKeys::Num(7)),
(0x0000, 0x52, KeplerKeys::Num(8)),
(0x0000, 0x4A, KeplerKeys::Num(9)),
];