Struct pc_keyboard::Keyboard

source ·
pub struct Keyboard<T, S>where
    T: KeyboardLayout,
    S: ScancodeSet,
{ /* private fields */ }
Expand description

Keyboard<T, S> encapsulates decode/sampling logic, and handles state transitions and key events. Size: 10 bytes

Implementations

Make a new Keyboard object with the given layout.

Clears the bit register.

Call this when there is a timeout reading data from the keyboard.

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.

Processes an 8-bit byte from the keyboard.

We assume the start, stop and parity bits have been processed and verified.

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.

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.