Skip to content

Commit e87f11b

Browse files
Add some configuration for VBUS / VSYS (#1252)
The process for reading VBUS and VSYS on Pico and Pico W is different. It's hard to write code that compiles for both devices. Add some configuration to the board files. Fixes #1222
1 parent a42564b commit e87f11b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/boards/include/boards/pico.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,14 @@
8181
#define PICO_RP2040_B0_SUPPORTED 1
8282
#endif
8383

84+
// Pin get VBUS
85+
#ifndef PICO_VBUS_PIN
86+
#define PICO_VBUS_PIN 24
87+
#endif
88+
89+
// Pin used to monitor VSYS using ADC
90+
#ifndef PICO_VSYS_PIN
91+
#define PICO_VSYS_PIN 29
92+
#endif
93+
8494
#endif

src/boards/include/boards/pico_w.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,19 @@
9999
#define CYW43_WL_GPIO_LED_PIN 0
100100
#endif
101101

102+
// CYW43 GPIO to get VBUS
103+
#ifndef CYW43_WL_GPIO_VBUS_PIN
104+
#define CYW43_WL_GPIO_VBUS_PIN 2
105+
#endif
106+
107+
// VSYS pin is shared with CYW43
108+
#ifndef CYW43_USES_VSYS_PIN
109+
#define CYW43_USES_VSYS_PIN 1
110+
#endif
111+
112+
// Pin used to monitor VSYS using ADC
113+
#ifndef PICO_VSYS_PIN
114+
#define PICO_VSYS_PIN 29
115+
#endif
116+
102117
#endif

0 commit comments

Comments
 (0)