pub struct Driver<'d, T: Instance> { /* private fields */ }Expand description
USB driver.
Implementations§
Source§impl<'d, T: Instance> Driver<'d, T>
impl<'d, T: Instance> Driver<'d, T>
Sourcepub fn new_with_sof(
_usb: Peri<'d, T>,
dp: Peri<'d, impl DpPin<T>>,
dm: Peri<'d, impl DmPin<T>>,
sof: Peri<'d, impl SofPin<T>>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
) -> Self
pub fn new_with_sof( _usb: Peri<'d, T>, dp: Peri<'d, impl DpPin<T>>, dm: Peri<'d, impl DmPin<T>>, sof: Peri<'d, impl SofPin<T>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self
Create a new USB driver with start-of-frame (SOF) output.
Sourcepub fn new_with_sof_and_vbus(
_usb: Peri<'d, T>,
dp: Peri<'d, impl DpPin<T>>,
dm: Peri<'d, impl DmPin<T>>,
sof: Peri<'d, impl SofPin<T>>,
vbus: ExtiInput<'d, Async>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
) -> Self
pub fn new_with_sof_and_vbus( _usb: Peri<'d, T>, dp: Peri<'d, impl DpPin<T>>, dm: Peri<'d, impl DmPin<T>>, sof: Peri<'d, impl SofPin<T>>, vbus: ExtiInput<'d, Async>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self
Create a new USB driver with start-of-frame (SOF) output and VBUS detection.
Sourcepub fn new(
_usb: Peri<'d, T>,
dp: Peri<'d, impl DpPin<T>>,
dm: Peri<'d, impl DmPin<T>>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
) -> Self
pub fn new( _usb: Peri<'d, T>, dp: Peri<'d, impl DpPin<T>>, dm: Peri<'d, impl DmPin<T>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self
Create a new USB driver.
Sourcepub fn new_with_vbus(
_usb: Peri<'d, T>,
dp: Peri<'d, impl DpPin<T>>,
dm: Peri<'d, impl DmPin<T>>,
vbus: ExtiInput<'d, Async>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
) -> Self
pub fn new_with_vbus( _usb: Peri<'d, T>, dp: Peri<'d, impl DpPin<T>>, dm: Peri<'d, impl DmPin<T>>, vbus: ExtiInput<'d, Async>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self
Create a new USB driver with VBUS detection through an EXTI input.
Wire VBUS to a GPIO: this USB peripheral only has USB_DP, USB_DM and USB_NOE pins and no VBUS input (RM0444 37.4.2), and its suspend event only means the host stopped traffic for 3 ms (RM0444 37.5.7), not that the cable was removed.
When vbus goes low, Bus::poll reports Event::PowerRemoved and the endpoints are
disabled, so pending reads and writes return EndpointError::Disabled. When it goes high
again, Event::PowerDetected is reported and the USB stack re-enumerates.
Trait Implementations§
Source§impl<'d, T: Instance> Driver<'d> for Driver<'d, T>
impl<'d, T: Instance> Driver<'d> for Driver<'d, T>
Source§type EndpointOut = Endpoint<'d, T, Out>
type EndpointOut = Endpoint<'d, T, Out>
Type of the OUT endpoints for this driver.
Source§type EndpointIn = Endpoint<'d, T, In>
type EndpointIn = Endpoint<'d, T, In>
Type of the IN endpoints for this driver.
Source§type ControlPipe = ControlPipe<'d, T>
type ControlPipe = ControlPipe<'d, T>
Type of the control pipe for this driver.
Source§fn alloc_endpoint_in(
&mut self,
ep_type: EndpointType,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval_ms: u8,
) -> Result<Self::EndpointIn, EndpointAllocError>
fn alloc_endpoint_in( &mut self, ep_type: EndpointType, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval_ms: u8, ) -> Result<Self::EndpointIn, EndpointAllocError>
Allocates an IN endpoint. Read more
Source§fn alloc_endpoint_out(
&mut self,
ep_type: EndpointType,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval_ms: u8,
) -> Result<Self::EndpointOut, EndpointAllocError>
fn alloc_endpoint_out( &mut self, ep_type: EndpointType, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval_ms: u8, ) -> Result<Self::EndpointOut, EndpointAllocError>
Allocates an OUT endpoint. Read more
Source§fn alloc_endpoint_bulk_out_double_buffered(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
) -> Result<Self::EndpointOut, EndpointAllocError>
fn alloc_endpoint_bulk_out_double_buffered( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, ) -> Result<Self::EndpointOut, EndpointAllocError>
Allocates a double-buffered bulk OUT endpoint. Read more
Source§fn alloc_endpoint_bulk_in_double_buffered(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
) -> Result<Self::EndpointIn, EndpointAllocError>
fn alloc_endpoint_bulk_in_double_buffered( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, ) -> Result<Self::EndpointIn, EndpointAllocError>
Allocates a double-buffered bulk IN endpoint. Read more
Auto Trait Implementations§
impl<'d, T> !UnwindSafe for Driver<'d, T>
impl<'d, T> Freeze for Driver<'d, T>
impl<'d, T> RefUnwindSafe for Driver<'d, T>
impl<'d, T> Send for Driver<'d, T>
impl<'d, T> Sync for Driver<'d, T>
impl<'d, T> Unpin for Driver<'d, T>
impl<'d, T> UnsafeUnpin for Driver<'d, T>
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