aboutsummaryrefslogtreecommitdiff
path: root/src/machine/keyctrl.rs
diff options
context:
space:
mode:
authorTianhao Wang <wth@riseup.net>2024-02-01 18:12:24 +0100
committerTianhao Wang <shrik3@mailbox.org>2024-06-11 15:13:38 +0200
commit0ebc5ab0ee0fc80c801487f534687c8bd236abc1 (patch)
treeab86d5d778cda9fd484edefbec737c81e5bda0f4 /src/machine/keyctrl.rs
parent174f8130388cccfa92e985292bb34db9d9c39403 (diff)
keyctl: use bitflags for key modifiers
Merge key modifier getters and setters
Diffstat (limited to 'src/machine/keyctrl.rs')
-rw-r--r--src/machine/keyctrl.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/machine/keyctrl.rs b/src/machine/keyctrl.rs
index 93bd419..43f92d1 100644
--- a/src/machine/keyctrl.rs
+++ b/src/machine/keyctrl.rs
@@ -15,27 +15,23 @@ use crate::machine::device_io::*;
// reboot()
// set_led(char led,bool on)
// set_repeat_rate(int speed,int delay)
+
pub struct KeyboardController {
code: u8,
prefix: u8,
gather: Key,
leds: u8,
-
- // two ports for keyboard controller
- ctrl_port: u16,
- data_port: u16,
- // status register bits
}
impl KeyboardController {
+ const CTRL_PORT:u16 = 0x64;
+ const DATA_PORT:u16 = 0x60;
pub fn new() -> Self {
Self {
code: 0,
prefix: 9,
gather: Key::new(),
leds: 0,
- ctrl_port: 0x64,
- data_port: 0x60,
}
}
@@ -45,8 +41,12 @@ impl KeyboardController {
let mut invalid: Key = Key::new();
invalid.set_raw(0xff);
- let status = inb(self.ctrl_port);
+ let status = inb(Self::CTRL_PORT);
return Key::new();
// TODO here
}
+
+ pub fn reboot(&mut self) {
+ todo!();
+ }
}