Open eldiGH opened 3 weeks ago
oof, what. they shared the ADC pin with the cyw43 spi :sob:
The least bad way to add support for this would be to somehow extend cyw43-pio
so it can do the pin sharing somewhat safely.
I had the same issue, spent way too much time on it and then decided to hack it in hardware. Wire from vsys through a voltage divider and wire back from there to one of the adc capable pins... measure that. Really not an elegant solution but quickly done, cheap and works well.
I'm trying to measure the VSYS voltage using built-in ADC (to monitor battery level). It's much harder to do that compared to normal pico, as ADC connected to vsys uses pin 29, which is also used as pio spi to communicate with cyw43 wifi chip. Normally, in c/c++ sdk code would look something like this:
I can't really think of any way doing it safely in current embassy-rp implementation myself - maybe there is some elegant way of implementing this. I'm now developing my first project in it as well as in rust in general.