Minh Nguyen / Pushbutton
Revision:
4:3f905ce43f2b
Parent:
3:03c78d8b7dfc
Child:
5:0417f54d0519
--- a/Pushbutton.cpp	Fri Mar 12 00:21:54 2021 +0000
+++ b/Pushbutton.cpp	Fri Mar 12 01:08:03 2021 +0000
@@ -9,8 +9,9 @@
 Pushbutton::Pushbutton(PinName bt) : button(bt),buttonInt(bt){
     busy = 0;
 }
-Pushbutton::Pushbutton(PinName bt, int* state) : buttonInt(bt),button(bt){
+Pushbutton::Pushbutton(PinName bt, int* state, int* flagIn) : buttonInt(bt),button(bt){
     busy = 0;
+    flag = flagIn;
     mode = state;
     if(INPUT_LOGIC == 0)
     {
@@ -46,6 +47,7 @@
     wait_us(DEBOUNCE_TIME);
     if(read()) //If received input
     {
+        *flag = 1;
         while((int)timer_read_s(t) <= TIME_WSETTING) //check if button is held to the threshold
         {
             if(buttonInt.read() != INPUT_LOGIC) //check if button is released