+//*----------------------------------------------------------------------------\r
+//* \fn AT91F_USB_Disable\r
+//* \brief This function deactivates the USB device\r
+//*----------------------------------------------------------------------------\r
+void usb_disable() {\r
+ // Disconnect and reconnect USB controller for 100ms\r
+ AT91C_BASE_PIOA->PIO_ODR = AT91C_PIO_PA24;\r
+ SpinDelay(100);\r
+ \r
+ // Clear all lingering interrupts\r
+ if(pUdp->UDP_ISR & AT91C_UDP_ENDBUSRES) {\r
+ pUdp->UDP_ICR = AT91C_UDP_ENDBUSRES;\r
+ }\r
+}\r
+\r