According to USB standard Vbus sensing is the intended way to change the state of USB device when USB cable is connected to the USB Host if USB device is self powered .
Unfortunately USB examples for SAM E70/V71 family MCU , provided in the START using ASF4 library do not handle Vbus change event. Even examples made for SAM V71 Xplained Ultra do not use Vbus sensing although that board has the GPIO pin wired to USB Vbus for sensing. START USB device configuration does not even have option to choose Vbus sensing even though we can choose self-powered USB device with remote wakeup which essentially implies need to change the USB state to "POWERED" when cable plugged in using Vbus sensing.
I can assign any GPIO pin as a digital input to be used for Vbus sensing and generate interrupt but how to register it to the USB device Callback event and create a handle for a USB_EV_VBUS event and what that Callback handle should do to change the USB state ?
Can anybody point me to an example of using Vbus sensing for USB connection change event in ASF4?
Correction:
the question should be re-phrased because GPIO pin state which senses the change of Vbus triggers it's own Interrupt (not USB device interrupt) , which in turn should call USB driver routines to change the USB state. So the correct question is what USB driver APIs should be called to change the USB state from within GPIO Interrupt ISR upon the Vbus change?