Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: wakeup_button.cpp
- Revision:
- 1:eb1da9d36e12
- Child:
- 10:d2e2c79389e1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wakeup_button.cpp Tue Sep 12 16:16:43 2017 +0800 @@ -0,0 +1,40 @@ +#include "mbed.h" +#include "wakeup.h" + +#if defined(TARGET_NUMAKER_PFM_NUC472) +// SW +#define BUTTON1 SW1 +#define BUTTON2 SW2 + +#elif defined(TARGET_NUMAKER_PFM_M453) +// SW +#define BUTTON1 SW2 +#define BUTTON2 SW3 + +#elif defined(TARGET_NUMAKER_PFM_M487) +// SW +#define BUTTON1 SW2 +#define BUTTON2 SW3 + +#endif + +static InterruptIn button1(BUTTON1); +static InterruptIn button2(BUTTON2); +static void button1_release(void); +static void button2_release(void); + +void config_button_wakeup(void) +{ + button1.rise(&button1_release); + button2.rise(&button2_release); +} + +void button1_release(void) +{ + wakeup_eventflags.set(EventFlag_Wakeup_Button1); +} + +void button2_release(void) +{ + wakeup_eventflags.set(EventFlag_Wakeup_Button2); +}