embassy-usb-host

Crates

git

Versions

default

Flavors

BusController

Struct BusController 

Source
pub struct BusController<'d, C: UsbHostController<'d>> { /* private fields */ }
Expand description

Bus-level controller for a single root USB controller.

Owns the UsbHostController implementation and exposes the bus-wide operations that must be serialised against each other (root-port event waiting, bus reset).

Pipe allocation and device enumeration live on the companion BusHandle returned alongside a BusController by the bus constructor.

Implementations§

Source§

impl<'d, C: UsbHostController<'d>> BusController<'d, C>

Source

pub fn controller(&self) -> &C

Get a reference to the underlying controller.

Source

pub fn controller_mut(&mut self) -> &mut C

Get a mutable reference to the underlying controller.

Source

pub async fn wait_for_device_event(&mut self) -> DeviceEvent

Wait for a root-port attach/detach.

On attach, the implementation drives a bus reset to completion before returning and reports the speed the device settled on.

Source

pub async fn wait_for_connection(&mut self) -> Speed

Wait for a device to connect on the root port.

Issues a bus reset internally and returns the detected speed. Spurious disconnects, overcurrent events, and other non-attach events are silently absorbed.

Auto Trait Implementations§

§

impl<'d, C> Freeze for BusController<'d, C>
where C: Freeze,

§

impl<'d, C> RefUnwindSafe for BusController<'d, C>
where C: RefUnwindSafe,

§

impl<'d, C> Send for BusController<'d, C>
where C: Send,

§

impl<'d, C> Sync for BusController<'d, C>
where C: Sync,

§

impl<'d, C> Unpin for BusController<'d, C>
where C: Unpin,

§

impl<'d, C> UnwindSafe for BusController<'d, C>
where C: UnwindSafe,

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

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.