diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -186,7 +186,10 @@ impl KbLedState } #[inline] - pub fn revert(con: &Console) -> io::Result<()> { ioctl::kdsetled(con, None) } + pub fn revert(con: &Console) -> io::Result<()> + { + ioctl::kdsetled(con, None) + } #[inline] pub fn cap(&self) -> bool { (self.0 & 0x4) != 0 } @@ -196,6 +199,27 @@ impl KbLedState #[inline] pub fn scr(&self) -> bool { (self.0 & 0x1) != 0 } + + #[inline] + pub fn set_cap(&mut self, set: bool) + { + let bit = (set as u8) << 2; + self.0 = (self.0 & !bit) | bit; + } + + #[inline] + pub fn set_num(&mut self, set: bool) + { + let bit = (set as u8) << 1; + self.0 = (self.0 & !bit) | bit; + } + + #[inline] + pub fn set_scr(&mut self, set: bool) + { + let bit = set as u8; + self.0 = (self.0 & !bit) | bit; + } } impl fmt::Display for KbLedState |