[−][src]Struct pc_keyboard::Keyboard
Keyboard<T, S>
encapsulates decode/sampling logic, and handles state transitions and key events.
Size: 10 bytes
Methods
impl<T, S> Keyboard<T, S> where
T: KeyboardLayout,
S: ScancodeSet,
[src]
T: KeyboardLayout,
S: ScancodeSet,
pub fn new(_layout: T, _set: S, handle_ctrl: HandleControl) -> Keyboard<T, S>
[src]
Make a new Keyboard object with the given layout.
pub fn set_ctrl_handling(&mut self, new_value: HandleControl)
[src]
Change the Ctrl key mapping.
pub fn get_ctrl_handling(&self) -> HandleControl
[src]
Get the current Ctrl key mapping.
pub fn clear(&mut self)
[src]
Clears the bit register.
Call this when there is a timeout reading data from the keyboard.
pub fn add_word(&mut self, word: u16) -> Result<Option<KeyEvent>, Error>
[src]
Processes a 16-bit word from the keyboard.
- The start bit (0) must be in bit 0.
- The data octet must be in bits 1..8, with the LSB in bit 1 and the MSB in bit 8.
- The parity bit must be in bit 9.
- The stop bit (1) must be in bit 10.
pub fn add_byte(&mut self, byte: u8) -> Result<Option<KeyEvent>, Error>
[src]
Processes an 8-bit byte from the keyboard.
We assume the start, stop and parity bits have been processed and verified.
pub fn add_bit(&mut self, bit: bool) -> Result<Option<KeyEvent>, Error>
[src]
Shift a bit into the register.
Call this /or/ call add_word
- don't call both.
Until the last bit is added you get Ok(None) returned.
pub fn process_keyevent(&mut self, ev: KeyEvent) -> Option<DecodedKey>
[src]
Processes a KeyEvent
returned from add_bit
, add_byte
or add_word
and produces a decoded key.
For example, the KeyEvent for pressing the '5' key on your keyboard gives a DecodedKey of unicode character '5', unless the shift key is held in which case you get the unicode character '%'.
Trait Implementations
impl<T: Debug, S: Debug> Debug for Keyboard<T, S> where
T: KeyboardLayout,
S: ScancodeSet,
[src]
T: KeyboardLayout,
S: ScancodeSet,
Auto Trait Implementations
impl<T, S> Send for Keyboard<T, S> where
S: Send,
T: Send,
S: Send,
T: Send,
impl<T, S> Sync for Keyboard<T, S> where
S: Sync,
T: Sync,
S: Sync,
T: Sync,
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,