summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWilliam D. Jones <[email protected]>2019-09-02 21:00:30 -0400
committerWilliam D. Jones <[email protected]>2019-09-02 21:00:30 -0400
commit921016760354599ada9f4208d96b6413b0562419 (patch)
treeffa00f431800dcf6995612bef6205929c32f839f /src
parent0d0b802ee01537a98be89c6760684fe1a221c81a (diff)
stm32h7: Implement dcd_set_address.
Diffstat (limited to 'src')
-rw-r--r--src/portable/st/stm32h7/dcd_stm32h7.c8
1 files changed, 7 insertions, 1 deletions
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)