Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: MotionEventConverter.h
- Revision:
- 1:5bfc165e8f08
- Parent:
- 0:c41d29f1e0fb
--- a/MotionEventConverter.h Tue Jun 28 13:06:53 2016 +0000
+++ b/MotionEventConverter.h Wed Jun 29 05:33:35 2016 +0000
@@ -32,22 +32,48 @@
class MotionEventConverter {
public:
+ /** Constructor
+ *
+ */
+ MotionEventConverter();
+
/** Run the touch panel process.
*
+ * @param fptr A pointer to a void function
+ * @param p_touch pointer of TouchKey class
+ */
+ void Process(int (*fptr)(MotionEvent event), TouchKey * p_touch) {
+ _callback.attach(fptr);
+ touch_process(p_touch);
+ }
+
+ /** Run the touch panel process.
*
- * @param cb_func Callback function.
+ * @param tptr pointer to the object to call the member function on
+ * @param mptr pointer to the member function to be called
+ * @param p_touch pointer of TouchKey class
*/
- void Process(TouchKey * p_touch, int (*cb_func)(MotionEvent event));
+ template<typename T>
+ void Process(T* tptr, int (T::*mptr)(MotionEvent event), TouchKey * p_touch) {
+ _callback.attach(tptr, mptr);
+ touch_process(p_touch);
+ }
private:
+ TouchKey * p_touch;
MotionEventCtl event;
Timer t;
+ Semaphore sem_touch_int;
TouchKey::touch_pos_t touch_pos[MotionEvent::TOUCH_NUM_MAX];
TouchKey::touch_pos_t touch_pos_last[MotionEvent::TOUCH_NUM_MAX];
uint32_t time_cnt;
int pidx;
uint8_t touch_num;
uint8_t touch_num_last;
+ FunctionPointerArg1<int, MotionEvent> _callback;
+
+ void touch_process(TouchKey * p_touch);
+ void touch_int_callback(void);
};
#endif