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>
This commit is contained in:
Luca Burelli 2023-07-04 12:24:35 +02:00 committed by Damien George
parent 3d98f6b80a
commit e0784750aa

View File

@ -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;