working, need to fix input bouncing

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
psahay
Date:
Sun Feb 22 20:31:08 2015 +0000
Parent:
2:54ae225e6203
Commit message:
minor changes

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 54ae225e6203 -r 3e18de5a9cce main.cpp
--- a/main.cpp	Sun Feb 22 17:59:32 2015 +0000
+++ b/main.cpp	Sun Feb 22 20:31:08 2015 +0000
@@ -63,41 +63,33 @@
         row4 = 0;
        //Keep each led lit for 4ms
        switch(t1.read_ms()%4){
-                        case 0:
-                        row1 = 1;
-                        input |= 0x10;   
-                        break;
-                        case 1:
-                        row2 = 1;
-                        input |= 0x20;
-                        break;
-                        case 2:
-                        row3 = 1;
-                        input |= 0x40;
-                        break;
-                        case 3:
-                        row4 = 1; 
-                        input |= 0x80;
-                        break; 
-            
-                         }
+                        case 0: row1 = 1;
+                                input |= 0x10;   
+                                break;
+                        case 1: row2 = 1;
+                                input |= 0x20;
+                                break;
+                        case 2: row3 = 1;
+                                input |= 0x40;
+                                break;
+                        case 3: row4 = 1; 
+                                input |= 0x80;
+                                break; }
          //Pull the value from each column and check to see if 1
          if(col1 == 1)
-         input |= 0x01;
+            input |= 0x01;
          else if(col2 == 1)
-         input |= 0x02;
+            input |= 0x02;
          else if(col3 == 1)
-         input |= 0x04;
+            input |= 0x04;
          else if(col4 == 1)
-         input |= 0x08;
-         
+            input |= 0x08;
          
          char c = keypadMap[input]; //assign charcter based on input
          //Print to the terminal the character if available 
          if(c != 0){
-         pc.printf("%c\r",c);  //print input and char
+            pc.printf("%c\r",c);  //print input and char
          }
-        
          //reset input
          input = 0x00;     
     }