From 0ebc5ab0ee0fc80c801487f534687c8bd236abc1 Mon Sep 17 00:00:00 2001 From: Tianhao Wang Date: Thu, 1 Feb 2024 18:12:24 +0100 Subject: keyctl: use bitflags for key modifiers Merge key modifier getters and setters --- src/machine/keyctrl.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/machine/keyctrl.rs') 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!(); + } } -- cgit v1.2.3-70-g09d2