AGH MTM PPO MBED
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Keyboard_Ts.cpp@0:f4a48c08fea7, 2020-05-07 (annotated)
- Committer:
- matis755
- Date:
- Thu May 07 15:13:01 2020 +0000
- Revision:
- 0:f4a48c08fea7
- Child:
- 1:36b3fd4a01fd
2d1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
matis755 | 0:f4a48c08fea7 | 1 | #include "Keyboard_Ts.h" |
matis755 | 0:f4a48c08fea7 | 2 | |
matis755 | 0:f4a48c08fea7 | 3 | KeyboardTs::KeyboardTs(unsigned char ucIdx) { |
matis755 | 0:f4a48c08fea7 | 4 | ucColIdx = ucIdx; |
matis755 | 0:f4a48c08fea7 | 5 | Init(240,320); |
matis755 | 0:f4a48c08fea7 | 6 | } |
matis755 | 0:f4a48c08fea7 | 7 | |
matis755 | 0:f4a48c08fea7 | 8 | enum KeyboardState KeyboardTs::eRead(void) { |
matis755 | 0:f4a48c08fea7 | 9 | TS_StateTypeDef TS_State; |
matis755 | 0:f4a48c08fea7 | 10 | GetState(&TS_State); |
matis755 | 0:f4a48c08fea7 | 11 | if ((TS_State.TouchDetected) && (TS_State.Y > 0 ) && (TS_State.Y < 80) && (TS_State.X > (80 * ucColIdx)) && (TS_State.X < (80 * (ucColIdx + 1)))) { |
matis755 | 0:f4a48c08fea7 | 12 | return BUTTON_1; |
matis755 | 0:f4a48c08fea7 | 13 | } |
matis755 | 0:f4a48c08fea7 | 14 | else if ((TS_State.TouchDetected) && (TS_State.Y > 80 ) && (TS_State.Y < 160) && (TS_State.X > (80 * ucColIdx)) && (TS_State.X < (80 * (ucColIdx + 1)))) { |
matis755 | 0:f4a48c08fea7 | 15 | return BUTTON_2; |
matis755 | 0:f4a48c08fea7 | 16 | } |
matis755 | 0:f4a48c08fea7 | 17 | else if ((TS_State.TouchDetected) && (TS_State.Y > 160 ) && (TS_State.Y < 240) && (TS_State.X > (80 * ucColIdx)) && (TS_State.X < (80 * (ucColIdx + 1)))) { |
matis755 | 0:f4a48c08fea7 | 18 | return BUTTON_3; |
matis755 | 0:f4a48c08fea7 | 19 | } |
matis755 | 0:f4a48c08fea7 | 20 | else if ((TS_State.TouchDetected) && (TS_State.Y > 240 ) && (TS_State.Y < 320) && (TS_State.X > (80 * ucColIdx)) && (TS_State.X < (80 * (ucColIdx + 1)))) { |
matis755 | 0:f4a48c08fea7 | 21 | return BUTTON_4; |
matis755 | 0:f4a48c08fea7 | 22 | } |
matis755 | 0:f4a48c08fea7 | 23 | else{ |
matis755 | 0:f4a48c08fea7 | 24 | return RELASED; |
matis755 | 0:f4a48c08fea7 | 25 | } |
matis755 | 0:f4a48c08fea7 | 26 | } |