embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

EcmHost

Struct EcmHost 

Source
pub struct EcmHost<'d, A: UsbHostAllocator<'d>> { /* private fields */ }
Expand description

CDC-ECM USB host driver.

Implementations§

Source§

impl<'d, A: UsbHostAllocator<'d>> EcmHost<'d, A>

Source

pub fn into_embassy_net_device<const N_RX: usize, const N_TX: usize>( self, state: &'d mut State<N_RX, N_TX>, ethernet_address: [u8; 6], mtu: usize, ) -> (Runner<'d, A>, Device<'d>)

Obtain an embassy-net network device driver.

Source§

impl<'d, A: UsbHostAllocator<'d>> EcmHost<'d, A>

Source

pub fn new( alloc: &A, enum_info: &EnumerationInfo, config_desc: &[u8], ) -> Result<Self, EcmError>

Create and initialize a new CDC-ECM host driver.

Source

pub fn info(&self) -> &EcmInfo

Return descriptor-located info.

Source

pub async fn enable(&mut self) -> Result<(), EcmError>

Enable the network interface: selects the active data alternate setting and configures packet filters (directed + broadcast + multicast).

Source

pub async fn read_packet(&mut self, buf: &mut [u8]) -> Result<usize, EcmError>

Read an incoming Ethernet frame.

Source

pub async fn write_packet(&mut self, data: &[u8]) -> Result<(), EcmError>

Send an outgoing Ethernet frame.

Source

pub async fn poll_notification( &mut self, buf: &mut [u8], ) -> Result<usize, EcmError>

Poll for an interrupt notification packet.

Source

pub fn split(self) -> (EcmHostSender<'d, A>, EcmHostReceiver<'d, A>)

Split into independent sender and receiver halves.

Auto Trait Implementations§

§

impl<'d, A> Forget for EcmHost<'d, A>

§

impl<'d, A> Freeze for EcmHost<'d, A>

§

impl<'d, A> Move for EcmHost<'d, A>

§

impl<'d, A> RefUnwindSafe for EcmHost<'d, A>

§

impl<'d, A> Send for EcmHost<'d, A>

§

impl<'d, A> Sync for EcmHost<'d, A>

§

impl<'d, A> Unpin for EcmHost<'d, A>

§

impl<'d, A> UnsafeUnpin for EcmHost<'d, A>

§

impl<'d, A> UnwindSafe for EcmHost<'d, 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>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.