Skip to content

Commit 9985421

Browse files
authored
Merge pull request #337 from adafruit/support-max3421-for-esp32
Support max3421 for esp32
2 parents 31a23f3 + c91d537 commit 9985421

File tree

70 files changed

+388
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+388
-171
lines changed

examples/DualRole/CDC/serial_host_bridge/.feather_rp2040_tinyusb.test.only

Whitespace-only changes.

examples/DualRole/CDC/serial_host_bridge/.metro_m0_tinyusb.only

Whitespace-only changes.

examples/DualRole/CDC/serial_host_bridge/.metro_m4_tinyusb.only

Whitespace-only changes.

examples/DualRole/CDC/serial_host_bridge/.nrf52840.only

Whitespace-only changes.

examples/DualRole/CDC/serial_host_bridge/serial_host_bridge.ino

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,19 @@ void forward_serial(void) {
7171
//--------------------------------------------------------------------+
7272

7373
#ifdef USE_FREERTOS
74+
75+
#ifdef ARDUINO_ARCH_ESP32
76+
#define USBH_STACK_SZ 2048
77+
#else
78+
#define USBH_STACK_SZ 200
79+
#endif
80+
7481
void usbhost_rtos_task(void *param) {
7582
(void) param;
7683
while (1) {
7784
USBHost.task();
7885
}
7986
}
80-
81-
void create_usbhost_rtos_task(void) {
82-
const uint32_t usbh_stack_size = 200;
83-
xTaskCreate(usbhost_rtos_task, "usbh", usbh_stack_size, NULL, TASK_PRIO_HIGH, NULL);
84-
}
8587
#endif
8688

8789
void setup() {
@@ -94,7 +96,8 @@ void setup() {
9496
SerialHost.begin(115200);
9597

9698
#ifdef USE_FREERTOS
97-
create_usbhost_rtos_task();
99+
// Create a task to run USBHost.task() in background
100+
xTaskCreate(usbhost_rtos_task, "usbh", USBH_STACK_SZ, NULL, 3, NULL);
98101
#endif
99102

100103
// while ( !Serial ) delay(10); // wait for native usb

examples/DualRole/CDC/serial_host_bridge/usbh_helper.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,14 @@
5050

5151
#if defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421
5252
#include "SPI.h"
53+
54+
#ifdef ARDUINO_ARCH_ESP32
55+
// ESP32 specify SCK, MOSI, MISO, CS, INT
56+
Adafruit_USBH_Host USBHost(36, 35, 37, 15, 14);
57+
#else
5358
// USB Host using MAX3421E: SPI, CS, INT
5459
Adafruit_USBH_Host USBHost(&SPI, 10, 9);
60+
#endif
5561
#else
5662
Adafruit_USBH_Host USBHost;
5763
#endif

examples/DualRole/HID/hid_device_report/.feather_rp2040_tinyusb.test.only

Whitespace-only changes.

examples/DualRole/HID/hid_device_report/.metro_m0_tinyusb.only

Whitespace-only changes.

examples/DualRole/HID/hid_device_report/.metro_m4_tinyusb.only

Whitespace-only changes.

examples/DualRole/HID/hid_device_report/.nrf52840.only

Whitespace-only changes.

0 commit comments

Comments
 (0)