mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
feat: implement Display trait for keyboard::KeyMap
This commit is contained in:
parent
5195dc9455
commit
52578e7a3f
1 changed files with 15 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::fmt::Display;
|
||||||
|
|
||||||
pub const SERVER_NAME_KBD: &str = "_Matrix keyboard driver_";
|
pub const SERVER_NAME_KBD: &str = "_Matrix keyboard driver_";
|
||||||
|
|
||||||
#[derive(Debug, Default, Copy, Clone)]
|
#[derive(Debug, Default, Copy, Clone)]
|
||||||
|
|
@ -49,6 +51,19 @@ impl From<KeyMap> for usize {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Display for KeyMap {
|
||||||
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Azerty => write!(f, "AZERTY"),
|
||||||
|
Self::Qwerty => write!(f, "QWERTY"),
|
||||||
|
Self::Qwertz => write!(f, "QWERTZ"),
|
||||||
|
Self::Dvorak => write!(f, "Dvorak"),
|
||||||
|
Self::Braille => write!(f, "Braille"),
|
||||||
|
Self::Undefined => write!(f, "Undefined"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Opcodes are pinned down to allow for unsafe FFI extraction of key hits
|
// Opcodes are pinned down to allow for unsafe FFI extraction of key hits
|
||||||
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
||||||
pub(crate) enum Opcode {
|
pub(crate) enum Opcode {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue