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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.