pub struct UsbHost<D: UsbHostDriver> { /* private fields */ }Expand description
USB host controller.
Manages device connection, enumeration, and class driver binding.
Implementations§
Source§impl<D: UsbHostDriver> UsbHost<D>
impl<D: UsbHostDriver> UsbHost<D>
Sourcepub fn free_address(&mut self, addr: u8)
pub fn free_address(&mut self, addr: u8)
Release a previously allocated device address.
Sourcepub fn driver_mut(&mut self) -> &mut D
pub fn driver_mut(&mut self) -> &mut D
Get a mutable reference to the underlying driver.
Sourcepub async fn wait_for_connection(&mut self) -> Speed
pub async fn wait_for_connection(&mut self) -> Speed
Wait for a device to connect.
Issues a bus reset internally and returns the detected speed.
Sourcepub async fn enumerate(
&mut self,
speed: Speed,
config_buf: &mut [u8],
) -> Result<(DeviceDescriptor, u8, usize), EnumerationError>
pub async fn enumerate( &mut self, speed: Speed, config_buf: &mut [u8], ) -> Result<(DeviceDescriptor, u8, usize), EnumerationError>
Enumerate a connected device.
Performs the standard enumeration sequence:
- Get device descriptor (first 8 bytes) to learn EP0 max packet size
- SET_ADDRESS to assign a unique address
- Get full device descriptor
- Get configuration descriptor
- SET_CONFIGURATION
Returns the device descriptor, assigned address, and bytes written to config_buf.
Auto Trait Implementations§
impl<D> Freeze for UsbHost<D>where
D: Freeze,
impl<D> RefUnwindSafe for UsbHost<D>where
D: RefUnwindSafe,
impl<D> Send for UsbHost<D>where
D: Send,
impl<D> Sync for UsbHost<D>where
D: Sync,
impl<D> Unpin for UsbHost<D>where
D: Unpin,
impl<D> UnwindSafe for UsbHost<D>where
D: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more