add usb re-plug functionality to F072

sipo
Ondřej Hruška 7 years ago
parent 0146c3332f
commit 2f0db41fb9
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 1
      USB/usb_device.h
  2. 10
      platform/platform.c

@ -58,6 +58,7 @@
#include "usbd_def.h"
extern USBD_HandleTypeDef hUsbDeviceFS;
extern PCD_HandleTypeDef hpcd_USB_FS;
/* USB_Device init function */
void MX_USB_DEVICE_Init(void);

@ -247,8 +247,14 @@ void plat_usb_reconnect(void)
{
// TODO add better reset methods available on different chips
// F103 doesn't have pull-up control, this is probably the best we can do
// This does not seem to trigger descriptors reload.
USBD_LL_Reset(&hUsbDeviceFS);
#if defined(GEX_PLAT_F072_DISCOVERY)
HAL_PCD_DevDisconnect(&hpcd_USB_FS);
osDelay(100);
HAL_PCD_DevConnect(&hpcd_USB_FS);
#else
// F103 doesn't have pull-up control
#endif
}

Loading…
Cancel
Save