Skip to content

Commit e078475

Browse files
pillo79dpgeorge
authored andcommitted
shared/tinyusb: Avoid symbol clash on targets with external TinyUSB.
On targets that provide a reference TinyUSB implementation, like ESP32, the SDK already defines and implements standard callback functions such as tud_cdc_line_state_cb(). This causes a symbol clash when enabling shared implementations like the MicroPython 1200 touch functionality. To avoid this symbol clash, add an optional macro to allow ports to use a different function name in the shared implementation. Signed-off-by: Luca Burelli <[email protected]>
1 parent 3d98f6b commit e078475

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

shared/tinyusb/mp_cdc_common.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ STATIC void usbd_cdc_run_bootloader_task(mp_sched_node_t *node) {
3939
machine_bootloader(0, NULL);
4040
}
4141

42-
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
42+
void
43+
#if MICROPY_HW_USB_EXTERNAL_TINYUSB
44+
mp_usbd_line_state_cb
45+
#else
46+
tud_cdc_line_state_cb
47+
#endif
48+
(uint8_t itf, bool dtr, bool rts) {
4349
if (dtr == false && rts == false) {
4450
// Device is disconnected.
4551
cdc_line_coding_t line_coding;

0 commit comments

Comments
 (0)