Optimized polling keybolard reading

Dependents:   design_project

Revision:
0:7082c7132e50
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keypad3x4polling.h	Tue May 12 14:50:28 2015 +0000
@@ -0,0 +1,45 @@
+#ifndef KEYPAD3x4POLLING_H
+#define KEYPAD3x4POLLING_H
+
+#include "BusOut.h"
+#include "BusIn.h"
+
+#define NO_PRESS 10
+
+namespace mbed
+{                  
+    class Keypad
+    {    
+        public:
+            Keypad(PinName col1,PinName col2,PinName col3,PinName row1,PinName row2,PinName row3,PinName row4);
+            char read();
+        protected:
+            BusIn _cols;    
+            BusOut _rows;
+    };
+}
+#endif
+
+/*SIMPLE EXAMPLE
+
+#include "mbed.h"
+#include "Keypad3x4polling.h"
+
+Serial pc(USBTX,USBRX);
+
+Keypad Keyboard(p17,p16,p15,p10,p9,p8,p7);
+
+int main() 
+{       
+    char button;  
+    pc.printf("Premi un tasto:");
+    while(1)
+    {
+        button = Keyboard.read();
+        if(button != NO_PRESS)
+            pc.putc(button);  
+        wait(0.2);             
+    }    
+}
+
+*/
\ No newline at end of file