Skip to content

Commit 553127a

Browse files
authored
Merge pull request #298 from adafruit/ifndef_update
Updating pin names for examples
2 parents 2e0f267 + 5678d97 commit 553127a

File tree

6 files changed

+57
-57
lines changed

6 files changed

+57
-57
lines changed

examples/DualRole/CDC/serial_host_bridge/serial_host_bridge.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
2121
* Requirements:
2222
* - [Pico-PIO-USB](https://github.com/sekigon-gonnoc/Pico-PIO-USB) library
23-
* - 2 consecutive GPIOs: D+ is defined by PIN_PIO_USB_HOST_DP, D- = D+ +1
23+
* - 2 consecutive GPIOs: D+ is defined by PIN_USB_HOST_DP, D- = D+ +1
2424
* - Provide VBus (5v) and GND for peripheral
2525
* - CPU Speed must be either 120 or 240 Mhz. Selected via "Menu -> CPU Speed"
2626
*/
@@ -32,17 +32,17 @@
3232
#include "Adafruit_TinyUSB.h"
3333

3434
// Pin D+ for host, D- = D+ + 1
35-
#ifndef PIN_PIO_USB_HOST_DP
36-
#define PIN_PIO_USB_HOST_DP 20
35+
#ifndef PIN_USB_HOST_DP
36+
#define PIN_USB_HOST_DP 16
3737
#endif
3838

3939
// Pin for enabling Host VBUS. comment out if not used
40-
#ifndef PIN_PIO_USB_HOST_VBUSEN
41-
#define PIN_PIO_USB_HOST_VBUSEN 22
40+
#ifndef PIN_5V_EN
41+
#define PIN_5V_EN 18
4242
#endif
4343

44-
#ifndef PIN_PIO_USB_HOST_VBUSEN_STATE
45-
#define PIN_PIO_USB_HOST_VBUSEN_STATE 1
44+
#ifndef PIN_5V_EN_STATE
45+
#define PIN_5V_EN_STATE 1
4646
#endif
4747

4848
// USB Host object
@@ -105,20 +105,20 @@ void setup1() {
105105
}
106106
}
107107

108-
#ifdef PIN_PIO_USB_HOST_VBUSEN
109-
pinMode(PIN_PIO_USB_HOST_VBUSEN, OUTPUT);
108+
#ifdef PIN_5V_EN
109+
pinMode(PIN_5V_EN, OUTPUT);
110110

111111
// power off first
112-
digitalWrite(PIN_PIO_USB_HOST_VBUSEN, 1-PIN_PIO_USB_HOST_VBUSEN_STATE);
112+
digitalWrite(PIN_5V_EN, 1-PIN_5V_EN_STATE);
113113
delay(1);
114114

115115
// power on
116-
digitalWrite(PIN_PIO_USB_HOST_VBUSEN, PIN_PIO_USB_HOST_VBUSEN_STATE);
116+
digitalWrite(PIN_5V_EN, PIN_5V_EN_STATE);
117117
delay(10);
118118
#endif
119119

120120
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
121-
pio_cfg.pin_dp = PIN_PIO_USB_HOST_DP;
121+
pio_cfg.pin_dp = PIN_USB_HOST_DP;
122122
USBHost.configure_pio_usb(1, &pio_cfg);
123123

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

