TRR 2018 / Mbed 2 deprecated biniou-TRR2019-DLVV

Dependencies:   mbed MPU6050

Revision:
4:efa207509f63
Parent:
3:1b7eb426247e
Child:
5:8bbe640528bc
--- a/utils.cpp	Sun Sep 29 00:43:58 2019 +0000
+++ b/utils.cpp	Sun Sep 29 14:58:03 2019 +0000
@@ -2,21 +2,19 @@
 
 bool b_UTILS_flag_button = false;
 bool b_UTILS_flag_emergency_stop = false;
+Timer timerSinceStart;
+
 Serial pc(USBTX, USBRX);
 InterruptIn button(USER_BUTTON);
 
 
-void init_interruptions(){
-    button.fall(&it_pressed);    
+void it_pressed()
+{
+    if(timerSinceStart.read_ms() > 500) {
+        timerSinceStart.reset();
+        pc.printf("Button pressed\r\n");
+        b_UTILS_flag_button = true;
+        b_UTILS_flag_emergency_stop = false;
+    }
+    return;
 }
-
-void it_pressed(){
-    b_UTILS_flag_button = true;
-    b_UTILS_flag_emergency_stop = false;
-    return;
-    }
-
-void initGPIOs()
-{
-    return;
-}
\ No newline at end of file