Struct capsules_extra::usb::ctap::CtapHid
source · pub struct CtapHid<'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 CtapHid<'a, U>
impl<'a, U: UsbController<'a>> Client<'a> for CtapHid<'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
This is data going from the host to the device (us)
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 CtapHid<'a, U>
impl<'a, U: UsbController<'a>> UsbHid<'a, [u8; 64]> for CtapHid<'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 CtapHid<'a, U>
impl<'a, U> !RefUnwindSafe for CtapHid<'a, U>
impl<'a, U> !Send for CtapHid<'a, U>
impl<'a, U> !Sync for CtapHid<'a, U>
impl<'a, U> Unpin for CtapHid<'a, U>
impl<'a, U> !UnwindSafe for CtapHid<'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