Skip to content

Commit

Permalink
Add some configuration for VBUS / VSYS
Browse files Browse the repository at this point in the history
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 raspberrypi#1222
  • Loading branch information
peterharperuk committed Feb 14, 2023
1 parent 1331c47 commit e3d8b03
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/boards/include/boards/pico.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,14 @@
#define PICO_RP2040_B0_SUPPORTED 1
#endif

// Pin get VBUS
#ifndef PICO_VBUS_PIN
#define PICO_VBUS_PIN 24
#endif

// Pin used to monitor VSYS using ADC
#ifndef PICO_VSYS_PIN
#define PICO_VSYS_PIN 29
#endif

#endif
15 changes: 15 additions & 0 deletions src/boards/include/boards/pico_w.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,19 @@
#define CYW43_WL_GPIO_LED_PIN 0
#endif

// CYW43 GPIO to get VBUS
#ifndef CYW43_WL_GPIO_VBUS_PIN
#define CYW43_WL_GPIO_VBUS_PIN 2
#endif

// VSYS pin is shared with CYW43
#ifndef CYW43_USES_VSYS_PIN
#define CYW43_USES_VSYS_PIN 1
#endif

// Pin used to monitor VSYS using ADC
#ifndef PICO_VSYS_PIN
#define PICO_VSYS_PIN 29
#endif

#endif

0 comments on commit e3d8b03

Please sign in to comment.