pub struct KeyboardHid<'a, U: 'a> { /* private fields */ }
Expand description
Implementation of the CTAP HID (Human Interface Device)
Implementations§
Trait Implementations§
Source§impl<'a, U: UsbController<'a>> Client<'a> for KeyboardHid<'a, U>
impl<'a, U: UsbController<'a>> Client<'a> for KeyboardHid<'a, U>
Source§fn ctrl_setup(&'a self, endpoint: usize) -> CtrlSetupResult
fn ctrl_setup(&'a self, endpoint: usize) -> CtrlSetupResult
Handle a Control Setup transaction.
Source§fn ctrl_in(&'a self, endpoint: usize) -> CtrlInResult
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
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)
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
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
fn packet_out( &'a self, transfer_type: TransferType, _endpoint: usize, _packet_bytes: u32, ) -> OutResult
Handle a Bulk/Interrupt OUT transaction
Unused for keyboard.
fn enable(&'a self)
fn attach(&'a self)
fn bus_reset(&'a self)
fn ctrl_status(&'a self, endpoint: usize)
fn packet_transmitted(&'a self, endpoint: usize)
Source§impl<'a, U: UsbController<'a>> UsbHid<'a, [u8; 64]> for KeyboardHid<'a, U>
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])>
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 moreSource§fn send_cancel(&'a self) -> Result<&'static mut [u8; 64], ErrorCode>
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])>
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 moreSource§fn receive_cancel(&'a self) -> Result<&'static mut [u8; 64], ErrorCode>
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> 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