pub struct Keyboard { /* private fields */ }Expand description
Boot-compatible keyboard.
Pressing a key means sending a report with that key set, then sending
KeyboardReport::default (or the next set of keys) to release it. Wrap it
in a HidClass to talk to the host:
ⓘ
let mut kbd = HidClass::new(&alloc, Keyboard::new());
kbd.send_input(&KeyboardReport { keys: [0x04, 0, 0, 0, 0, 0], ..Default::default() }.to_bytes());Implementations§
Trait Implementations§
Source§impl<B: UsbBus> HidDevice<B> for Keyboard
impl<B: UsbBus> HidDevice<B> for Keyboard
Source§fn output_report(&mut self, _report_id: u8, data: &[u8])
fn output_report(&mut self, _report_id: u8, data: &[u8])
Output report received on the interrupt OUT endpoint. Read more
Source§fn get_report(
&mut self,
_report_type: ReportType,
_report_id: u8,
_buf: &mut [u8],
) -> Option<usize>
fn get_report( &mut self, _report_type: ReportType, _report_id: u8, _buf: &mut [u8], ) -> Option<usize>
Get Report — copy the report selected by report_type and report_id
into buf and return its length, including the report ID byte when the
spec declares report IDs. Read moreSource§fn set_report(
&mut self,
_report_type: ReportType,
_report_id: u8,
_data: &[u8],
) -> bool
fn set_report( &mut self, _report_type: ReportType, _report_id: u8, _data: &[u8], ) -> bool
Set Report — handle a report written by the host. Read moreSource§fn deconfigure(&mut self)
fn deconfigure(&mut self)
Called when the host de-configures the device.
Source§fn poll(&mut self, _input: &EndpointIn<'_, B>)
fn poll(&mut self, _input: &EndpointIn<'_, B>)
Called on every device poll while configured. Read more
Auto Trait Implementations§
impl Forget for Keyboard
impl Freeze for Keyboard
impl Move for Keyboard
impl RefUnwindSafe for Keyboard
impl Send for Keyboard
impl Sync for Keyboard
impl Unpin for Keyboard
impl UnsafeUnpin for Keyboard
impl UnwindSafe for Keyboard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more