code review

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Committer:
thepaueu
Date:
Thu May 14 18:45:14 2020 +0000
Revision:
0:db2c7dc10f89
Pawel Majtas cw 2d2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thepaueu 0:db2c7dc10f89 1 #include "KeyboardTs.h"
thepaueu 0:db2c7dc10f89 2
thepaueu 0:db2c7dc10f89 3
thepaueu 0:db2c7dc10f89 4 KeyboardTs::KeyboardTs(unsigned char ucStartCol){
thepaueu 0:db2c7dc10f89 5 ucColumn = ucStartCol;
thepaueu 0:db2c7dc10f89 6 }
thepaueu 0:db2c7dc10f89 7
thepaueu 0:db2c7dc10f89 8 enum BUTTON KeyboardTs::eRead(void){
thepaueu 0:db2c7dc10f89 9 int x,y;
thepaueu 0:db2c7dc10f89 10
thepaueu 0:db2c7dc10f89 11 TS_StateTypeDef TS_State;
thepaueu 0:db2c7dc10f89 12 ts.GetState(&TS_State);
thepaueu 0:db2c7dc10f89 13 if (TS_State.TouchDetected){
thepaueu 0:db2c7dc10f89 14 x = TS_State.X;
thepaueu 0:db2c7dc10f89 15 y = TS_State.Y;
thepaueu 0:db2c7dc10f89 16 }
thepaueu 0:db2c7dc10f89 17 if(TS_State.TouchDetected && x>= ucColumn*80 && x <= 80*(ucColumn+1) ){
thepaueu 0:db2c7dc10f89 18
thepaueu 0:db2c7dc10f89 19 if(y>=0 && y<=80)
thepaueu 0:db2c7dc10f89 20 return BUTTON_0;
thepaueu 0:db2c7dc10f89 21 else if(y>=81 && y<=160)
thepaueu 0:db2c7dc10f89 22 return BUTTON_1;
thepaueu 0:db2c7dc10f89 23 else if(y>=161 && y<=240)
thepaueu 0:db2c7dc10f89 24 return BUTTON_2;
thepaueu 0:db2c7dc10f89 25 else if(y>=241 && y<=320)
thepaueu 0:db2c7dc10f89 26 return BUTTON_3;
thepaueu 0:db2c7dc10f89 27 }
thepaueu 0:db2c7dc10f89 28 else
thepaueu 0:db2c7dc10f89 29 return NONE;
thepaueu 0:db2c7dc10f89 30
thepaueu 0:db2c7dc10f89 31 }