File tree 3 files changed +13
-4
lines changed
3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 40
40
#include "device/dcd.h"
41
41
#endif
42
42
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
+
43
50
// Run the TinyUSB device task
44
51
void mp_usbd_task (void );
45
52
@@ -125,7 +132,8 @@ inline static bool mp_usb_device_builtin_enabled(const mp_obj_usb_device_t *usbd
125
132
126
133
static inline void mp_usbd_init (void ) {
127
134
// 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 ();
129
137
}
130
138
131
139
#endif
Original file line number Diff line number Diff line change @@ -428,8 +428,10 @@ void mp_usbd_init(void) {
428
428
}
429
429
430
430
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 ();
433
435
}
434
436
}
435
437
Original file line number Diff line number Diff line change 83
83
#ifndef CFG_TUD_CDC_TX_BUFSIZE
84
84
#define CFG_TUD_CDC_TX_BUFSIZE ((CFG_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED) ? 512 : 256)
85
85
#endif
86
- #define CFG_TUD_CDC_PERSISTENT_TX_BUFF (1)
87
86
#endif
88
87
89
88
// MSC Configuration
You can’t perform that action at this time.
0 commit comments