Skip to content

Commit ffaa85e

Browse files
authored
Merge pull request #307 from lyusupov/master
make DualRole sketches applicable for Pico W
2 parents b17ab37 + 3a2ee4e commit ffaa85e

File tree

8 files changed

+104
-0
lines changed

8 files changed

+104
-0
lines changed

examples/DualRole/CDC/serial_host_bridge/serial_host_bridge.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,19 @@ void setup1() {
117117

118118
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
119119
pio_cfg.pin_dp = PIN_USB_HOST_DP;
120+
121+
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
122+
// For pico-w, PIO is also used to communicate with cyw43
123+
// Therefore we need to alternate the pio-usb configuration
124+
// details https://github.com/sekigon-gonnoc/Pico-PIO-USB/issues/46
125+
pio_cfg.sm_tx = 3;
126+
pio_cfg.sm_rx = 2;
127+
pio_cfg.sm_eop = 3;
128+
pio_cfg.pio_rx_num = 0;
129+
pio_cfg.pio_tx_num = 1;
130+
pio_cfg.tx_ch = 9;
131+
#endif
132+
120133
USBHost.configure_pio_usb(1, &pio_cfg);
121134

122135
// run host stack on controller (rhport) 1

examples/DualRole/HID/hid_device_report/hid_device_report.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ void setup1() {
8686

8787
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
8888
pio_cfg.pin_dp = PIN_USB_HOST_DP;
89+
90+
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
91+
// For pico-w, PIO is also used to communicate with cyw43
92+
// Therefore we need to alternate the pio-usb configuration
93+
// details https://github.com/sekigon-gonnoc/Pico-PIO-USB/issues/46
94+
pio_cfg.sm_tx = 3;
95+
pio_cfg.sm_rx = 2;
96+
pio_cfg.sm_eop = 3;
97+
pio_cfg.pio_rx_num = 0;
98+
pio_cfg.pio_tx_num = 1;
99+
pio_cfg.tx_ch = 9;
100+
#endif
101+
89102
USBHost.configure_pio_usb(1, &pio_cfg);
90103

91104
// run host stack on controller (rhport) 1

examples/DualRole/HID/hid_mouse_log_filter/hid_mouse_log_filter.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@ void setup1() {
113113

114114
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
115115
pio_cfg.pin_dp = PIN_USB_HOST_DP;
116+
117+
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
118+
// For pico-w, PIO is also used to communicate with cyw43
119+
// Therefore we need to alternate the pio-usb configuration
120+
// details https://github.com/sekigon-gonnoc/Pico-PIO-USB/issues/46
121+
pio_cfg.sm_tx = 3;
122+
pio_cfg.sm_rx = 2;
123+
pio_cfg.sm_eop = 3;
124+
pio_cfg.pio_rx_num = 0;
125+
pio_cfg.pio_tx_num = 1;
126+
pio_cfg.tx_ch = 9;
127+
#endif
128+
116129
USBHost.configure_pio_usb(1, &pio_cfg);
117130

118131
// run host stack on controller (rhport) 1

examples/DualRole/HID/hid_mouse_tremor_filter/hid_mouse_tremor_filter.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,19 @@ void setup1() {
120120

121121
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
122122
pio_cfg.pin_dp = PIN_USB_HOST_DP;
123+
124+
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
125+
// For pico-w, PIO is also used to communicate with cyw43
126+
// Therefore we need to alternate the pio-usb configuration
127+
// details https://github.com/sekigon-gonnoc/Pico-PIO-USB/issues/46
128+
pio_cfg.sm_tx = 3;
129+
pio_cfg.sm_rx = 2;
130+
pio_cfg.sm_eop = 3;
131+
pio_cfg.pio_rx_num = 0;
132+
pio_cfg.pio_tx_num = 1;
133+
pio_cfg.tx_ch = 9;
134+
#endif
135+
123136
USBHost.configure_pio_usb(1, &pio_cfg);
124137

125138
// run host stack on controller (rhport) 1

examples/DualRole/HID/hid_remapper/hid_remapper.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ void setup1() {
105105

106106
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
107107
pio_cfg.pin_dp = PIN_USB_HOST_DP;
108+
109+
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
110+
// For pico-w, PIO is also used to communicate with cyw43
111+
// Therefore we need to alternate the pio-usb configuration
112+
// details https://github.com/sekigon-gonnoc/Pico-PIO-USB/issues/46
113+
pio_cfg.sm_tx = 3;
114+
pio_cfg.sm_rx = 2;
115+
pio_cfg.sm_eop = 3;
116+
pio_cfg.pio_rx_num = 0;
117+
pio_cfg.pio_tx_num = 1;
118+
pio_cfg.tx_ch = 9;
119+
#endif
120+
108121
USBHost.configure_pio_usb(1, &pio_cfg);
109122

110123
// run host stack on controller (rhport) 1

examples/DualRole/MassStorage/msc_data_logger/msc_data_logger.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,19 @@ void setup1() {
133133

134134
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
135135
pio_cfg.pin_dp = PIN_USB_HOST_DP;
136+
137+
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
138+
// For pico-w, PIO is also used to communicate with cyw43
139+
// Therefore we need to alternate the pio-usb configuration
140+
// details https://github.com/sekigon-gonnoc/Pico-PIO-USB/issues/46
141+
pio_cfg.sm_tx = 3;
142+
pio_cfg.sm_rx = 2;
143+
pio_cfg.sm_eop = 3;
144+
pio_cfg.pio_rx_num = 0;
145+
pio_cfg.pio_tx_num = 1;
146+
pio_cfg.tx_ch = 9;
147+
#endif
148+
136149
USBHost.configure_pio_usb(1, &pio_cfg);
137150

138151
// run host stack on controller (rhport) 1

examples/DualRole/MassStorage/msc_file_explorer/msc_file_explorer.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ void setup1() {
100100

101101
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
102102
pio_cfg.pin_dp = PIN_USB_HOST_DP;
103+
104+
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
105+
// For pico-w, PIO is also used to communicate with cyw43
106+
// Therefore we need to alternate the pio-usb configuration
107+
// details https://github.com/sekigon-gonnoc/Pico-PIO-USB/issues/46
108+
pio_cfg.sm_tx = 3;
109+
pio_cfg.sm_rx = 2;
110+
pio_cfg.sm_eop = 3;
111+
pio_cfg.pio_rx_num = 0;
112+
pio_cfg.pio_tx_num = 1;
113+
pio_cfg.tx_ch = 9;
114+
#endif
115+
103116
USBHost.configure_pio_usb(1, &pio_cfg);
104117

105118
// run host stack on controller (rhport) 1

examples/DualRole/device_info_rp2040/device_info_rp2040.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ void setup1() {
115115

116116
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
117117
pio_cfg.pin_dp = PIN_USB_HOST_DP;
118+
119+
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
120+
// For pico-w, PIO is also used to communicate with cyw43
121+
// Therefore we need to alternate the pio-usb configuration
122+
// details https://github.com/sekigon-gonnoc/Pico-PIO-USB/issues/46
123+
pio_cfg.sm_tx = 3;
124+
pio_cfg.sm_rx = 2;
125+
pio_cfg.sm_eop = 3;
126+
pio_cfg.pio_rx_num = 0;
127+
pio_cfg.pio_tx_num = 1;
128+
pio_cfg.tx_ch = 9;
129+
#endif
130+
118131
USBHost.configure_pio_usb(1, &pio_cfg);
119132

120133
// run host stack on controller (rhport) 1

0 commit comments

Comments
 (0)