Struct usb_device::bus::UsbBusAllocator
source · pub struct UsbBusAllocator<B: UsbBus> { /* private fields */ }
Expand description
Helper type used for UsbBus resource allocation and initialization.
Implementations
sourceimpl<B: UsbBus> UsbBusAllocator<B>
impl<B: UsbBus> UsbBusAllocator<B>
sourcepub fn new(bus: B) -> UsbBusAllocator<B>
pub fn new(bus: B) -> UsbBusAllocator<B>
Creates a new UsbBusAllocator
that wraps the provided UsbBus
. Usually only called by
USB driver implementations.
sourcepub fn interface(&self) -> InterfaceNumber
pub fn interface(&self) -> InterfaceNumber
Allocates a new interface number.
sourcepub fn string(&self) -> StringIndex
pub fn string(&self) -> StringIndex
Allocates a new string index.
sourcepub fn alloc<'a, D: EndpointDirection>(
&self,
ep_addr: Option<EndpointAddress>,
ep_type: EndpointType,
max_packet_size: u16,
interval: u8
) -> Result<Endpoint<'_, B, D>>
pub fn alloc<'a, D: EndpointDirection>(
&self,
ep_addr: Option<EndpointAddress>,
ep_type: EndpointType,
max_packet_size: u16,
interval: u8
) -> Result<Endpoint<'_, B, D>>
Allocates an endpoint with the specified direction and address.
This directly delegates to UsbBus::alloc_ep
, so see that method for details. This should
rarely be needed by classes.
sourcepub fn control<D: EndpointDirection>(
&self,
max_packet_size: u16
) -> Endpoint<'_, B, D>
pub fn control<D: EndpointDirection>(
&self,
max_packet_size: u16
) -> Endpoint<'_, B, D>
Allocates a control endpoint.
This crate implements the control state machine only for endpoint 0. If classes want to support control requests in other endpoints, the state machine must be implemented manually. This should rarely be needed by classes.
Arguments
max_packet_size
- Maximum packet size in bytes. Must be one of 8, 16, 32 or 64.
Auto Trait Implementations
impl<B> !RefUnwindSafe for UsbBusAllocator<B>
impl<B> Send for UsbBusAllocator<B>where
B: Send,
impl<B> !Sync for UsbBusAllocator<B>
impl<B> Unpin for UsbBusAllocator<B>where
B: Unpin,
impl<B> UnwindSafe for UsbBusAllocator<B>where
B: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more