aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32
diff options
context:
space:
mode:
Diffstat (limited to 'src/stm32')
-rw-r--r--src/stm32/usbotg.c6
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