Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example to read VBUS and VSYS #331

Merged
merged 5 commits into from
Jun 6, 2023

Conversation

peterharperuk
Copy link
Contributor

The process is different on Pico and Pico W so demonstrate how to do it.

Fixes #324

adc/read_vsys/power_status.c Outdated Show resolved Hide resolved
@lurch
Copy link
Contributor

lurch commented Feb 14, 2023

Hmmm, just occurred to me that maybe this example should be using the binary_info stuff too?

adc/read_vsys/power_status.h Outdated Show resolved Hide resolved
adc/read_vsys/power_status.c Outdated Show resolved Hide resolved
The process is different on Pico and Pico W so demonstrate how to do it.

Fixes raspberrypi#324
@lurch
Copy link
Contributor

lurch commented Feb 14, 2023

LGTM (although I've not actually tried testing it).
Just adding a note here that this can't be merged until after raspberrypi/pico-sdk#1252 has.

cyw43 needs to be on to read vbus.
Low values are read when cyw43 goes to sleep (or wakes up?)
kilograham
kilograham previously approved these changes Jun 6, 2023
#if CYW43_USES_VSYS_PIN
cyw43_thread_enter();
// Make sure cyw43 is awake
cyw43_arch_gpio_get(CYW43_WL_GPIO_VBUS_PIN);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cyw43_arch_gpio_get communicates with the wifi chip, and also calls to cyw43_thread_enter and cyw43_thread_exit.

Would that not cause conflicts and or release our lock too soon?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you seeing an issue? You can nest calls to enter and exit so I wouldn't expect this to be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants