a

Dependencies:   BSP_DISCO_F429ZI LCD_DISCO_F429ZI TS_DISCO_F429ZI mbed

Fork of Mbed1d-2 by Przemyslaw Drwal

Revision:
0:9b028a92ac8a
diff -r 000000000000 -r 9b028a92ac8a Keyboard_TS.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_TS.cpp	Mon Apr 24 15:26:38 2017 +0000
@@ -0,0 +1,35 @@
+#include "TS_DISCO_F429ZI.h"
+#include "Keyboard_TS.h"
+
+TS_DISCO_F429ZI ts;
+
+
+KeyboardTs::KeyboardTs(uint8_t colnum) {
+    ts.Init(240,320);
+    if(colnum>=1 && colnum<=3) 
+        column=colnum;
+    else
+        column=1;
+    }
+    
+ enum KeyboardState KeyboardTs::eRead(void){
+    TS_StateTypeDef TS_State;
+    ts.GetState(&TS_State);
+    
+    if (TS_State.TouchDetected && TS_State.X>(80*(column-1)) && TS_State.X<80*column  &&  TS_State.Y <80){
+        return BUTTON_0;
+    }
+    else if(TS_State.TouchDetected && TS_State.X>(80*(column-1)) && TS_State.X<80*column && TS_State.Y>=80 && TS_State.Y <160){
+        return BUTTON_1;
+    }
+    else if (TS_State.TouchDetected && TS_State.X>(80*(column-1)) &&  TS_State.X<80*column && TS_State.Y>=160 && TS_State.Y <240){
+        return BUTTON_2;
+    }
+    else if (TS_State.TouchDetected && TS_State.X>(80*(column-1)) &&  TS_State.X<80*column && TS_State.Y>=240 && TS_State.Y <320){
+        return BUTTON_3;
+    }
+    else{
+        return RELASED;
+    }
+}
+   
\ No newline at end of file