blabla

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

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 #include "TS_DISCO_F429ZI.h"
00004 TS_DISCO_F429ZI ts;
00005 TS_StateTypeDef TS_State;
00006 
00007 KeyboardTs::KeyboardTs(unsigned char x){
00008     ColumnXPos = x*80;
00009     }
00010 
00011 enum KeyboardState KeyboardTs::eRead(){
00012     
00013     ts.GetState(&TS_State);
00014     
00015     if (TS_State.TouchDetected){
00016         
00017         if(((TS_State.X)>ColumnXPos) && ((TS_State.X)<ColumnXPos+80)){
00018             
00019             if(((TS_State.Y)>0)&&((TS_State.Y)<80)){
00020                 return BUTTON_0;
00021             }
00022             else if(((TS_State.Y)>81) && ((TS_State.Y)<160)){
00023                 return BUTTON_1;
00024             } 
00025             else if(((TS_State.Y)>161) && ((TS_State.Y)<240)){
00026                 return BUTTON_2;
00027             } 
00028             else if(((TS_State.Y)>241) && ((TS_State.Y)<320)){
00029                 return BUTTON_3;
00030             }
00031         }
00032     } 
00033     return NO_BUTTON;
00034  }
00035 
00036