Aa

Dependents:   EMBEED_III_zad_4 mbed3 mbed_3 MBED3_zad4

Revision:
1:374a3d1fe780
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard.cpp	Sat Jun 13 13:28:40 2020 +0000
@@ -0,0 +1,32 @@
+#include "Keyboard.h"
+
+Keyboard::Keyboard(unsigned char ucColumnMode)
+{
+    ts.Init(240, 320);
+    ucTouchscreenColumn = 80*ucColumnMode;
+}
+
+enum KeyboardState Keyboard::eRead()
+{
+    ts.GetState(&TS_State);
+    if(TS_State.TouchDetected)
+    {
+        if((TS_State.X > ucTouchscreenColumn) && (TS_State.X < ucTouchscreenColumn+80))
+        {   
+            if(TS_State.Y < 80)
+                return BUTTON_0;
+            else if((TS_State.Y > 80) && (TS_State.Y < 160))
+                return BUTTON_1;               
+            else if((TS_State.Y > 160) && (TS_State.Y < 240))
+                return BUTTON_2;                      
+            else if(TS_State.Y > 240)
+                return BUTTON_3;
+            else
+                return RELEASED;
+        }
+        else
+            return RELEASED;
+    }
+    else
+        return RELEASED;  
+}
\ No newline at end of file