[−][src]Struct usb_device::bus::UsbBusAllocator
Helper type used for UsbBus resource allocation and initialization.
Methods
impl<B: UsbBus> UsbBusAllocator<B>
[src]
pub fn new(bus: B) -> UsbBusAllocator<B>
[src]
Creates a new UsbBusAllocator
that wraps the provided UsbBus
. Usually only called by
USB driver implementations.
pub fn interface(&self) -> InterfaceNumber
[src]
Allocates a new interface number.
pub fn string(&self) -> StringIndex
[src]
Allocates a new string index.
pub fn alloc<'a, D: EndpointDirection>(
&self,
ep_addr: Option<EndpointAddress>,
ep_type: EndpointType,
max_packet_size: u16,
interval: u8
) -> Result<Endpoint<B, D>>
[src]
&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. In most
cases classes should call the endpoint type specific methods instead.
pub fn control<D: EndpointDirection>(
&self,
max_packet_size: u16
) -> Endpoint<B, D>
[src]
&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.
Panics
Panics if endpoint allocation fails, because running out of endpoints or memory is not feasibly recoverable.
pub fn bulk<D: EndpointDirection>(&self, max_packet_size: u16) -> Endpoint<B, D>
[src]
Allocates a bulk endpoint.
Arguments
max_packet_size
- Maximum packet size in bytes. Must be one of 8, 16, 32 or 64.
Panics
Panics if endpoint allocation fails, because running out of endpoints or memory is not feasibly recoverable.
pub fn interrupt<D: EndpointDirection>(
&self,
max_packet_size: u16,
interval: u8
) -> Endpoint<B, D>
[src]
&self,
max_packet_size: u16,
interval: u8
) -> Endpoint<B, D>
Allocates an interrupt endpoint.
max_packet_size
- Maximum packet size in bytes. Cannot exceed 64 bytes.
Panics
Panics if endpoint allocation fails, because running out of endpoints or memory is not feasibly recoverable.
Auto Trait Implementations
impl<B> Unpin for UsbBusAllocator<B> where
B: Unpin,
B: Unpin,
impl<B> Send for UsbBusAllocator<B> where
B: Send,
B: Send,
impl<B> !Sync for UsbBusAllocator<B>
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,