9
9
any redistribution
10
10
*********************************************************************/
11
11
12
-
13
12
/* This example demonstrates use of both device and host, where
14
13
* - Device run on native usb controller (roothub port0)
15
14
* - Host run on MAX3421E controller (roothub port1) tested with:
20
19
* - SPI instance, CS pin, INT pin are correctly configured
21
20
*/
22
21
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:
25
23
* Device 1: ID 046d:c52f
26
24
Device Descriptor:
27
25
bLength 18
41
39
*
42
40
*/
43
41
#include " Adafruit_TinyUSB.h"
44
-
45
- // USBHost is defined in usbh_helper.h
46
- // USB Host using MAX3421E: SPI, CS, INT
47
42
#include " SPI.h"
48
43
44
+ // USB Host using MAX3421E: SPI, CS, INT
49
45
#if defined(ARDUINO_METRO_ESP32S2)
50
- Adafruit_USBH_Host USBHost (&SPI, 15 , 14 );
51
-
46
+ Adafruit_USBH_Host USBHost (&SPI, 15 , 14 );
52
47
#elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2)
53
- Adafruit_USBH_Host USBHost (&SPI, 27 , 33 );
54
-
48
+ Adafruit_USBH_Host USBHost (&SPI, 33 , 15 );
55
49
#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 );
59
52
#endif
60
53
61
54
// Language ID: English
@@ -72,11 +65,13 @@ typedef struct {
72
65
// CFG_TUH_DEVICE_MAX is defined by tusb_config header
73
66
dev_info_t dev_info[CFG_TUH_DEVICE_MAX] = { 0 };
74
67
68
+ // --------------------------------------------------------------------+
69
+ // setup() & loop()
70
+ // --------------------------------------------------------------------+
75
71
void setup () {
76
72
Serial.begin (115200 );
77
73
78
74
// init host stack on controller (rhport) 1
79
- // For rp2040: this is called in core1's setup1()
80
75
USBHost.begin (1 );
81
76
82
77
// while ( !Serial ) delay(10); // wait for native usb
0 commit comments