1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/tinyusb: fix USB speed selection for STM32

This commit is contained in:
Gunar Schorcht 2022-11-17 14:07:38 +01:00
parent f60141a5be
commit 4b7578b2eb
2 changed files with 13 additions and 5 deletions

View File

@ -83,12 +83,24 @@ extern "C" {
#define TINYUSB_TUH_RHPORT 1
#endif
/*
* Only if the module `periph_usbdev_hs_utmi` or `periph_usbdev_hs_ulpi` is
* enabled for the HS port, a HS PHY is used and OPT_MODE_HIGH_SPEED must be
* set. Otherwise, the built-in on-chip FS PHY is used and
* OPT_MODE_DEFAULT_SPEED should be set so tinyUSB can select the correct speed.
*/
#if (MODULE_PERIPH_USBDEV_HS_UTMI || MODULE_PERIPH_USBDEV_HS_ULPI)
#define TINYUSB_OPT_SPEED OPT_MODE_HIGH_SPEED
#else
#define TINYUSB_OPT_SPEED OPT_MODE_DEFAULT_SPEED
#endif
/*
* Since tinyUSB does not support host mode for STM32 MCUs yet, only
* OPT_MODE_DEVICE is enabled for the port. Once tinyUSB supports the host mode,
* OPT_MODE_HOST could be added to CFG_TUSB_RHPORT1_MODE
*/
#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | TINYUSB_OPT_SPEED)
#else

View File

@ -251,10 +251,6 @@
*/
#define CFG_TUD_ENABLED MODULE_TINYUSB_DEVICE
#ifndef CFG_TUD_MAX_SPEED
#define CFG_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED
#endif
#ifndef CFG_TUD_ENDPOINT0_SIZE
#define CFG_TUD_ENDPOINT0_SIZE CONFIG_TUSBD_EP0_SIZE
#endif