Struct atsamd_hal::usb::UsbBus
source · [−]pub struct UsbBus { /* private fields */ }
Implementations
sourceimpl UsbBus
impl UsbBus
sourcepub fn enable_sof_interrupt(&self)
pub fn enable_sof_interrupt(&self)
Enables the Start Of Frame (SOF) interrupt
sourcepub fn disable_sof_interrupt(&self)
pub fn disable_sof_interrupt(&self)
Disables the Start Of Frame (SOF) interrupt
sourcepub fn check_sof_interrupt(&self) -> bool
pub fn check_sof_interrupt(&self) -> bool
Checks, and clears if set, the Start Of Frame (SOF) interrupt flag
Trait Implementations
sourceimpl UsbBus for UsbBus
impl UsbBus for UsbBus
sourcefn enable(&mut self)
fn enable(&mut self)
Enables and initializes the USB peripheral. Soon after enabling the device will be reset, so
there is no need to perform a USB reset in this method. Read more
sourcefn reset(&self)
fn reset(&self)
Called when the host resets the device. This will be soon called after
poll
returns PollResult::Reset
. This method should
reset the state of all endpoints and peripheral flags back to a state suitable for
enumeration, as well as ensure that all endpoints previously allocated with alloc_ep are
initialized as specified. Read moresourcefn suspend(&self)
fn suspend(&self)
Causes the USB peripheral to enter USB suspend mode, lowering power consumption and
preparing to detect a USB wakeup event. This will be called after
poll
returns PollResult::Suspend
. The device will
continue be polled, and it shall return a value other than Suspend
from poll
when it no
longer detects the suspend condition. Read moresourcefn resume(&self)
fn resume(&self)
Resumes from suspend mode. This may only be called after the peripheral has been previously
suspended. Read more
sourcefn alloc_ep(
&mut self,
dir: UsbDirection,
addr: Option<EndpointAddress>,
ep_type: EndpointType,
max_packet_size: u16,
interval: u8
) -> UsbResult<EndpointAddress>
fn alloc_ep(
&mut self,
dir: UsbDirection,
addr: Option<EndpointAddress>,
ep_type: EndpointType,
max_packet_size: u16,
interval: u8
) -> UsbResult<EndpointAddress>
sourcefn set_device_address(&self, addr: u8)
fn set_device_address(&self, addr: u8)
Sets the device USB address to
addr
.sourcefn poll(&self) -> PollResult
fn poll(&self) -> PollResult
Gets information about events and incoming data. Usually called in a loop or from an
interrupt handler. See the
PollResult
struct for more information. Read moresourcefn write(&self, ep: EndpointAddress, buf: &[u8]) -> UsbResult<usize>
fn write(&self, ep: EndpointAddress, buf: &[u8]) -> UsbResult<usize>
Writes a single packet of data to the specified endpoint and returns number of bytes
actually written. Read more
sourcefn read(&self, ep: EndpointAddress, buf: &mut [u8]) -> UsbResult<usize>
fn read(&self, ep: EndpointAddress, buf: &mut [u8]) -> UsbResult<usize>
Reads a single packet of data from the specified endpoint and returns the actual length of
the packet. Read more
sourcefn set_stalled(&self, ep: EndpointAddress, stalled: bool)
fn set_stalled(&self, ep: EndpointAddress, stalled: bool)
Sets or clears the STALL condition for an endpoint. If the endpoint is an OUT endpoint, it
should be prepared to receive data again. Read more
sourcefn is_stalled(&self, ep: EndpointAddress) -> bool
fn is_stalled(&self, ep: EndpointAddress) -> bool
Gets whether the STALL condition is set for an endpoint.
sourcefn force_reset(&self) -> Result<(), UsbError>
fn force_reset(&self) -> Result<(), UsbError>
Simulates a disconnect from the USB bus, causing the host to reset and re-enumerate the
device. Read more
sourceconst QUIRK_SET_ADDRESS_BEFORE_STATUS: bool = false
const QUIRK_SET_ADDRESS_BEFORE_STATUS: bool = false
Indicates that
set_device_address
must be called before accepting the corresponding
control transfer, not after. Read moreAuto Trait Implementations
impl !RefUnwindSafe for UsbBus
impl Send for UsbBus
impl Sync for UsbBus
impl Unpin for UsbBus
impl !UnwindSafe for UsbBus
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