pub trait VbusDetect {
// Required methods
fn is_usb_detected(&self) -> bool;
async fn wait_power_ready(&mut self) -> Result<(), ()>;
}
Expand description
Trait for detecting USB VBUS power.
There are multiple ways to detect USB power. The behavior here provides a hook into determining whether it is.
Required Methods§
sourcefn is_usb_detected(&self) -> bool
fn is_usb_detected(&self) -> bool
Report whether power is detected.
This is indicated by the USBREGSTATUS.VBUSDETECT
register, or the
USBDETECTED
, USBREMOVED
events from the POWER
peripheral.
sourceasync fn wait_power_ready(&mut self) -> Result<(), ()>
async fn wait_power_ready(&mut self) -> Result<(), ()>
Wait until USB power is ready.
USB power ready is indicated by the USBREGSTATUS.OUTPUTRDY
register, or the
USBPWRRDY
event from the POWER
peripheral.
Object Safety§
This trait is not object safe.