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.
Dependencies: mbed mbed-rtos X_NUCLEO_IHM02A1
Buttons.cpp
00001 #include "SETUP.h" 00002 00003 extern volatile bool buttonSTART_pressed; // Used in the main loop 00004 extern volatile bool buttonSTART_enabled; // Used for debouncing 00005 extern Timeout buttonSTART_timeout; // Used for debouncing 00006 00007 // Enables button when bouncing is over 00008 void buttonSTART_enabled_cb(void) 00009 { 00010 buttonSTART_enabled = true; 00011 } 00012 void buttonSTART_diable_cb(void) 00013 { 00014 buttonSTART_enabled = false; 00015 } 00016 00017 // ISR handling button pressed event 00018 void buttonSTART_onpressed_cb(void) 00019 { 00020 if (buttonSTART_enabled) { // Disabled while the button is bouncing 00021 buttonSTART_enabled = false; 00022 buttonSTART_pressed = true; // To be read by the main loop 00023 00024 buttonSTART_timeout.attach(callback(buttonSTART_enabled_cb), 0.03); // Debounce time 300 ms 00025 } 00026 } 00027 00028 00029 00030
Generated on Fri Jul 15 2022 00:06:57 by
1.7.2