USB: use OTG1/OTG2 for serial over USB depending on which enabled (#3757)

This commit is contained in:
Andrey G 2022-01-09 00:33:48 +03:00 committed by GitHub
parent 29ec6d7381
commit 74b9ce8a8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -26,10 +26,12 @@
#endif
#endif
#if STM32_USB_USE_OTG2
#if STM32_USB_USE_OTG1
USBDriver *usb_driver = &USBD1;
#elif STM32_USB_USE_OTG2
USBDriver *usb_driver = &USBD2;
#else
USBDriver *usb_driver = &USBD1;
#error MSD needs OTG1 or OTG2 to be enabled
#endif
// One block buffer per LUN

View File

@ -451,7 +451,13 @@ const USBConfig usbcfg = {
* Serial over USB driver configuration.
*/
const SerialUSBConfig serusbcfg = {
#if STM32_USB_USE_OTG1
.usbp = &USBD1,
#elif STM32_USB_USE_OTG2
.usbp = &USBD2,
#else
#error Serial over USB needs OTG1 or OTG2 to be enabled
#endif
.bulk_in = USBD1_DATA_REQUEST_EP,
.bulk_out = USBD1_DATA_AVAILABLE_EP,
.int_in = USBD1_INTERRUPT_REQUEST_EP