a

Dependents:   2c

Keyboard_Ts.cpp

Committer:
Dom952
Date:
2016-04-23
Revision:
0:8e2c3c55da79

File content as of revision 0:8e2c3c55da79:

#include "Keyboard_Ts.h"

KeyboardTs::KeyboardTs (unsigned char _ucColumn)
{
    Column = _ucColumn;
}

enum KeyboardTsState KeyboardTs::eRead( void )
{
    ts.GetState(&TS_State);
    x = TS_State.X;
    y = TS_State.Y;
    if (TS_State.TouchDetected)
        {
               if ( ( x > Column*80 ) && ( x <= (Column+1)*80 ) && ( y > 0 ) && ( y < 80 ) )
               {
                    return BUTTON_0;
               } 
               else if ( ( x > Column*80 ) && ( x <= (Column+1)*80 ) && ( y >= 80 ) && ( y < 160 ) )
               {
                    return BUTTON_1;
               }
               else if ( ( x > Column*80 ) && ( x <= (Column+1)*80 ) && ( y >= 160 ) && ( y < 240 ) )
               {
                    return BUTTON_2;
               }
               else if ( ( x > Column*80 ) && ( x <= (Column+1)*80 ) && ( y >= 240 ) && ( y < 320 ) )
               {
                    return BUTTON_3;
               }
        }
    return RELASED;
}