AGH UST mbed part 3
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Keyboard.cpp@2:db40a2b0b177, 2020-05-23 (annotated)
- Committer:
- matis755
- Date:
- Sat May 23 07:11:44 2020 +0000
- Revision:
- 2:db40a2b0b177
- Parent:
- Keyboard_Ts.cpp@1:36b3fd4a01fd
- Child:
- 4:459a0389bb9f
Make class Led to drive each one directly;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
matis755 | 2:db40a2b0b177 | 1 | #include "Keyboard.h" |
matis755 | 0:f4a48c08fea7 | 2 | |
matis755 | 2:db40a2b0b177 | 3 | Keyboard::Keyboard(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 | 2:db40a2b0b177 | 8 | enum KeyboardState Keyboard::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 | 1:36b3fd4a01fd | 12 | return BUTTON_0; |
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 | 1:36b3fd4a01fd | 15 | return BUTTON_1; |
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 | 1:36b3fd4a01fd | 18 | return BUTTON_2; |
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 | 1:36b3fd4a01fd | 21 | return BUTTON_3; |
matis755 | 0:f4a48c08fea7 | 22 | } |
matis755 | 0:f4a48c08fea7 | 23 | else{ |
matis755 | 0:f4a48c08fea7 | 24 | return RELASED; |
matis755 | 0:f4a48c08fea7 | 25 | } |
matis755 | 0:f4a48c08fea7 | 26 | } |