xref: /NovaShell/src/keycode.rs (revision 001f2a751fdbbe2ca1054f72891585ac8ce77932)
1 use num_enum::TryFromPrimitive;
2 
3 #[repr(u8)]
4 #[derive(Debug, FromPrimitive, TryFromPrimitive, ToPrimitive, PartialEq, Eq, Clone)]
5 #[allow(dead_code)]
6 pub enum SpecialKeycode {
7     LF = b'\n',
8     CR = b'\r',
9     Delete = b'\x7f',
10     BackSpace = b'\x08',
11     Tab = b'\t',
12 
13     FunctionKeyPrefix = 0xE0,
14     PauseBreak = 0xE1,
15 }
16 
17 #[repr(u8)]
18 #[derive(Debug, FromPrimitive, TryFromPrimitive, ToPrimitive, PartialEq, Eq, Clone)]
19 #[allow(dead_code)]
20 pub enum FunctionKeySuffix {
21     Up = 0x48,
22     Down = 0x50,
23     Left = 0x4B,
24     Right = 0x4D,
25 
26     Home = 0x47,
27     End = 0x4F,
28 }
29 
30 impl Into<u8> for SpecialKeycode {
31     fn into(self) -> u8 {
32         self as u8
33     }
34 }
35