I'm using the APP_BUTTON_INIT-Function to register a button at the GPIOTE-System. This works great while running normally, e.g. I can react on debounced button_down or button_release events.
Magically this also works for waking from sd_power_system_off() with a rising or falling edge on my button pin. I suppose this is set somewhere inside app_gpiote.c. The PORT event and DETECT signal are also involved, as far as I have found out yet. But then ..whatever..
Now my question:
Can I configure it to only wake up when the button is pressed (falling edge) and not when it is released?
I would like to do this, so that i can go to system_off even if the user is still pressing the button. Without being rewoken, when the button is released.
Please take a look at this thread to get an overview how button presses work.
You can select if you get an interrupt on high signal, low signal, or both, when you register user in the app_gpiote library. For code reference, you can look at for example how app_button library does this in app_button_init function when registering for gpiote user with call to app_gpiote_user_register function.
for testing purpose I just changed in the app_button_init function:
// second argument is low_to_high_bitmask
Now, I do no longer get button release events, but the system still wakes on button push and button release. Looking into "app_gpiote.c" I see that every interrupt calls the function sense_level_toggle(...), which inverts the sensing. So i suppose instead of working against the system it's maybe easier for me to take the clues from app_button and app_gpiote and write my own solution for my special button behavior. Thanks anyway!
Yes, that would be my suggestion as well.