This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

WAKEUP at LO-HI transition (not just state sense)

Hello. I'm trying to do as follows: ONE button used either to wakeup or to put system to sleep. In general almost everything is working but I cannot find how to configure sensing to LOTOHI not only just LOW on HIGH state.

I want everything to work like that:

  • PUSH button (pulled down, pressing connect it to HIGH)
  • hold it for 5 sec
  • go to interrupt, configure wakeup (the same button)
  • go to sleep (you still hold button)
  • you see now that LEDs have been turned off so you know that device is sleeping. You take finger back from button.
  • when you want to wakeup you just press button.

SO as you see wakeup interrupt only occurs when it will be LO to HI transition.

Now I have everything configured as above instead of this LO-HI transition. When it's configured as sensing HIGH, at the moment device goes to sleep when button is pressed, HIGH state pin is detected (finger is not yet removed) and it immediately wakes up. The result is that button is completely useless because I can't even put system to sleep.

All of examples looks like that: nrf_gpio_cfg_input(SWITCH_PIN, NRF_GPIO_PIN_NOPULL);

uint32_t new_cnf = NRF_GPIO->PIN_CNF[SWITCH_PIN]; uint32_t new_sense = GPIO_PIN_CNF_SENSE_High;

new_cnf &= ~GPIO_PIN_CNF_SENSE_Msk; new_cnf |= (new_sense << GPIO_PIN_CNF_SENSE_Pos);

NRF_GPIO->PIN_CNF[SWITCH_PIN] = new_cnf;

As we see it's SENSE HIGH state. Is it possible to detect LO-HI transition? Regards

Related