a
Revision 0:8a0ef2058732, committed 2016-04-23
- Comitter:
- Dom952
- Date:
- Sat Apr 23 17:52:16 2016 +0000
- Commit message:
- a
Changed in this revision
Keyboard_Ts.cpp | Show annotated file Show diff for this revision Revisions of this file |
Keyboard_Ts.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 8a0ef2058732 Keyboard_Ts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts.cpp Sat Apr 23 17:52:16 2016 +0000 @@ -0,0 +1,33 @@ +#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; +}
diff -r 000000000000 -r 8a0ef2058732 Keyboard_Ts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts.h Sat Apr 23 17:52:16 2016 +0000 @@ -0,0 +1,19 @@ +#ifndef KEYBOARD_TS_H +#define KEYBOARD_TS_H + +#include "TS_DISCO_F429ZI.h" + +enum KeyboardTsState { RELASED , BUTTON_0 , BUTTON_1 , BUTTON_2 , BUTTON_3 }; + +class KeyboardTs{ +public: + KeyboardTs (unsigned char); + enum KeyboardTsState eRead (void); +private: + unsigned char Column; + uint16_t x, y; + TS_DISCO_F429ZI ts; + TS_StateTypeDef TS_State; +}; + +#endif \ No newline at end of file