diff options
| author | hathach <[email protected]> | 2024-10-11 12:58:18 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2024-10-11 13:41:53 +0700 |
| commit | 92602b9de3675c2d3e240bcd0838082e1a07b13b (patch) | |
| tree | 69c07f1d49d9d37223a679f1956ba7c8588bdcb6 /src/device/usbd.h | |
| parent | a4fb8354e41b2604f66e7da22afa292b1a44f0a2 (diff) | |
change tusb_init(), tusb_rhport_init() to use init struct for expandability
Diffstat (limited to 'src/device/usbd.h')
| -rw-r--r-- | src/device/usbd.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/device/usbd.h b/src/device/usbd.h index 7913096e3..05eb0173f 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -37,8 +37,21 @@ extern "C" { // Application API //--------------------------------------------------------------------+ +// New API to replace tud_init() to init device stack on specific roothub port +bool tud_rhport_init(const tusb_rhport_init_t* rh_init); + // Init device stack on roothub port -bool tud_init (uint8_t rhport); +#if TUSB_VERSION_NUMBER > 2000 // 0.20.0 +TU_ATTR_DEPRECATED("Please use tusb_init(tusb_rhport_init_t*) instead") +#endif +TU_ATTR_ALWAYS_INLINE static inline bool tud_init (uint8_t rhport) { + const tusb_rhport_init_t rh_init = { + .rhport = rhport, + .role = TUSB_ROLE_DEVICE, + .speed = TUD_OPT_HIGH_SPEED ? TUSB_SPEED_HIGH : TUSB_SPEED_FULL + }; + return tud_rhport_init(&rh_init); +} // Deinit device stack on roothub port bool tud_deinit(uint8_t rhport); |
