Skip to content

Commit

Permalink
Fix remaining low power pin watch regression - Bangle.off now works a…
Browse files Browse the repository at this point in the history
…gain (fix #1995)
  • Loading branch information
gfwilliams committed Apr 7, 2021
1 parent 14969b4 commit bdd2977
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libs/banglejs/jswrap_bangle.c
Expand Up @@ -3459,12 +3459,16 @@ static void jswrap_banglejs_periph_off() {
#endif

#ifdef BTN2_PININDEX
nrf_gpio_cfg_sense_set(BTN2_PININDEX, NRF_GPIO_PIN_NOSENSE);
nrf_gpio_cfg_sense_set(pinInfo[BTN2_PININDEX].pin, NRF_GPIO_PIN_NOSENSE);
#endif
#ifdef BTN3_PININDEX
nrf_gpio_cfg_sense_set(BTN3_PININDEX, NRF_GPIO_PIN_NOSENSE);
nrf_gpio_cfg_sense_set(pinInfo[BTN3_PININDEX].pin, NRF_GPIO_PIN_NOSENSE);
#endif
nrf_gpio_cfg_sense_set(BTN1_PININDEX, NRF_GPIO_PIN_SENSE_LOW);
/* The low power pin watch code (nrf_drv_gpiote_in_init) somehow causes
the sensing to be disabled such that nrf_gpio_cfg_sense_set(pin, NRF_GPIO_PIN_SENSE_LOW)
no longer works. To work around this we just call our standard pin watch function
to re-enable everything. */
jshPinWatch(BTN1_PININDEX, true);
#else
jsExceptionHere(JSET_ERROR, ".off not implemented on emulator");
#endif
Expand All @@ -3484,6 +3488,7 @@ void jswrap_banglejs_off() {
#ifndef EMSCRIPTEN
jswrap_banglejs_periph_off();
sd_power_system_off();
while(1);
#else
jsExceptionHere(JSET_ERROR, ".off not implemented on emulator");
#endif
Expand Down

0 comments on commit bdd2977

Please sign in to comment.