From 921016760354599ada9f4208d96b6413b0562419 Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Mon, 2 Sep 2019 21:00:30 -0400 Subject: [PATCH] stm32h7: Implement dcd_set_address. --- src/portable/st/stm32h7/dcd_stm32h7.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/portable/st/stm32h7/dcd_stm32h7.c b/src/portable/st/stm32h7/dcd_stm32h7.c index c1fc18e93..4aed4b5ae 100644 --- a/src/portable/st/stm32h7/dcd_stm32h7.c +++ b/src/portable/st/stm32h7/dcd_stm32h7.c @@ -190,7 +190,13 @@ void dcd_int_disable (uint8_t rhport) void dcd_set_address (uint8_t rhport, uint8_t dev_addr) { (void) rhport; - (void) dev_addr; + + USB_OTG_DeviceTypeDef * dev = DEVICE_BASE; + + dev->DCFG |= (dev_addr << USB_OTG_DCFG_DAD_Pos) & USB_OTG_DCFG_DAD_Msk; + + // Response with status after changing device address + dcd_edpt_xfer(rhport, tu_edpt_addr(0, TUSB_DIR_IN), NULL, 0); } void dcd_set_config (uint8_t rhport, uint8_t config_num)