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 10, 2023
1 parent f54ca1a commit a52778c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/boards/include/boards/pico.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,19 @@
#define PICO_RP2040_B0_SUPPORTED 1
#endif

// GPIO pin get VBUS
#ifndef PICO_VBUS_GPIO_PIN
#define PICO_VBUS_GPIO_PIN 24
#endif

// GPIO pin used to monitor VSYS
#ifndef PICO_VSYS_GPIO_PIN
#define PICO_VSYS_GPIO_PIN 29
#endif

// ADC to use to monitor VSYS
#ifndef PICO_VSYS_ADC_NUM
#define PICO_VSYS_ADC_NUM 3
#endif

#endif
18 changes: 18 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,22 @@
#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 GPIO pin is shared with CYW43
#define CYW43_USES_VSYS_GPIO_PIN 1

// GPIO pin used to monitor VSYS
#ifndef PICO_VSYS_GPIO_PIN
#define PICO_VSYS_GPIO_PIN 29
#endif

// ADC to use to monitor VSYS
#ifndef PICO_VSYS_ADC_NUM
#define PICO_VSYS_ADC_NUM 3
#endif

#endif

0 comments on commit a52778c

Please sign in to comment.