summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shared/tinyusb/mp_usbd.c2
-rw-r--r--shared/tinyusb/mp_usbd.h16
-rw-r--r--shared/tinyusb/mp_usbd_cdc.c6
-rw-r--r--shared/tinyusb/mp_usbd_cdc.h4
4 files changed, 23 insertions, 5 deletions
diff --git a/shared/tinyusb/mp_usbd.c b/shared/tinyusb/mp_usbd.c
index f03f7f7db..a21e5f027 100644
--- a/shared/tinyusb/mp_usbd.c
+++ b/shared/tinyusb/mp_usbd.c
@@ -44,7 +44,7 @@ void mp_usbd_task_callback(mp_sched_node_t *node) {
#endif // !MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE
// Schedule the TinyUSB task on demand, when there is a new USB device event
-TU_ATTR_FAST_FUNC void tud_event_hook_cb(uint8_t rhport, uint32_t eventid, bool in_isr) {
+TU_ATTR_FAST_FUNC void MICROPY_WRAP_TUD_EVENT_HOOK_CB(tud_event_hook_cb)(uint8_t rhport, uint32_t eventid, bool in_isr) {
mp_usbd_schedule_task();
mp_hal_wake_main_task_from_isr();
}
diff --git a/shared/tinyusb/mp_usbd.h b/shared/tinyusb/mp_usbd.h
index b46555536..b482ec430 100644
--- a/shared/tinyusb/mp_usbd.h
+++ b/shared/tinyusb/mp_usbd.h
@@ -29,6 +29,22 @@
#include "py/mpconfig.h"
+#ifndef MICROPY_WRAP_TUD_SOF_CB
+#define MICROPY_WRAP_TUD_SOF_CB(name) name
+#endif
+
+#ifndef MICROPY_WRAP_TUD_CDC_RX_CB
+#define MICROPY_WRAP_TUD_CDC_RX_CB(name) name
+#endif
+
+#ifndef MICROPY_WRAP_TUD_CDC_LINE_STATE_CB
+#define MICROPY_WRAP_TUD_CDC_LINE_STATE_CB(name) name
+#endif
+
+#ifndef MICROPY_WRAP_TUD_EVENT_HOOK_CB
+#define MICROPY_WRAP_TUD_EVENT_HOOK_CB(name) name
+#endif
+
#if MICROPY_HW_ENABLE_USBDEV
#include "py/obj.h"
diff --git a/shared/tinyusb/mp_usbd_cdc.c b/shared/tinyusb/mp_usbd_cdc.c
index 9b380acef..961bdf898 100644
--- a/shared/tinyusb/mp_usbd_cdc.c
+++ b/shared/tinyusb/mp_usbd_cdc.c
@@ -68,7 +68,7 @@ uintptr_t mp_usbd_cdc_poll_interfaces(uintptr_t poll_flags) {
return ret;
}
-void tud_cdc_rx_cb(uint8_t itf) {
+void MICROPY_WRAP_TUD_CDC_RX_CB(tud_cdc_rx_cb)(uint8_t itf) {
// consume pending USB data immediately to free usb buffer and keep the endpoint from stalling.
// in case the ringbuffer is full, mark the CDC interface that need attention later on for polling
cdc_itf_pending &= ~(1 << itf);
@@ -141,7 +141,7 @@ mp_uint_t mp_usbd_cdc_tx_strn(const char *str, mp_uint_t len) {
return i;
}
-void tud_sof_cb(uint32_t frame_count) {
+void MICROPY_WRAP_TUD_SOF_CB(tud_sof_cb)(uint32_t frame_count) {
if (--cdc_connected_flush_delay < 0) {
// Finished on-connection delay, disable SOF interrupt again.
tud_sof_cb_enable(false);
@@ -172,7 +172,7 @@ static struct {
} prev_line_state = {0};
#endif
-void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
+void MICROPY_WRAP_TUD_CDC_LINE_STATE_CB(tud_cdc_line_state_cb)(uint8_t itf, bool dtr, bool rts) {
#if MICROPY_HW_USB_CDC && !MICROPY_EXCLUDE_SHARED_TINYUSB_USBD_CDC
if (dtr) {
// A host application has started to open the cdc serial port.
diff --git a/shared/tinyusb/mp_usbd_cdc.h b/shared/tinyusb/mp_usbd_cdc.h
index 8d37a7731..6d653a1d0 100644
--- a/shared/tinyusb/mp_usbd_cdc.h
+++ b/shared/tinyusb/mp_usbd_cdc.h
@@ -27,6 +27,8 @@
#ifndef MICROPY_INCLUDED_SHARED_TINYUSB_MP_USBD_CDC_H
#define MICROPY_INCLUDED_SHARED_TINYUSB_MP_USBD_CDC_H
+#include "mp_usbd.h"
+
#ifndef MICROPY_HW_USB_CDC_TX_TIMEOUT
#define MICROPY_HW_USB_CDC_TX_TIMEOUT (500)
#endif
@@ -38,7 +40,7 @@
#endif
uintptr_t mp_usbd_cdc_poll_interfaces(uintptr_t poll_flags);
-void tud_cdc_rx_cb(uint8_t itf);
+void MICROPY_WRAP_TUD_CDC_RX_CB(tud_cdc_rx_cb)(uint8_t itf);
mp_uint_t mp_usbd_cdc_tx_strn(const char *str, mp_uint_t len);
#endif // MICROPY_INCLUDED_SHARED_TINYUSB_MP_USBD_CDC_H