AGH UST mbed part 3
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Keyboard.cpp@4:459a0389bb9f, 2020-06-16 (annotated)
- Committer:
- matis755
- Date:
- Tue Jun 16 09:35:53 2020 +0000
- Revision:
- 4:459a0389bb9f
- Parent:
- 2:db40a2b0b177
dd
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 | 4:459a0389bb9f | 11 | |
matis755 | 4:459a0389bb9f | 12 | for(unsigned char ucButton=BUTTON_0; ucButton<=BUTTON_3; ++ucButton) { |
matis755 | 4:459a0389bb9f | 13 | KeyboardState btn_idx = static_cast<KeyboardState>(ucButton); |
matis755 | 4:459a0389bb9f | 14 | if ((TS_State.TouchDetected) && (TS_State.Y > 80*(btn_idx-1) ) && (TS_State.Y < btn_idx*80) && (TS_State.X > (80 * ucColIdx)) && (TS_State.X < (80 * (ucColIdx + 1)))){ |
matis755 | 4:459a0389bb9f | 15 | return btn_idx; |
matis755 | 4:459a0389bb9f | 16 | } |
matis755 | 0:f4a48c08fea7 | 17 | } |
matis755 | 4:459a0389bb9f | 18 | return RELASED; |
matis755 | 0:f4a48c08fea7 | 19 | } |