touch screen handler for the microchip AR1020
Diff: AreaTouchHandler.cpp
- Revision:
- 3:b7eb3b3fe79f
- Parent:
- 1:264ad2a00fd9
- Child:
- 4:510ea5b28a05
--- a/AreaTouchHandler.cpp Tue Feb 22 22:11:49 2011 +0000 +++ b/AreaTouchHandler.cpp Tue Feb 22 22:54:25 2011 +0000 @@ -29,6 +29,7 @@ uint32_t AreaTouchHandler::down(uint32_t arg) { TouchEvent *te=(TouchEvent*)arg; +// printf("d %i/%i\n",te->x,te->y); _x=te->x; _y=te->y; _samples=1; @@ -46,7 +47,7 @@ if (_called) return 0; TouchEvent *te=(TouchEvent*)arg; - printf("%i\n",te->y); +// printf("m %i/%i\n",te->x,te->y); _x=(te->x+_x*_samples)/(_samples+1); _y=(te->y+_y*_samples)/(_samples+1); _samples++; @@ -60,7 +61,6 @@ } uint32_t AreaTouchHandler::up(uint32_t arg) { - printf("up\n"); _x=0; _y=0; _samples=0; @@ -72,14 +72,12 @@ { if (_called) return 0; - if (_samples<3) + if (_samples<5) return 0; - printf("%f\n",_y); for (list<area*>::iterator it = _areas.begin(); it != _areas.end(); it++) { area* a=*it; if (_x>=a->left && _x<=a->right && _y>=a->top && _y<=a->bottom) return a->command; } - printf(".\n"); return 0; }