a

Dependents:   2b

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Keyboard_Ts.cpp Source File

Keyboard_Ts.cpp

00001 #include "Keyboard_Ts.h"
00002 
00003 KeyboardTs::KeyboardTs (void)
00004 {}
00005 
00006 enum KeyboardTsState KeyboardTs::eRead( void )
00007 {
00008     ts.GetState(&TS_State);
00009     x = TS_State.X;
00010     y = TS_State.Y;
00011     if (TS_State.TouchDetected)
00012         {
00013                if ( ( x > 0 ) && ( x <= 80 ) && ( y > 0 ) && ( y < 80 ) )
00014                {
00015                     return BUTTON_0;
00016                } 
00017                else if ( ( x > 0 ) && ( x <= 80 ) && ( y >= 80 ) && ( y < 160 ) )
00018                {
00019                     return BUTTON_1;
00020                }
00021                else if ( ( x > 0 ) && ( x <= 80 ) && ( y >= 160 ) && ( y < 240 ) )
00022                {
00023                     return BUTTON_2;
00024                }
00025                else if ( ( x > 0 ) && ( x <= 80 ) && ( y >= 240 ) && ( y < 320 ) )
00026                {
00027                     return BUTTON_3;
00028                }
00029         }
00030     return RELASED;
00031 }