Skip to content

Commit b0ba151

Browse files
committed
shared/tinyusb: Use new persistent-tx-fifo configure interface.
The old configuration option has been removed from TinyUSB. Signed-off-by: Damien George <[email protected]>
1 parent 09fa90e commit b0ba151

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

shared/tinyusb/mp_usbd.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040
#include "device/dcd.h"
4141
#endif
4242

43+
// Initialise TinyUSB device.
44+
static inline void mp_usbd_init_tud(void) {
45+
tusb_init();
46+
tud_cdc_configure_fifo_t cfg = { .rx_persistent = 0, .tx_persistent = 1 };
47+
tud_cdc_configure_fifo(&cfg);
48+
}
49+
4350
// Run the TinyUSB device task
4451
void mp_usbd_task(void);
4552

@@ -125,7 +132,8 @@ inline static bool mp_usb_device_builtin_enabled(const mp_obj_usb_device_t *usbd
125132

126133
static inline void mp_usbd_init(void) {
127134
// Without runtime USB support, this can be a thin wrapper wrapper around tusb_init()
128-
tusb_init();
135+
// which is called in the below helper function.
136+
mp_usbd_init_tud();
129137
}
130138

131139
#endif

shared/tinyusb/mp_usbd_runtime.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,10 @@ void mp_usbd_init(void) {
428428
}
429429

430430
if (need_usb) {
431-
tusb_init(); // Safe to call redundantly
432-
tud_connect(); // Reconnect if mp_usbd_deinit() has disconnected
431+
// The following will call tusb_init(), which is safe to call redundantly.
432+
mp_usbd_init_tud();
433+
// Reconnect if mp_usbd_deinit() has disconnected.
434+
tud_connect();
433435
}
434436
}
435437

shared/tinyusb/tusb_config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
#ifndef CFG_TUD_CDC_TX_BUFSIZE
8484
#define CFG_TUD_CDC_TX_BUFSIZE ((CFG_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED) ? 512 : 256)
8585
#endif
86-
#define CFG_TUD_CDC_PERSISTENT_TX_BUFF (1)
8786
#endif
8887

8988
// MSC Configuration

0 commit comments

Comments
 (0)