Skip to content

Commit c0a615e

Browse files
Improve the comments around VSYS/VBUS config. (#1414)
1 parent ab76609 commit c0a615e

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/boards/include/boards/pico.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@
8181
#define PICO_RP2040_B0_SUPPORTED 1
8282
#endif
8383

84-
// Pin get VBUS
84+
// The GPIO Pin used to read VBUS to determine if the device is battery powered.
8585
#ifndef PICO_VBUS_PIN
8686
#define PICO_VBUS_PIN 24
8787
#endif
8888

89-
// Pin used to monitor VSYS using ADC
89+
// The GPIO Pin used to monitor VSYS. Typically you would use this with ADC.
90+
// There is an example in adc/read_vsys in pico-examples.
9091
#ifndef PICO_VSYS_PIN
9192
#define PICO_VSYS_PIN 29
9293
#endif

src/boards/include/boards/pico_w.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,22 @@
9999
#define CYW43_WL_GPIO_LED_PIN 0
100100
#endif
101101

102-
// CYW43 GPIO to get VBUS
102+
// If CYW43_WL_GPIO_VBUS_PIN is defined then a CYW43 GPIO has to be used to read VBUS.
103+
// This can be passed to cyw43_arch_gpio_get to determine if the device is battery powered.
104+
// PICO_VBUS_PIN and CYW43_WL_GPIO_VBUS_PIN should not both be defined.
103105
#ifndef CYW43_WL_GPIO_VBUS_PIN
104106
#define CYW43_WL_GPIO_VBUS_PIN 2
105107
#endif
106108

107-
// VSYS pin is shared with CYW43
109+
// If CYW43_USES_VSYS_PIN is defined then CYW43 uses the VSYS GPIO (defined by PICO_VSYS_PIN) for other purposes.
110+
// If this is the case, to use the VSYS GPIO it's necessary to ensure CYW43 is not using it.
111+
// This can be achieved by wrapping the use of the VSYS GPIO in cyw43_thread_enter / cyw43_thread_exit.
108112
#ifndef CYW43_USES_VSYS_PIN
109113
#define CYW43_USES_VSYS_PIN 1
110114
#endif
111115

112-
// Pin used to monitor VSYS using ADC
116+
// The GPIO Pin used to monitor VSYS. Typically you would use this with ADC.
117+
// There is an example in adc/read_vsys in pico-examples.
113118
#ifndef PICO_VSYS_PIN
114119
#define PICO_VSYS_PIN 29
115120
#endif

0 commit comments

Comments
 (0)