Struct stm32_hal2::usb::UsbBus [−][src]
pub struct UsbBus<USB> { /* fields omitted */ }
USB peripheral driver for STM32 microcontrollers.
Implementations
impl<USB> UsbBus<USB> where
USB: UsbPeripheral,
[src]
impl<USB> UsbBus<USB> where
USB: UsbPeripheral,
[src]pub fn new(peripheral: USB) -> UsbBusAllocator<UsbBus<USB>>
[src]
Constructs a new USB peripheral driver.
pub fn free(self) -> USB
[src]
pub fn force_reenumeration<F>(&self, disconnect: F) where
F: FnOnce(),
[src]
F: FnOnce(),
Simulates a disconnect from the USB bus, causing the host to reset and re-enumerate the device.
Mostly used for development. By calling this at the start of your program ensures that the host re-enumerates your device after a new program has been flashed.
disconnect
parameter is used to provide a custom disconnect function.
This function will be called with USB peripheral powered down
and interrupts disabled.
It should perform disconnect in a platform-specific way.
Trait Implementations
impl<USB> UsbBus for UsbBus<USB> where
USB: UsbPeripheral,
[src]
impl<USB> UsbBus for UsbBus<USB> where
USB: UsbPeripheral,
[src]pub fn alloc_ep(
&mut self,
ep_dir: UsbDirection,
ep_addr: Option<EndpointAddress>,
ep_type: EndpointType,
max_packet_size: u16,
_interval: u8
) -> Result<EndpointAddress, UsbError>
[src]
&mut self,
ep_dir: UsbDirection,
ep_addr: Option<EndpointAddress>,
ep_type: EndpointType,
max_packet_size: u16,
_interval: u8
) -> Result<EndpointAddress, UsbError>
pub fn enable(&mut self)
[src]
pub fn reset(&self)
[src]
pub fn set_device_address(&self, addr: u8)
[src]
pub fn poll(&self) -> PollResult
[src]
pub fn write(
&self,
ep_addr: EndpointAddress,
buf: &[u8]
) -> Result<usize, UsbError>
[src]
&self,
ep_addr: EndpointAddress,
buf: &[u8]
) -> Result<usize, UsbError>
pub fn read(
&self,
ep_addr: EndpointAddress,
buf: &mut [u8]
) -> Result<usize, UsbError>
[src]
&self,
ep_addr: EndpointAddress,
buf: &mut [u8]
) -> Result<usize, UsbError>