Struct embassy_stm32::usb_otg::Config
source · #[non_exhaustive]pub struct Config {
pub vbus_detection: bool,
}
Expand description
USB driver config.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.vbus_detection: bool
Enable VBUS detection.
The USB spec requires USB devices monitor for USB cable plug/unplug and react accordingly. This is done by checkihg whether there is 5V on the VBUS pin or not.
If your device is bus-powered (powers itself from the USB host via VBUS), then this is optional. (if there’s no power in VBUS your device would be off anyway, so it’s fine to always assume there’s power in VBUS, i.e. the USB cable is always plugged in.)
If your device is self-powered (i.e. it gets power from a source other than the USB cable, and therefore can stay powered through USB cable plug/unplug) then you MUST set this to true.
If you set this to true, you must connect VBUS to PA9 for FS, PB13 for HS, possibly with a voltage divider. See ST application note AN4879 and the reference manual for more details.