From e4e854ea2ace4fc0a64d80b357bd2e90cf337dc3 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 27 Dec 2023 15:56:22 +0700 Subject: [PATCH] correct feather esp32 v2 with max3421e pin --- .../CDC/serial_host_bridge/usbh_helper.h | 2 +- .../HID/hid_device_report/usbh_helper.h | 2 +- .../HID/hid_mouse_log_filter/usbh_helper.h | 2 +- .../HID/hid_mouse_tremor_filter/usbh_helper.h | 2 +- .../DualRole/HID/hid_remapper/usbh_helper.h | 2 +- .../MassStorage/msc_data_logger/usbh_helper.h | 2 +- .../msc_file_explorer/usbh_helper.h | 2 +- .../DualRole/Simple/device_info/usbh_helper.h | 2 +- .../device_info_max3421e.ino | 23 ++++++++----------- .../host_device_info/host_device_info.ino | 4 +++- 10 files changed, 20 insertions(+), 23 deletions(-) diff --git a/examples/DualRole/CDC/serial_host_bridge/usbh_helper.h b/examples/DualRole/CDC/serial_host_bridge/usbh_helper.h index 7f8ae69f..fc0cd8ed 100644 --- a/examples/DualRole/CDC/serial_host_bridge/usbh_helper.h +++ b/examples/DualRole/CDC/serial_host_bridge/usbh_helper.h @@ -40,7 +40,7 @@ #if defined(ARDUINO_METRO_ESP32S2) Adafruit_USBH_Host USBHost(&SPI, 15, 14); #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2) - Adafruit_USBH_Host USBHost(&SPI, 27, 33); + Adafruit_USBH_Host USBHost(&SPI, 33, 15); #else // Default CS and INT are pin 10, 9 Adafruit_USBH_Host USBHost(&SPI, 10, 9); diff --git a/examples/DualRole/HID/hid_device_report/usbh_helper.h b/examples/DualRole/HID/hid_device_report/usbh_helper.h index 7f8ae69f..fc0cd8ed 100644 --- a/examples/DualRole/HID/hid_device_report/usbh_helper.h +++ b/examples/DualRole/HID/hid_device_report/usbh_helper.h @@ -40,7 +40,7 @@ #if defined(ARDUINO_METRO_ESP32S2) Adafruit_USBH_Host USBHost(&SPI, 15, 14); #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2) - Adafruit_USBH_Host USBHost(&SPI, 27, 33); + Adafruit_USBH_Host USBHost(&SPI, 33, 15); #else // Default CS and INT are pin 10, 9 Adafruit_USBH_Host USBHost(&SPI, 10, 9); diff --git a/examples/DualRole/HID/hid_mouse_log_filter/usbh_helper.h b/examples/DualRole/HID/hid_mouse_log_filter/usbh_helper.h index 7f8ae69f..fc0cd8ed 100644 --- a/examples/DualRole/HID/hid_mouse_log_filter/usbh_helper.h +++ b/examples/DualRole/HID/hid_mouse_log_filter/usbh_helper.h @@ -40,7 +40,7 @@ #if defined(ARDUINO_METRO_ESP32S2) Adafruit_USBH_Host USBHost(&SPI, 15, 14); #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2) - Adafruit_USBH_Host USBHost(&SPI, 27, 33); + Adafruit_USBH_Host USBHost(&SPI, 33, 15); #else // Default CS and INT are pin 10, 9 Adafruit_USBH_Host USBHost(&SPI, 10, 9); diff --git a/examples/DualRole/HID/hid_mouse_tremor_filter/usbh_helper.h b/examples/DualRole/HID/hid_mouse_tremor_filter/usbh_helper.h index 7f8ae69f..fc0cd8ed 100644 --- a/examples/DualRole/HID/hid_mouse_tremor_filter/usbh_helper.h +++ b/examples/DualRole/HID/hid_mouse_tremor_filter/usbh_helper.h @@ -40,7 +40,7 @@ #if defined(ARDUINO_METRO_ESP32S2) Adafruit_USBH_Host USBHost(&SPI, 15, 14); #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2) - Adafruit_USBH_Host USBHost(&SPI, 27, 33); + Adafruit_USBH_Host USBHost(&SPI, 33, 15); #else // Default CS and INT are pin 10, 9 Adafruit_USBH_Host USBHost(&SPI, 10, 9); diff --git a/examples/DualRole/HID/hid_remapper/usbh_helper.h b/examples/DualRole/HID/hid_remapper/usbh_helper.h index 7f8ae69f..fc0cd8ed 100644 --- a/examples/DualRole/HID/hid_remapper/usbh_helper.h +++ b/examples/DualRole/HID/hid_remapper/usbh_helper.h @@ -40,7 +40,7 @@ #if defined(ARDUINO_METRO_ESP32S2) Adafruit_USBH_Host USBHost(&SPI, 15, 14); #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2) - Adafruit_USBH_Host USBHost(&SPI, 27, 33); + Adafruit_USBH_Host USBHost(&SPI, 33, 15); #else // Default CS and INT are pin 10, 9 Adafruit_USBH_Host USBHost(&SPI, 10, 9); diff --git a/examples/DualRole/MassStorage/msc_data_logger/usbh_helper.h b/examples/DualRole/MassStorage/msc_data_logger/usbh_helper.h index 7f8ae69f..fc0cd8ed 100644 --- a/examples/DualRole/MassStorage/msc_data_logger/usbh_helper.h +++ b/examples/DualRole/MassStorage/msc_data_logger/usbh_helper.h @@ -40,7 +40,7 @@ #if defined(ARDUINO_METRO_ESP32S2) Adafruit_USBH_Host USBHost(&SPI, 15, 14); #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2) - Adafruit_USBH_Host USBHost(&SPI, 27, 33); + Adafruit_USBH_Host USBHost(&SPI, 33, 15); #else // Default CS and INT are pin 10, 9 Adafruit_USBH_Host USBHost(&SPI, 10, 9); diff --git a/examples/DualRole/MassStorage/msc_file_explorer/usbh_helper.h b/examples/DualRole/MassStorage/msc_file_explorer/usbh_helper.h index 7f8ae69f..fc0cd8ed 100644 --- a/examples/DualRole/MassStorage/msc_file_explorer/usbh_helper.h +++ b/examples/DualRole/MassStorage/msc_file_explorer/usbh_helper.h @@ -40,7 +40,7 @@ #if defined(ARDUINO_METRO_ESP32S2) Adafruit_USBH_Host USBHost(&SPI, 15, 14); #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2) - Adafruit_USBH_Host USBHost(&SPI, 27, 33); + Adafruit_USBH_Host USBHost(&SPI, 33, 15); #else // Default CS and INT are pin 10, 9 Adafruit_USBH_Host USBHost(&SPI, 10, 9); diff --git a/examples/DualRole/Simple/device_info/usbh_helper.h b/examples/DualRole/Simple/device_info/usbh_helper.h index 7f8ae69f..fc0cd8ed 100644 --- a/examples/DualRole/Simple/device_info/usbh_helper.h +++ b/examples/DualRole/Simple/device_info/usbh_helper.h @@ -40,7 +40,7 @@ #if defined(ARDUINO_METRO_ESP32S2) Adafruit_USBH_Host USBHost(&SPI, 15, 14); #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2) - Adafruit_USBH_Host USBHost(&SPI, 27, 33); + Adafruit_USBH_Host USBHost(&SPI, 33, 15); #else // Default CS and INT are pin 10, 9 Adafruit_USBH_Host USBHost(&SPI, 10, 9); diff --git a/examples/DualRole/Simple/device_info_max3421e/device_info_max3421e.ino b/examples/DualRole/Simple/device_info_max3421e/device_info_max3421e.ino index 37c40833..ae720725 100644 --- a/examples/DualRole/Simple/device_info_max3421e/device_info_max3421e.ino +++ b/examples/DualRole/Simple/device_info_max3421e/device_info_max3421e.ino @@ -9,7 +9,6 @@ any redistribution *********************************************************************/ - /* This example demonstrates use of both device and host, where * - Device run on native usb controller (roothub port0) * - Host run on MAX3421E controller (roothub port1) tested with: @@ -20,8 +19,7 @@ * - SPI instance, CS pin, INT pin are correctly configured */ -/* Host example will get device descriptors of attached devices and print it out via - * device cdc (Serial) as follows: +/* Host example will get device descriptors of attached devices and print it out: * Device 1: ID 046d:c52f Device Descriptor: bLength 18 @@ -41,21 +39,16 @@ * */ #include "Adafruit_TinyUSB.h" - -// USBHost is defined in usbh_helper.h -// USB Host using MAX3421E: SPI, CS, INT #include "SPI.h" +// USB Host using MAX3421E: SPI, CS, INT #if defined(ARDUINO_METRO_ESP32S2) -Adafruit_USBH_Host USBHost(&SPI, 15, 14); - + Adafruit_USBH_Host USBHost(&SPI, 15, 14); #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2) -Adafruit_USBH_Host USBHost(&SPI, 27, 33); - + Adafruit_USBH_Host USBHost(&SPI, 33, 15); #else - -// Default CS and INT are pin 10, 9 -Adafruit_USBH_Host USBHost(&SPI, 10, 9); + // Default CS and INT are pin 10, 9 + Adafruit_USBH_Host USBHost(&SPI, 10, 9); #endif // Language ID: English @@ -72,11 +65,13 @@ typedef struct { // CFG_TUH_DEVICE_MAX is defined by tusb_config header dev_info_t dev_info[CFG_TUH_DEVICE_MAX] = { 0 }; +//--------------------------------------------------------------------+ +// setup() & loop() +//--------------------------------------------------------------------+ void setup() { Serial.begin(115200); // init host stack on controller (rhport) 1 - // For rp2040: this is called in core1's setup1() USBHost.begin(1); // while ( !Serial ) delay(10); // wait for native usb diff --git a/examples/Host/Simple/host_device_info/host_device_info.ino b/examples/Host/Simple/host_device_info/host_device_info.ino index 38a8220b..12b1abdc 100644 --- a/examples/Host/Simple/host_device_info/host_device_info.ino +++ b/examples/Host/Simple/host_device_info/host_device_info.ino @@ -55,6 +55,9 @@ dev_info_t dev_info[CFG_TUH_DEVICE_MAX] = { 0 }; Adafruit_USBH_Host USBHost; +//--------------------------------------------------------------------+ +// setup() & loop() +//--------------------------------------------------------------------+ void setup() { Serial1.begin(115200); Serial1.println("TinyUSB Host: Device Info Example"); @@ -63,7 +66,6 @@ void setup() { USBHost.begin(0); } -//------------- Core0 -------------// void loop() { USBHost.task(); Serial1.flush();