capsules_extra::usb::keyboard_hid

Struct KeyboardHid

Source
pub struct KeyboardHid<'a, U: 'a> { /* private fields */ }
Expand description

Implementation of the CTAP HID (Human Interface Device)

Implementations§

Source§

impl<'a, U: UsbController<'a>> KeyboardHid<'a, U>

Source

pub fn new( controller: &'a U, vendor_id: u16, product_id: u16, strings: &'static [&'static str; 3], ) -> Self

Source

pub fn set_client(&'a self, client: &'a dyn Client<'a, [u8; 64]>)

Trait Implementations§

Source§

impl<'a, U: UsbController<'a>> Client<'a> for KeyboardHid<'a, U>

Source§

fn ctrl_setup(&'a self, endpoint: usize) -> CtrlSetupResult

Handle a Control Setup transaction.

Source§

fn ctrl_in(&'a self, endpoint: usize) -> CtrlInResult

Handle a Control In transaction

Source§

fn ctrl_out(&'a self, _endpoint: usize, _packet_bytes: u32) -> CtrlOutResult

Handle a Control Out transaction

Source§

fn ctrl_status_complete(&'a self, endpoint: usize)

Handle the completion of a Control transfer

Source§

fn packet_in( &'a self, transfer_type: TransferType, _endpoint: usize, ) -> InResult

Handle a Bulk/Interrupt IN transaction.

This is called when we can send data to the host. It should get called when we tell the controller we want to resume the IN endpoint (meaning we know we have data to send) and afterwards until we return hil::usb::InResult::Delay from this function. That means we can use this as a callback to mean that the transmission finished by waiting until this function is called when we don’t have anything left to send.

Source§

fn packet_out( &'a self, transfer_type: TransferType, _endpoint: usize, _packet_bytes: u32, ) -> OutResult

Handle a Bulk/Interrupt OUT transaction

Unused for keyboard.

Source§

fn enable(&'a self)

Source§

fn attach(&'a self)

Source§

fn bus_reset(&'a self)

Source§

fn ctrl_status(&'a self, endpoint: usize)

Source§

fn packet_transmitted(&'a self, endpoint: usize)

Source§

impl<'a, U: UsbController<'a>> UsbHid<'a, [u8; 64]> for KeyboardHid<'a, U>

Source§

fn send_buffer( &'a self, send: &'static mut [u8; 64], ) -> Result<usize, (ErrorCode, &'static mut [u8; 64])>

Sets the buffer to be sent and starts a send transaction. Once the packet is sent the packet_transmitted() callback will be triggered and no more data will be sent until this is called again. Read more
Source§

fn send_cancel(&'a self) -> Result<&'static mut [u8; 64], ErrorCode>

Cancels a send called by send_buffer(). If send_cancel() successfully cancels a send transaction before the transaction has been acted upon this function will return the buffer passed via send_buffer() and no callback will occur. If there is currently no send transaction (send_buffer() hasn’t been called) this will return Err(INVAL). If the transaction can’t be cancelled cleanly, either because the send has already occured, a partial send has occured or the send can not be cancelled by the hardware this will return Err(BUSY) and the callback will still occur. Note that unless the transaction completes the callback will indicate a result of CANCEL.
Source§

fn receive_buffer( &'a self, _recv: &'static mut [u8; 64], ) -> Result<(), (ErrorCode, &'static mut [u8; 64])>

Sets the buffer for received data to be stored and enables receive transactions. Once this is called the implementation will enable receiving via USB. Once a packet is received the packet_received() callback will be triggered and no more data will be received until this is called again. Read more
Source§

fn receive_cancel(&'a self) -> Result<&'static mut [u8; 64], ErrorCode>

Cancels a receive called by receive_buffer(). If receive_cancel() successfully cancels a receive transaction before the transaction has been acted upon this function will return the buffer passed via receive_buffer() and no callback will occur. If there is currently no receive transaction (receive_buffer() hasn’t been called) this will return Err(INVAL). If the transaction can’t be cancelled cleanly, either because the receive has already occured, a partial receive has occured or the receive can not be cancelled by the hardware this will return Err(BUSY) and the callback will still occur. Note that unless the transaction completes the callback will indicate a result of CANCEL.

Auto Trait Implementations§

§

impl<'a, U> !Freeze for KeyboardHid<'a, U>

§

impl<'a, U> !RefUnwindSafe for KeyboardHid<'a, U>

§

impl<'a, U> !Send for KeyboardHid<'a, U>

§

impl<'a, U> !Sync for KeyboardHid<'a, U>

§

impl<'a, U> Unpin for KeyboardHid<'a, U>

§

impl<'a, U> !UnwindSafe for KeyboardHid<'a, U>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.