diff options
| author | Tianhao Wang <shrik3@mailbox.org> | 2024-04-16 14:42:14 +0200 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:13:40 +0200 |
| commit | 425e3fd1fd97e50041d8272bf4bcc7c1107571a1 (patch) | |
| tree | eb343e03af4c6254e62a2f1238e7e5e88559de40 /src/machine/key.rs | |
| parent | 0bbc8535db2f8aaeb1919d8bc28e326f827ed8f5 (diff) | |
keyboard: implement leds and reboot
works on qemu, untested on real machine
Diffstat (limited to 'src/machine/key.rs')
| -rw-r--r-- | src/machine/key.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/machine/key.rs b/src/machine/key.rs index 8d4e5f9..48e98b2 100644 --- a/src/machine/key.rs +++ b/src/machine/key.rs @@ -21,18 +21,23 @@ impl convert::Into<u8> for Key { } } +// Technically the *Lock are special keys, instead of Modifiers +// but we don't need another type FWIW. +// Mask bits[2:0] to get the leds. bitflags! { #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub struct Modifiers:u8 { const NONE = 0; - const SHIFT = 1 << 0; - const ALT_LEFT = 1 << 1; - const ALT_RIGHT = 1 << 2; - const CTRL_LEFT = 1 << 3; - const CTRL_RIGHT = 1 << 4; - const CAPSLOCK = 1 << 5; - const NUMLOCK = 1 << 6; - const SCROLL_LOCK = 1 << 7; + // lock states + const SCROLL_LOCK = 1 << 0; + const NUMLOCK = 1 << 1; + const CAPSLOCK = 1 << 2; + // modifiers + const SHIFT = 1 << 3; + const ALT_LEFT = 1 << 4; + const ALT_RIGHT = 1 << 5; + const CTRL_LEFT = 1 << 6; + const CTRL_RIGHT = 1 << 7; } } |
