diff options
author | Damien George <damien@micropython.org> | 2024-08-07 14:20:35 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-09-26 23:13:50 +1000 |
commit | b0ba151102a6c1b2e0e4c419c6482a64677c9b40 (patch) | |
tree | 157bf2dd1070c8e39cea533b9d87a21a1419c38c /shared/tinyusb | |
parent | 09fa90ed4718367eb9d7a2340d4f3e65da775e6b (diff) | |
download | micropython-b0ba151102a6c1b2e0e4c419c6482a64677c9b40.tar.gz micropython-b0ba151102a6c1b2e0e4c419c6482a64677c9b40.zip |
shared/tinyusb: Use new persistent-tx-fifo configure interface.
The old configuration option has been removed from TinyUSB.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'shared/tinyusb')
-rw-r--r-- | shared/tinyusb/mp_usbd.h | 10 | ||||
-rw-r--r-- | shared/tinyusb/mp_usbd_runtime.c | 6 | ||||
-rw-r--r-- | shared/tinyusb/tusb_config.h | 1 |
3 files changed, 13 insertions, 4 deletions
diff --git a/shared/tinyusb/mp_usbd.h b/shared/tinyusb/mp_usbd.h index 31234566b6..5c8f2a6095 100644 --- a/shared/tinyusb/mp_usbd.h +++ b/shared/tinyusb/mp_usbd.h @@ -40,6 +40,13 @@ #include "device/dcd.h" #endif +// Initialise TinyUSB device. +static inline void mp_usbd_init_tud(void) { + tusb_init(); + tud_cdc_configure_fifo_t cfg = { .rx_persistent = 0, .tx_persistent = 1 }; + tud_cdc_configure_fifo(&cfg); +} + // Run the TinyUSB device task void mp_usbd_task(void); @@ -125,7 +132,8 @@ inline static bool mp_usb_device_builtin_enabled(const mp_obj_usb_device_t *usbd static inline void mp_usbd_init(void) { // Without runtime USB support, this can be a thin wrapper wrapper around tusb_init() - tusb_init(); + // which is called in the below helper function. + mp_usbd_init_tud(); } #endif diff --git a/shared/tinyusb/mp_usbd_runtime.c b/shared/tinyusb/mp_usbd_runtime.c index 4955382577..a1eebeebd2 100644 --- a/shared/tinyusb/mp_usbd_runtime.c +++ b/shared/tinyusb/mp_usbd_runtime.c @@ -428,8 +428,10 @@ void mp_usbd_init(void) { } if (need_usb) { - tusb_init(); // Safe to call redundantly - tud_connect(); // Reconnect if mp_usbd_deinit() has disconnected + // The following will call tusb_init(), which is safe to call redundantly. + mp_usbd_init_tud(); + // Reconnect if mp_usbd_deinit() has disconnected. + tud_connect(); } } diff --git a/shared/tinyusb/tusb_config.h b/shared/tinyusb/tusb_config.h index d0c9f89ec6..0cc5ef0398 100644 --- a/shared/tinyusb/tusb_config.h +++ b/shared/tinyusb/tusb_config.h @@ -83,7 +83,6 @@ #ifndef CFG_TUD_CDC_TX_BUFSIZE #define CFG_TUD_CDC_TX_BUFSIZE ((CFG_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED) ? 512 : 256) #endif -#define CFG_TUD_CDC_PERSISTENT_TX_BUFF (1) #endif // MSC Configuration |