adafruit / Adafruit_nRF52_Arduino

Adafruit code for the Nordic nRF52 BLE SoC on Arduino
Other
606 stars 492 forks source link

Add ability to read Vdd: Looking for preference in how to code the pull request #695

Closed ajs123 closed 2 years ago

ajs123 commented 2 years ago

For my application, I'd like to be able to read Vdd. The nrf52 allows this by selecting SAADC channel 9.

I see three options for where to put this:

  1. Add readVdd() to wiring_analog_nrf52.c.
  2. Add a pin for Vdd so that it can be selected in analogRead().
  3. Make analogReadInternal() public in wiring_analog_nrf52.h so that channel 9 can be chosen.

I think the best way is #1 but I wanted to check before adding the code. I'll follow with a PR.

Thanks!

lyusupov commented 2 years ago
  1. Add readVdd() to wiring_analog_nrf52.c.

https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/7770246e2590f4e0b81676c4d1a199ab2055f9f6/cores/nRF5/wiring_analog_nRF52.c#L282

ajs123 commented 2 years ago

I missed it! Duh!