diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-08-30 01:03:28 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-08-30 12:15:45 -0400 |
commit | 5e3acff8c734ec4413ba12e021089dc6fea1f53e (patch) | |
tree | 60e17bb2630deb977f4346cd1555dbb2f7817896 | |
parent | 7229680227e1b8f06177f3f3085c81e50d8665da (diff) | |
download | kutter-5e3acff8c734ec4413ba12e021089dc6fea1f53e.tar.gz kutter-5e3acff8c734ec4413ba12e021089dc6fea1f53e.tar.xz kutter-5e3acff8c734ec4413ba12e021089dc6fea1f53e.zip |
stm32: No need to clear the usbotg address on reset
The controller automatically clears the address.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/stm32/usbotg.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/stm32/usbotg.c b/src/stm32/usbotg.c index 35689afa..99837a09 100644 --- a/src/stm32/usbotg.c +++ b/src/stm32/usbotg.c @@ -245,7 +245,8 @@ usb_stall_ep0(void) void usb_set_address(uint_fast8_t addr) { - OTGD->DCFG |= addr << USB_OTG_DCFG_DAD_Pos; + OTGD->DCFG = ((OTGD->DCFG & ~USB_OTG_DCFG_DAD_Msk) + | (addr << USB_OTG_DCFG_DAD_Pos)); usb_send_ep0(NULL, 0); usb_notify_ep0(); } @@ -312,9 +313,6 @@ usb_reset(void) | (0x02 << USB_OTG_DIEPCTL_EPTYP_Pos) | USB_OTG_DIEPCTL_SD0PID_SEVNFRM | (USB_CDC_EP_BULK_IN << USB_OTG_DIEPCTL_TXFNUM_Pos) | (USB_CDC_EP_BULK_IN_SIZE << USB_OTG_DIEPCTL_MPSIZ_Pos)); - - // Set address to zero - OTGD->DCFG &= ~USB_OTG_DCFG_DAD; } // Handle a USB disconnect |