Aa

Dependents:   EMBEED_III_zad_4 mbed3 mbed_3 MBED3_zad4

Committer:
krzysiek99
Date:
Sat Jun 13 13:28:40 2020 +0000
Revision:
1:374a3d1fe780
Keyboard;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
krzysiek99 1:374a3d1fe780 1 #include "Keyboard.h"
krzysiek99 1:374a3d1fe780 2
krzysiek99 1:374a3d1fe780 3 Keyboard::Keyboard(unsigned char ucColumnMode)
krzysiek99 1:374a3d1fe780 4 {
krzysiek99 1:374a3d1fe780 5 ts.Init(240, 320);
krzysiek99 1:374a3d1fe780 6 ucTouchscreenColumn = 80*ucColumnMode;
krzysiek99 1:374a3d1fe780 7 }
krzysiek99 1:374a3d1fe780 8
krzysiek99 1:374a3d1fe780 9 enum KeyboardState Keyboard::eRead()
krzysiek99 1:374a3d1fe780 10 {
krzysiek99 1:374a3d1fe780 11 ts.GetState(&TS_State);
krzysiek99 1:374a3d1fe780 12 if(TS_State.TouchDetected)
krzysiek99 1:374a3d1fe780 13 {
krzysiek99 1:374a3d1fe780 14 if((TS_State.X > ucTouchscreenColumn) && (TS_State.X < ucTouchscreenColumn+80))
krzysiek99 1:374a3d1fe780 15 {
krzysiek99 1:374a3d1fe780 16 if(TS_State.Y < 80)
krzysiek99 1:374a3d1fe780 17 return BUTTON_0;
krzysiek99 1:374a3d1fe780 18 else if((TS_State.Y > 80) && (TS_State.Y < 160))
krzysiek99 1:374a3d1fe780 19 return BUTTON_1;
krzysiek99 1:374a3d1fe780 20 else if((TS_State.Y > 160) && (TS_State.Y < 240))
krzysiek99 1:374a3d1fe780 21 return BUTTON_2;
krzysiek99 1:374a3d1fe780 22 else if(TS_State.Y > 240)
krzysiek99 1:374a3d1fe780 23 return BUTTON_3;
krzysiek99 1:374a3d1fe780 24 else
krzysiek99 1:374a3d1fe780 25 return RELEASED;
krzysiek99 1:374a3d1fe780 26 }
krzysiek99 1:374a3d1fe780 27 else
krzysiek99 1:374a3d1fe780 28 return RELEASED;
krzysiek99 1:374a3d1fe780 29 }
krzysiek99 1:374a3d1fe780 30 else
krzysiek99 1:374a3d1fe780 31 return RELEASED;
krzysiek99 1:374a3d1fe780 32 }