99 any redistribution
1010*********************************************************************/
1111
12-
1312/* This example demonstrates use of both device and host, where
1413 * - Device run on native usb controller (roothub port0)
1514 * - Host run on MAX3421E controller (roothub port1) tested with:
2019 * - SPI instance, CS pin, INT pin are correctly configured
2120 */
2221
23- /* Host example will get device descriptors of attached devices and print it out via
24- * device cdc (Serial) as follows:
22+ /* Host example will get device descriptors of attached devices and print it out:
2523 * Device 1: ID 046d:c52f
2624 Device Descriptor:
2725 bLength 18
4139 *
4240 */
4341#include " Adafruit_TinyUSB.h"
44-
45- // USBHost is defined in usbh_helper.h
46- // USB Host using MAX3421E: SPI, CS, INT
4742#include " SPI.h"
4843
44+ // USB Host using MAX3421E: SPI, CS, INT
4945#if defined(ARDUINO_METRO_ESP32S2)
50- Adafruit_USBH_Host USBHost (&SPI, 15 , 14 );
51-
46+ Adafruit_USBH_Host USBHost (&SPI, 15 , 14 );
5247#elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2)
53- Adafruit_USBH_Host USBHost (&SPI, 27 , 33 );
54-
48+ Adafruit_USBH_Host USBHost (&SPI, 33 , 15 );
5549#else
56-
57- // Default CS and INT are pin 10, 9
58- Adafruit_USBH_Host USBHost (&SPI, 10 , 9 );
50+ // Default CS and INT are pin 10, 9
51+ Adafruit_USBH_Host USBHost (&SPI, 10 , 9 );
5952#endif
6053
6154// Language ID: English
@@ -72,11 +65,13 @@ typedef struct {
7265// CFG_TUH_DEVICE_MAX is defined by tusb_config header
7366dev_info_t dev_info[CFG_TUH_DEVICE_MAX] = { 0 };
7467
68+ // --------------------------------------------------------------------+
69+ // setup() & loop()
70+ // --------------------------------------------------------------------+
7571void setup () {
7672 Serial.begin (115200 );
7773
7874 // init host stack on controller (rhport) 1
79- // For rp2040: this is called in core1's setup1()
8075 USBHost.begin (1 );
8176
8277// while ( !Serial ) delay(10); // wait for native usb
0 commit comments