touch screen handler for the microchip AR1020
Diff: touchpanel.h
- Revision:
- 4:510ea5b28a05
- Parent:
- 0:cf4dd04052e3
diff -r b7eb3b3fe79f -r 510ea5b28a05 touchpanel.h --- a/touchpanel.h Tue Feb 22 22:54:25 2011 +0000 +++ b/touchpanel.h Thu Feb 24 14:00:17 2011 +0000 @@ -29,21 +29,69 @@ class TouchPanel { public: + /** + initialize the controller + */ virtual void init()=0; + + /** + read X coordinate (from last update) + @returns last known X coordinate + */ virtual int x()=0; + /** + read Y coordinate (from last update) + @returns last known Y coordinate + */ virtual int y()=0; + + /** + @return 0 if pen is up, >0 if pen is down (maybe different due to touch pressure, if supported) + */ virtual int pen()=0; + + /** + read coordinates on request + */ virtual void read()=0; class T; + + /** + attach listener called on 'pen-down' + @params item the callback object + @params method the callback method + */ template<class T> void attachPenDown(T* item, uint32_t (T::*method)(uint32_t)) { _callbackPD.attach(item, method); } + /** + attach listener called on 'pen-down' + @params function the callback function + */ void attachPenDown(uint32_t (*function)(uint32_t)) { _callbackPD.attach(function); } + /** + attach listener called on 'pen-move' + @params item the callback object + @params method the callback method + */ template<class T> void attachPenMove(T* item, uint32_t (T::*method)(uint32_t)) { _callbackPM.attach(item, method); } + /** + attach listener called on 'pen-move' + @params function the callback function + */ void attachPenMove(uint32_t (*function)(uint32_t)) { _callbackPM.attach(function); } + /** + attach listener called on 'pen-up' + @params item the callback object + @params method the callback method + */ template<class T> void attachPenUp(T* item, uint32_t (T::*method)(uint32_t)) { _callbackPU.attach(item, method); } + /** + attach listener called on 'pen-up' + @params function the callback function + */ void attachPenUp(uint32_t (*function)(uint32_t)) { _callbackPU.attach(function); } protected: