aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports')
-rw-r--r--os/hal/ports/AVR/hal_usb_lld.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/os/hal/ports/AVR/hal_usb_lld.c b/os/hal/ports/AVR/hal_usb_lld.c
index e6fb42f1e..1185a48db 100644
--- a/os/hal/ports/AVR/hal_usb_lld.c
+++ b/os/hal/ports/AVR/hal_usb_lld.c
@@ -445,7 +445,12 @@ void usb_lld_stop(USBDriver *usbp) {
#if AVR_USB_USE_USB1 == TRUE
if (&USBD1 == usbp) {
/* Disable and clear transition interrupts */
+#if !defined(__AVR_ATmega32U4__)
USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
+#else
+ USBCON &= ~(1 << VBUSTE);
+#endif
+
USBINT = 0;
/* Disable and clear device interrupts */
@@ -481,7 +486,10 @@ void usb_lld_reset(USBDriver *usbp) {
/* Set Device mode */
/* TODO: Support HOST/OTG mode if needed */
+
+#if !defined(__AVR_ATmega32U4__)
UHWCON |= (1 << UIMOD);
+#endif
/* Set FULL 12mbps speed */
UDCON &= ~(1 << LSM);