aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorLuca Burelli <l.burelli@arduino.cc>2023-07-04 12:24:35 +0200
committerDamien George <damien@micropython.org>2023-07-20 23:55:42 +1000
commite0784750aab4bd71896d6683de00b15324b8cb0f (patch)
treeb15cb2bef9d2533d9bdd56b4a67a177734bd8c99 /shared
parent3d98f6b80a6d74ce31e33588f430a5ec17099620 (diff)
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 <l.burelli@arduino.cc>
Diffstat (limited to 'shared')
-rw-r--r--shared/tinyusb/mp_cdc_common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/shared/tinyusb/mp_cdc_common.c b/shared/tinyusb/mp_cdc_common.c
index cd4f5d101..4ccae4bac 100644
--- a/shared/tinyusb/mp_cdc_common.c
+++ b/shared/tinyusb/mp_cdc_common.c
@@ -39,7 +39,13 @@ STATIC void usbd_cdc_run_bootloader_task(mp_sched_node_t *node) {
machine_bootloader(0, NULL);
}
-void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
+void
+#if MICROPY_HW_USB_EXTERNAL_TINYUSB
+mp_usbd_line_state_cb
+#else
+tud_cdc_line_state_cb
+#endif
+ (uint8_t itf, bool dtr, bool rts) {
if (dtr == false && rts == false) {
// Device is disconnected.
cdc_line_coding_t line_coding;