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>

Set the configuration parameters for the UART bus. Read more
source§

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

source§

fn handle_deferred_call(&self)

Software interrupt function that is called when the deferred call is triggered.
source§

fn register(&'static self)

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 be 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. Read more
source§

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

Abort any ongoing receive transfers and return what has been received. Read more
source§

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

Receive a single word of data. 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. Read more
source§

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

Abort an outstanding call to transmit_word or transmit_buffer. Read more
source§

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

Transmit a single word of data asynchronously. 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, 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>,