a
Keyboard_Ts.cpp@0:8a0ef2058732, 2016-04-23 (annotated)
- Committer:
- Dom952
- Date:
- Sat Apr 23 17:52:16 2016 +0000
- Revision:
- 0:8a0ef2058732
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Dom952 | 0:8a0ef2058732 | 1 | #include "Keyboard_Ts.h" |
Dom952 | 0:8a0ef2058732 | 2 | |
Dom952 | 0:8a0ef2058732 | 3 | KeyboardTs::KeyboardTs (unsigned char _ucColumn) |
Dom952 | 0:8a0ef2058732 | 4 | { |
Dom952 | 0:8a0ef2058732 | 5 | Column = _ucColumn; |
Dom952 | 0:8a0ef2058732 | 6 | } |
Dom952 | 0:8a0ef2058732 | 7 | |
Dom952 | 0:8a0ef2058732 | 8 | enum KeyboardTsState KeyboardTs::eRead( void ) |
Dom952 | 0:8a0ef2058732 | 9 | { |
Dom952 | 0:8a0ef2058732 | 10 | ts.GetState(&TS_State); |
Dom952 | 0:8a0ef2058732 | 11 | x = TS_State.X; |
Dom952 | 0:8a0ef2058732 | 12 | y = TS_State.Y; |
Dom952 | 0:8a0ef2058732 | 13 | if (TS_State.TouchDetected) |
Dom952 | 0:8a0ef2058732 | 14 | { |
Dom952 | 0:8a0ef2058732 | 15 | if ( ( x > Column*80 ) && ( x <= (Column+1)*80 ) && ( y > 0 ) && ( y < 80 ) ) |
Dom952 | 0:8a0ef2058732 | 16 | { |
Dom952 | 0:8a0ef2058732 | 17 | return BUTTON_0; |
Dom952 | 0:8a0ef2058732 | 18 | } |
Dom952 | 0:8a0ef2058732 | 19 | else if ( ( x > Column*80 ) && ( x <= (Column+1)*80 ) && ( y >= 80 ) && ( y < 160 ) ) |
Dom952 | 0:8a0ef2058732 | 20 | { |
Dom952 | 0:8a0ef2058732 | 21 | return BUTTON_1; |
Dom952 | 0:8a0ef2058732 | 22 | } |
Dom952 | 0:8a0ef2058732 | 23 | else if ( ( x > Column*80 ) && ( x <= (Column+1)*80 ) && ( y >= 160 ) && ( y < 240 ) ) |
Dom952 | 0:8a0ef2058732 | 24 | { |
Dom952 | 0:8a0ef2058732 | 25 | return BUTTON_2; |
Dom952 | 0:8a0ef2058732 | 26 | } |
Dom952 | 0:8a0ef2058732 | 27 | else if ( ( x > Column*80 ) && ( x <= (Column+1)*80 ) && ( y >= 240 ) && ( y < 320 ) ) |
Dom952 | 0:8a0ef2058732 | 28 | { |
Dom952 | 0:8a0ef2058732 | 29 | return BUTTON_3; |
Dom952 | 0:8a0ef2058732 | 30 | } |
Dom952 | 0:8a0ef2058732 | 31 | } |
Dom952 | 0:8a0ef2058732 | 32 | return RELASED; |
Dom952 | 0:8a0ef2058732 | 33 | } |