diff options
| author | Damien George <damien@micropython.org> | 2024-06-02 22:16:29 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-06-02 23:27:33 +1000 |
| commit | 84a8f7ea6dfa3529b024d31fa25bb91153bbfc35 (patch) | |
| tree | 964c548c3019a21224f3b5614acedb08987ccd63 /ports/esp32 | |
| parent | c1a6b95bf2653b5bf4a9ad9fed84610e749e40f9 (diff) | |
shared/tinyusb: Allow ports to use 1200bps-touch without other CDC code.
This fixes the build for some esp32 and nrf boards (for example
`ARDUINO_NANO_33_BLE_SENSE` and `ARDUINO_NANO_ESP32`) due to commit
c98789a6d8e05acb608afe4b30cf3ca563419b2d. Changes are:
- Allow the CDC TX/RX functions in `mp_usbd_cdc.c` to be enabled
separately to those needed for `MICROPY_HW_USB_CDC_1200BPS_TOUCH`.
- Add `MICROPY_EXCLUDE_SHARED_TINYUSB_USBD_CDC` option as a temporary
workaround for the nrf port to use.
- Declare `mp_usbd_line_state_cb()` in a header as a public function.
- Fix warning with type cast of `.callback_line_state_changed`.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/esp32')
| -rw-r--r-- | ports/esp32/boards/ARDUINO_NANO_ESP32/board_init.c | 2 | ||||
| -rw-r--r-- | ports/esp32/usb.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ports/esp32/boards/ARDUINO_NANO_ESP32/board_init.c b/ports/esp32/boards/ARDUINO_NANO_ESP32/board_init.c index ab03139d9..69a414cd5 100644 --- a/ports/esp32/boards/ARDUINO_NANO_ESP32/board_init.c +++ b/ports/esp32/boards/ARDUINO_NANO_ESP32/board_init.c @@ -26,6 +26,7 @@ #include <string.h> #include "py/mphal.h" +#include "shared/tinyusb/mp_usbd_cdc.h" #include <esp_system.h> #include <esp_ota_ops.h> @@ -87,7 +88,6 @@ void NANO_ESP32_enter_bootloader(void) { } void NANO_ESP32_usb_callback_line_state_changed(int itf, void *event_in) { - extern void mp_usbd_line_state_cb(uint8_t itf, bool dtr, bool rts); cdcacm_event_t *event = event_in; mp_usbd_line_state_cb(itf, event->line_state_changed_data.dtr, event->line_state_changed_data.rts); } diff --git a/ports/esp32/usb.c b/ports/esp32/usb.c index 316482e18..2a3a2595d 100644 --- a/ports/esp32/usb.c +++ b/ports/esp32/usb.c @@ -79,7 +79,7 @@ void usb_init(void) { .callback_rx_wanted_char = &MICROPY_HW_USB_CUSTOM_RX_WANTED_CHAR_CB, #endif #ifdef MICROPY_HW_USB_CUSTOM_LINE_STATE_CB - .callback_line_state_changed = &MICROPY_HW_USB_CUSTOM_LINE_STATE_CB, + .callback_line_state_changed = (tusb_cdcacm_callback_t)&MICROPY_HW_USB_CUSTOM_LINE_STATE_CB, #endif #ifdef MICROPY_HW_USB_CUSTOM_LINE_CODING_CB .callback_line_coding_changed = &MICROPY_HW_USB_CUSTOM_LINE_CODING_CB, |
