[][src]Struct sunrise_keyboard::ps2::PS2

struct PS2 {
    status_port: Pio<u8>,
    data_port: Pio<u8>,
    event: ReadableEvent,
    is_capslocked: AtomicBool,
    is_left_shift: AtomicBool,
    is_right_shift: AtomicBool,
    is_left_ctrl: AtomicBool,
    is_right_ctrl: AtomicBool,
    is_left_alt: AtomicBool,
    is_right_alt: AtomicBool,
    partial_input: RwLock<ArrayVec<[u8; 6]>>,
}

PS2 keyboard state.

Fields

status_port: Pio<u8>

Status Register address

data_port: Pio<u8>

Data Register address

event: ReadableEvent

IRQEvent for the PS/2 keyboard. Triggered each time the user presses a key.

is_capslocked: AtomicBool

Flips when the user has toggled the caps lock key. When set to true, all letters are returned in uppercase.

is_left_shift: AtomicBool

Set to true if the user is currently holding the left shift key. When set to true, all letters are returned in uppercase.

is_right_shift: AtomicBool

Set to true if the user is currently holding the right shift key. When set to true, all letters are returned in uppercase.

is_left_ctrl: AtomicBool

Set to true if the user is currently holding the left ctrl key.

is_right_ctrl: AtomicBool

Set to true if the user is currently holding the right ctrl key.

is_left_alt: AtomicBool

Set to true if the user is currently holding the left alt key.

is_right_alt: AtomicBool

Set to true if the user is currently holding the right alt key.

partial_input: RwLock<ArrayVec<[u8; 6]>>

Holds input until sequence has been completed.

Implementations

impl PS2[src]

fn handle_control_key(&self, key: HidKeyboardScancode, state: State)[src]

Handle a control key scancode

fn key_to_letter(&self, key: LetterKey) -> char[src]

Gets the letter from the key, accounting for shift and capslock

fn encode_modifiers(&self, state: State) -> u8[src]

Get a bitfield representing the modifiers of this keyboard

fn has_read_key_event(&self) -> bool[src]

Return true if the PS2 keyboard has an key event to read.

fn try_read_key_event(&self) -> Option<KeyEvent>[src]

Tries to read a KeyEvent, grabs more bytes from the port if input is incomplete.

Core function used by both try_read_keyboard_state and try_read_key

fn try_read_keyboard_state(&self) -> Option<HidKeyboardState>[src]

Return a representation of a single key press if any updates is availaible.

Key presses are bufferized: if nobody is calling read_key when the user presses a key, it will be kept in a buffer until read_key is called.

fn read_key(&self) -> char[src]

Waits for a single key press, and return its unicode representation.

Key presses are bufferized: if nobody is calling read_key when the user presses a key, it will be kept in a buffer until read_key is called.

fn try_read_key(&self) -> Option<char>[src]

If a key press is pending, return its unicode representation. This can be used to implement poll-based or asynchronous reading from keyboard.

fn event_irq(&self) -> &ReadableEvent[src]

Get a ReadableEvent for the PS2 IRQ. Waiting on this event will wait until a keypress is detected. Note that once this event is triggered, it won't trigger again until read_key or try_read_key is called.

Auto Trait Implementations

impl !RefUnwindSafe for PS2

impl Send for PS2

impl Sync for PS2

impl Unpin for PS2

impl UnwindSafe for PS2

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SizedIPCBuffer for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.