After receiving the corresponding acknowledgment event (i.e. USBD.EVENTS_USBEVENT with USBD.EVENTCAUSE.READY=1 in case of enabling or USBD->EVENTCAUSE.USBWUALLOWED=1 in case of wakeup), apply the following code: