Skip to content

Commit

Permalink
don't read VDDH on Bangle.js 2 as per eabd13c#commitcomment-135446714
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Jan 2, 2024
1 parent 0cb03e0 commit 91e45d6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions targets/nrf5x/jshardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -2805,7 +2805,10 @@ JsVarFloat jshReadVRef() {
config.gain = NRF_SAADC_GAIN1_6; // 1/6 of input volts
config.mode = NRF_SAADC_MODE_SINGLE_ENDED;

#if defined(NRF52833) || defined(NRF52840)
#if defined(NRF52833) || defined(NRF52840) && !defined(BANGLEJS2)
#define ESPR_VREF_VDDH
#endif
#ifdef ESPR_VREF_VDDH
config.pin_p = 0x0D; // Not in Nordic's libs, but this is VDDHDIV5 - we probably want to be looking at VDDH
config.pin_n = 0x0D;
#else
Expand All @@ -2829,7 +2832,7 @@ JsVarFloat jshReadVRef() {
f = nrf_analog_read() * (6.0 * 0.6 / 16384.0);
} while (nrf_analog_read_interrupted);
nrf_analog_read_end(adcInUse);
#if defined(NRF52833) || defined(NRF52840)
#ifdef ESPR_VREF_VDDH
f *= 5; // we were on VDDHDIV5
#endif

Expand Down

0 comments on commit 91e45d6

Please sign in to comment.