Configure wake up behavior from system off with app_button

camo gravatar image

asked 2014-11-06 16:10:40 +0100

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.

edit retag flag offensive close delete report spam

1 answer

Sort by » oldest newest most voted
stefanbirnir gravatar image

answered 2014-11-10 14:15:30 +0100


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.

edit flag offensive delete publish link more


Hi Stefan, 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!

Moritz Caspar ( 2014-11-10 16:37:23 +0100 )editconvert to answer

Yes, that would be my suggestion as well.

Stefan Birnir Sverrisson ( 2014-11-12 09:12:37 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower


Asked: 2014-11-06 16:10:40 +0100

Seen: 1,123 times

Last updated: nov. 10 '14