Struct nrf52833_hal::usbd::Usbd [−]
pub struct Usbd<T> where
T: UsbPeripheral, { /* fields omitted */ }
Expand description
USB device implementation.
Implementations
impl<T> Usbd<T> where
T: UsbPeripheral,
impl<T> Usbd<T> where
T: UsbPeripheral,
Creates a new USB bus, taking ownership of the raw peripheral.
Parameters
periph
: The raw USBD peripheral.
pub fn device_address(&self) -> u8
pub fn device_address(&self) -> u8
Fetches the address assigned to the device (only valid when device is configured).
Trait Implementations
impl<T> UsbBus for Usbd<T> where
T: UsbPeripheral,
impl<T> UsbBus for Usbd<T> where
T: UsbPeripheral,
pub fn enable(&mut self)
pub 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
pub fn reset(&self)
pub 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 more
pub fn set_device_address(&self, _addr: u8)
pub fn set_device_address(&self, _addr: u8)
Sets the device USB address to addr
.
Writes a single packet of data to the specified endpoint and returns number of bytes actually written. Read more
Reads a single packet of data from the specified endpoint and returns the actual length of the packet. Read more
pub fn set_stalled(&self, ep_addr: EndpointAddress, stalled: bool)
pub fn set_stalled(&self, ep_addr: 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
pub fn is_stalled(&self, ep_addr: EndpointAddress) -> bool
pub fn is_stalled(&self, ep_addr: EndpointAddress) -> bool
Gets whether the STALL condition is set for an endpoint.
pub fn suspend(&self)
pub 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 more
pub fn resume(&self)
pub fn resume(&self)
Resumes from suspend mode. This may only be called after the peripheral has been previously suspended. Read more
pub fn poll(&self) -> PollResult
pub 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 more
pub fn force_reset(&self) -> Result<(), UsbError>
pub 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
Indicates that set_device_address
must be called before accepting the corresponding
control transfer, not after. Read more
Auto Trait Implementations
impl<T> !RefUnwindSafe for Usbd<T>
impl<T> UnwindSafe for Usbd<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Performs the conversion.
Performs the conversion.
Casts the value.
Casts the value.
Casts the value.
Casts the value.