Andriy Makukha / Mbed 2 deprecated football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Revision:
31:a6110950f385
Parent:
30:c60b0d52b067
Child:
39:b1f864b71318
--- a/TA.h	Mon Jan 04 16:33:39 2016 +0000
+++ b/TA.h	Tue Jan 05 13:05:48 2016 +0000
@@ -69,7 +69,8 @@
 static DigitalOut cap_enable;
 static DigitalOut buzzPin;
 
-static DigitalIn touch_1;
+static class EdgeDigIn touch_1;
+// static DigitalIn touch_1;
 static DigitalIn touch_2;
 static DigitalIn touch_3;
 
@@ -107,6 +108,8 @@
 char data[DATA_SIZE];
 //static uint8_t networkID;         // network group
 
+static uint8_t buttonsRising;
+
 void post_color(uint32_t rgb);
 void mask_color(uint32_t rgb);
 void beep(uint16_t ms);
@@ -121,6 +124,7 @@
 bool recieve(Message *m);
 void spin(void);
 bool activated(void);
+void resetTouchIfStuck();
 bool tripped(void);
 uint8_t buttons(void);
 void setMask(uint8_t the_mask);
@@ -132,5 +136,19 @@
 
 };
 
+class EdgeDigIn : public InterruptIn
+{
+  public:
+    uint8_t btnMsk;
+    EdgeDigIn( PinName pin, PinMode pull=PullNone, uint8_t btnMsk=1 ) : InterruptIn( pin ), btnMsk( btnMsk )
+    {
+        mode( pull );                      // Set pull mode
+        rise( this, &EdgeDigIn::risen  );  // Attach ISR for rise
+    }
+    void risen()
+    {
+        TA::buttonsRising != btnMsk;
+    }
+};
 
 #endif