embassy-nrf

Crates

git

Versions

nrf5340-app-ns

Flavors

embassy_nrf::usb::vbus_detect

Trait VbusDetect

source
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§

source

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.

source

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.

Implementors§