Oddness with multiple \'InterruptIn\'s

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Kemp
Date:
Wed Mar 30 15:54:35 2011 +0000
Parent:
0:ba602786a4c1
Commit message:

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ba602786a4c1 -r 0228f6b60488 main.cpp
--- a/main.cpp	Wed Mar 30 15:53:03 2011 +0000
+++ b/main.cpp	Wed Mar 30 15:54:35 2011 +0000
@@ -6,30 +6,21 @@
 InterruptIn button2(p11);
 InterruptIn button3(p10);
 
-Timeout button1_debounce;
-Timeout button2_debounce;
-Timeout button3_debounce;
-
 void button1_pressed() {pc.printf("Button 1");}
 void button2_pressed() {pc.printf("Button 2");}
 void button3_pressed() {pc.printf("Button 3");}
 
-void button1_press() {button1_debounce.attach(button1_pressed, 0.3);}
-void button2_press() {button2_debounce.attach(button2_pressed, 0.3);}
-void button3_press() {button3_debounce.attach(button3_pressed, 0.3);}
-
-
 int main()
 {
     // Set up buttons
     button1.mode(PullDown);
-    button1.rise(&button1_press);
+    button1.rise(&button1_pressed);
     
     button2.mode(PullDown);
-    button2.rise(&button2_press);
+    button2.rise(&button2_pressed);
     
     button3.mode(PullDown);
-    button3.rise(&button3_press);
+    button3.rise(&button3_pressed);
     
     while (1);
 }
\ No newline at end of file