examples/DualRole/HID/hid_device_report/hid_device_report.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* Requirements:
1818
* - [Pico-PIO-USB](https://github.com/sekigon-gonnoc/Pico-PIO-USB) library
19-
* - 2 consecutive GPIOs: D+ is defined by PIN_PIO_USB_HOST_DP, D- = D+ +1
19+
* - 2 consecutive GPIOs: D+ is defined by PIN_USB_HOST_DP, D- = D+ +1
2020
* - Provide VBus (5v) and GND for peripheral
2121
* - CPU Speed must be either 120 or 240 Mhz. Selected via "Menu -> CPU Speed"
2222
*/

examples/DualRole/HID/hid_remapper/hid_remapper.ino

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
* Requirements:
2424
* - [Pico-PIO-USB](https://github.com/sekigon-gonnoc/Pico-PIO-USB) library
25-
* - 2 consecutive GPIOs: D+ is defined by PIN_PIO_USB_HOST_DP, D- = D+ +1
25+
* - 2 consecutive GPIOs: D+ is defined by PIN_USB_HOST_DP, D- = D+ +1
2626
* - Provide VBus (5v) and GND for peripheral
2727
* - CPU Speed must be either 120 or 240 Mhz. Selected via "Menu -> CPU Speed"
2828
*/
@@ -32,17 +32,17 @@
3232
#include "Adafruit_TinyUSB.h"
3333

3434
// Pin D+ for host, D- = D+ + 1
35-
#ifndef PIN_PIO_USB_HOST_DP
36-
#define PIN_PIO_USB_HOST_DP 20
35+
#ifndef PIN_USB_HOST_DP
36+
#define PIN_USB_HOST_DP 16
3737
#endif
3838

3939
// Pin for enabling Host VBUS. comment out if not used
40-
#ifndef PIN_PIO_USB_HOST_VBUSEN
41-
#define PIN_PIO_USB_HOST_VBUSEN 22
40+
#ifndef PIN_5V_EN
41+
#define PIN_5V_EN 18
4242
#endif
4343

44-
#ifndef PIN_PIO_USB_HOST_VBUSEN_STATE
45-
#define PIN_PIO_USB_HOST_VBUSEN_STATE 1
44+
#ifndef PIN_5V_EN_STATE
45+
#define PIN_5V_EN_STATE 1
4646
#endif
4747

4848
// Language ID: English
@@ -98,13 +98,13 @@ void setup1() {
9898
while(1) delay(1);
9999
}
100100

101-
#ifdef PIN_PIO_USB_HOST_VBUSEN
102-
pinMode(PIN_PIO_USB_HOST_VBUSEN, OUTPUT);
103-
digitalWrite(PIN_PIO_USB_HOST_VBUSEN, PIN_PIO_USB_HOST_VBUSEN_STATE);
101+
#ifdef PIN_5V_EN
102+
pinMode(PIN_5V_EN, OUTPUT);
103+
digitalWrite(PIN_5V_EN, PIN_5V_EN_STATE);
104104
#endif
105105

106106
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
107-
pio_cfg.pin_dp = PIN_PIO_USB_HOST_DP;
107+
pio_cfg.pin_dp = PIN_USB_HOST_DP;
108108
USBHost.configure_pio_usb(1, &pio_cfg);
109109

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

examples/DualRole/MassStorage/msc_data_logger/msc_data_logger.ino

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* Requirements:
2020
* - [Pico-PIO-USB](https://github.com/sekigon-gonnoc/Pico-PIO-USB) library
21-
* - 2 consecutive GPIOs: D+ is defined by PIN_PIO_USB_HOST_DP, D- = D+ +1
21+
* - 2 consecutive GPIOs: D+ is defined by PIN_USB_HOST_DP, D- = D+ +1
2222
* - Provide VBus (5v) and GND for peripheral
2323
* - CPU Speed must be either 120 or 240 Mhz. Selected via "Menu -> CPU Speed"
2424
*/
@@ -33,17 +33,17 @@
3333
#include "Adafruit_TinyUSB.h"
3434

3535
// Pin D+ for host, D- = D+ + 1
36-
#ifndef PIN_PIO_USB_HOST_DP
37-
#define PIN_PIO_USB_HOST_DP 20
36+
#ifndef PIN_USB_HOST_DP
37+
#define PIN_USB_HOST_DP 16
3838
#endif
3939

4040
// Pin for enabling Host VBUS. comment out if not used
41-
#ifndef PIN_PIO_USB_HOST_VBUSEN
42-
#define PIN_PIO_USB_HOST_VBUSEN 22
41+
#ifndef PIN_5V_EN
42+
#define PIN_5V_EN 18
4343
#endif
4444

45-
#ifndef PIN_PIO_USB_HOST_VBUSEN_STATE
46-
#define PIN_PIO_USB_HOST_VBUSEN_STATE 1
45+
#ifndef PIN_5V_EN_STATE
46+
#define PIN_5V_EN_STATE 1
4747
#endif
4848

4949

@@ -126,13 +126,13 @@ void setup1() {
126126
}
127127
}
128128

129-
#ifdef PIN_PIO_USB_HOST_VBUSEN
130-
pinMode(PIN_PIO_USB_HOST_VBUSEN, OUTPUT);
131-
digitalWrite(PIN_PIO_USB_HOST_VBUSEN, PIN_PIO_USB_HOST_VBUSEN_STATE);
129+
#ifdef PIN_5V_EN
130+
pinMode(PIN_5V_EN, OUTPUT);
131+
digitalWrite(PIN_5V_EN, PIN_5V_EN_STATE);
132132
#endif
133133

134134
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
135-
pio_cfg.pin_dp = PIN_PIO_USB_HOST_DP;
135+
pio_cfg.pin_dp = PIN_USB_HOST_DP;
136136
USBHost.configure_pio_usb(1, &pio_cfg);
137137

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

examples/DualRole/MassStorage/msc_file_explorer/msc_file_explorer.ino

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* Requirements:
1818
* - [Pico-PIO-USB](https://github.com/sekigon-gonnoc/Pico-PIO-USB) library
19-
* - 2 consecutive GPIOs: D+ is defined by PIN_PIO_USB_HOST_DP, D- = D+ +1
19+
* - 2 consecutive GPIOs: D+ is defined by PIN_USB_HOST_DP, D- = D+ +1
2020
* - Provide VBus (5v) and GND for peripheral
2121
* - CPU Speed must be either 120 or 240 Mhz. Selected via "Menu -> CPU Speed"
2222
*/
@@ -31,17 +31,17 @@
3131
#include "Adafruit_TinyUSB.h"
3232

3333
// Pin D+ for host, D- = D+ + 1
34-
#ifndef PIN_PIO_USB_HOST_DP
35-
#define PIN_PIO_USB_HOST_DP 20
34+
#ifndef PIN_USB_HOST_DP
35+
#define PIN_USB_HOST_DP 16
3636
#endif
3737

3838
// Pin for enabling Host VBUS. comment out if not used
39-
#ifndef PIN_PIO_USB_HOST_VBUSEN
40-
#define PIN_PIO_USB_HOST_VBUSEN 22
39+
#ifndef PIN_5V_EN
40+
#define PIN_5V_EN 18
4141
#endif
4242

43-
#ifndef PIN_PIO_USB_HOST_VBUSEN_STATE
44-
#define PIN_PIO_USB_HOST_VBUSEN_STATE 1
43+
#ifndef PIN_5V_EN_STATE
44+
#define PIN_5V_EN_STATE 1
4545
#endif
4646

4747
// USB Host object
@@ -93,13 +93,13 @@ void setup1() {
9393
}
9494
}
9595

96-
#ifdef PIN_PIO_USB_HOST_VBUSEN
97-
pinMode(PIN_PIO_USB_HOST_VBUSEN, OUTPUT);
98-
digitalWrite(PIN_PIO_USB_HOST_VBUSEN, PIN_PIO_USB_HOST_VBUSEN_STATE);
96+
#ifdef PIN_5V_EN
97+
pinMode(PIN_5V_EN, OUTPUT);
98+
digitalWrite(PIN_5V_EN, PIN_5V_EN_STATE);
9999
#endif
100100

101101
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
102-
pio_cfg.pin_dp = PIN_PIO_USB_HOST_DP;
102+
pio_cfg.pin_dp = PIN_USB_HOST_DP;
103103
USBHost.configure_pio_usb(1, &pio_cfg);
104104

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

examples/DualRole/device_info_rp2040/device_info_rp2040.ino

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* Requirements:
1818
* - [Pico-PIO-USB](https://github.com/sekigon-gonnoc/Pico-PIO-USB) library
19-
* - 2 consecutive GPIOs: D+ is defined by PIN_PIO_USB_HOST_DP, D- = D+ +1
19+
* - 2 consecutive GPIOs: D+ is defined by PIN_USB_HOST_DP, D- = D+ +1
2020
* - Provide VBus (5v) and GND for peripheral
2121
* - CPU Speed must be either 120 or 240 Mhz. Selected via "Menu -> CPU Speed"
2222
*
@@ -46,17 +46,17 @@
4646
#include "Adafruit_TinyUSB.h"
4747

4848
// Pin D+ for host, D- = D+ + 1
49-
#ifndef PIN_PIO_USB_HOST_DP
50-
#define PIN_PIO_USB_HOST_DP 20
49+
#ifndef PIN_USB_HOST_DP
50+
#define PIN_USB_HOST_DP 16
5151
#endif
5252

5353
// Pin for enabling Host VBUS. comment out if not used
54-
#ifndef PIN_PIO_USB_HOST_VBUSEN
55-
#define PIN_PIO_USB_HOST_VBUSEN 22
54+
#ifndef PIN_5V_EN
55+
#define PIN_5V_EN 18
5656
#endif
5757

58-
#ifndef PIN_PIO_USB_HOST_VBUSEN_STATE
59-
#define PIN_PIO_USB_HOST_VBUSEN_STATE 1
58+
#ifndef PIN_5V_EN_STATE
59+
#define PIN_5V_EN_STATE 1
6060
#endif
6161

6262
// Language ID: English
@@ -108,13 +108,13 @@ void setup1() {
108108
}
109109
}
110110

111-
#ifdef PIN_PIO_USB_HOST_VBUSEN
112-
pinMode(PIN_PIO_USB_HOST_VBUSEN, OUTPUT);
113-
digitalWrite(PIN_PIO_USB_HOST_VBUSEN, PIN_PIO_USB_HOST_VBUSEN_STATE);
111+
#ifdef PIN_5V_EN
112+
pinMode(PIN_5V_EN, OUTPUT);
113+
digitalWrite(PIN_5V_EN, PIN_5V_EN_STATE);
114114
#endif
115115

116116
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
117-
pio_cfg.pin_dp = PIN_PIO_USB_HOST_DP;
117+
pio_cfg.pin_dp = PIN_USB_HOST_DP;
118118
USBHost.configure_pio_usb(1, &pio_cfg);
119119

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

0 commit comments

Comments
 (0)