Struct capsules_extra::usb::cdc::CdcAcm

source ·
pub struct CdcAcm<'a, U: 'a, A: 'a + Alarm<'a>> { /* private fields */ }
Expand description

Implementation of the Abstract Control Model (ACM) for the Communications Class Device (CDC) over USB.

Implementations§

source§

impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> CdcAcm<'a, U, A>

source

pub fn new( controller: &'a U, max_ctrl_packet_size: u8, vendor_id: u16, product_id: u16, strings: &'static [&'static str; 3], timeout_alarm: &'a A, host_initiated_function: Option<&'a (dyn Fn() + 'a)> ) -> Self

source

pub fn controller(&self) -> &'a U

Trait Implementations§

source§

impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> AlarmClient for CdcAcm<'a, U, A>

source§

fn alarm(&self)

Callback indicating the alarm time has been reached. The alarm MUST be disabled when this is called. If a new alarm is needed, the client can call Alarm::set_alarm.
source§

impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> Client<'a> for CdcAcm<'a, U, A>

source§

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

Handle a Control Setup transaction.

CDC uses special values here, and we can use these to know when a CDC client is connected or not.

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

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>, A: 'a + Alarm<'a>> Configure for CdcAcm<'a, U, A>

source§

fn configure(&self, _parameters: Parameters) -> Result<(), ErrorCode>

Returns Ok(()), or Read more
source§

impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> DeferredCallClient for CdcAcm<'a, U, A>

source§

impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> Receive<'a> for CdcAcm<'a, U, A>

source§

fn set_receive_client(&self, client: &'a dyn ReceiveClient)

Set the receive client, which will he called when reads complete.
source§

fn receive_buffer( &self, rx_buffer: &'static mut [u8], rx_len: usize ) -> Result<(), (ErrorCode, &'static mut [u8])>

Receive rx_len bytes into rx_buffer, making a callback to the ReceiveClient when complete. If the Result<(), ErrorCode> of receive_buffer’s return is Ok(()), the struct will issue a received_buffer callback in the future. If the value of the Result<(), ErrorCode> is Err(), then the rx_buffer argument is returned in the Err(). Valid ErrorCode values are: Read more
source§

fn receive_abort(&self) -> Result<(), ErrorCode>

Abort any ongoing receive transfers and return what is in the receive buffer with the receive_complete callback. If Ok(()) is returned, there will be no callback (no call to receive was outstanding). If there was a receive outstanding, which is cancelled successfully then BUSY will be returned and there will be a callback with a Result<(), ErrorCode> of CANCEL. If there was a reception outstanding, which is not cancelled successfully, then FAIL will be returned and there will be a later callback.
source§

fn receive_word(&self) -> Result<(), ErrorCode>

Receive a single word of data. The word length is determined by the UART configuration: it can be 6, 7, 8, or 9 bits long. If the Result<(), ErrorCode> is Ok(()), on completion, received_word will be called on the ReceiveClient. Other valid ErrorCode values are: Read more
source§

impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> Transmit<'a> for CdcAcm<'a, U, A>

source§

fn set_transmit_client(&self, client: &'a dyn TransmitClient)

Set the transmit client, which will be called when transmissions complete.
source§

fn transmit_buffer( &self, tx_buffer: &'static mut [u8], tx_len: usize ) -> Result<(), (ErrorCode, &'static mut [u8])>

Transmit a buffer of data. On completion, transmitted_buffer in the TransmitClient will be called. If the Result<(), ErrorCode> returned by transmit is an Ok(()), the struct will issue a transmitted_buffer callback in the future. If the value of the Result<(), ErrorCode> is Err(), then the tx_bufferargument is returned in theErr(), along with the ErrorCode. Valid ErrorCode` values are: Read more
source§

fn transmit_abort(&self) -> Result<(), ErrorCode>

Abort an outstanding call to transmit_word or transmit_buffer. The return code indicates whether the call has fully terminated or there will be a callback. Cancelled calls to transmit_buffer MUST always make a callback, to return the passed buffer back to the caller. Read more
source§

fn transmit_word(&self, _word: u32) -> Result<(), ErrorCode>

Transmit a single word of data asynchronously. The word length is determined by the UART configuration: it can be 6, 7, 8, or 9 bits long. If the Result<(), ErrorCode> is Ok(()), on completion, transmitted_word will be called on the TransmitClient. Other valid Result<(), ErrorCode> values are: Read more

Auto Trait Implementations§

§

impl<'a, U, A> !Freeze for CdcAcm<'a, U, A>

§

impl<'a, U, A> !RefUnwindSafe for CdcAcm<'a, U, A>

§

impl<'a, U, A> !Send for CdcAcm<'a, U, A>

§

impl<'a, U, A> !Sync for CdcAcm<'a, U, A>

§

impl<'a, U, A> Unpin for CdcAcm<'a, U, A>

§

impl<'a, U, A> !UnwindSafe for CdcAcm<'a, U, A>

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> SizedTypeProperties for T

source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

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

§

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>,

§

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.
source§

impl<'a, T> Uart<'a> for T
where T: Configure + Transmit<'a> + Receive<'a>,

source§

impl<'a, T> UartData<'a> for T
where T: Transmit<'a> + Receive<'a>,