[][src]Trait kernel::hil::usb_hid::Client

pub trait Client<'a, T: UsbHidType> {
    fn packet_received(
        &'a self,
        result: ReturnCode,
        buffer: &'static mut T,
        endpoint: usize
    );
fn packet_transmitted(
        &'a self,
        result: ReturnCode,
        buffer: &'static mut T,
        endpoint: usize
    );
fn can_receive(&'a self) -> bool; }

Implement this trait and use set_client() in order to receive callbacks.

Required methods

fn packet_received(
    &'a self,
    result: ReturnCode,
    buffer: &'static mut T,
    endpoint: usize
)

Called when a packet is received. This will return the buffer passed into receive_buffer() as well as the endpoint where the data was received. If the buffer length is smaller then the data length the buffer will only contain part of the packet and result will contain indicate an ESIZE error. Result will indicate ECANCEL if a receive was cancelled by receive_cancel() but the callback still occured. See receive_cancel() for more details.

fn packet_transmitted(
    &'a self,
    result: ReturnCode,
    buffer: &'static mut T,
    endpoint: usize
)

Called when a packet has been finished transmitting. This will return the buffer passed into send_buffer() as well as the endpoint where the data was sent. If not all of the data could be sent the result will contain the ESIZE error. Result will indicate ECANCEL if a send was cancelled by send_cancel() but the callback still occured. See send_cancel() for more details.

fn can_receive(&'a self) -> bool

Called when checking if we can start a new receive operation. Should return true if we are ready to receive and not currently in the process of receiving anything. That is if we are currently idle. If there is an outstanding call to receive, a callback already waiting to be called then this will return false.

Loading content...

Implementors

Loading content...