How to sleep when USB_VBUS on stm32f105 is low?
I have a self-powered device. It appears as a USB CDC device /dev/ttyACM0, when plugged into a Linux host. The device port is wired to USB_VBUS, so that pin will only be high when connected to a USB host.
I would like to detect the presence of the USB cable, so that the device can sleep if there is no cable and other conditions are met.
- How can I detect the presence of the USB cable? I'm using CubeIDE and the HAL.
- How can I put the STM32 to sleep in such a way that it will wake up when the USB cable is plugged back in?
