/* Sets the device address to the given value.  */
void USBD_SetAddress(unsigned char address)
/* Sets the device address to the given value.  */
void USBD_SetAddress(unsigned char address)
{
    TRACE_INFO_WP("SetAddr(%d) ", address);
    UDP->UDP_FADDR = UDP_FADDR_FEN | (address & UDP_FADDR_FADD_Msk);
    if (address == 0) {
        UDP->UDP_GLB_STAT = 0;
        deviceState = USBD_STATE_DEFAULT;
    }
    else {
        UDP->UDP_GLB_STAT = UDP_GLB_STAT_FADDEN;
        deviceState = USBD_STATE_ADDRESS;
    }
}