The rapper class to move it like MotionEvent in Android.
Embed:
(wiki syntax)
Show/hide line numbers
MotionEventConverter.h
Go to the documentation of this file.
00001 /* mbed Microcontroller Library 00002 * Copyright (C) 2016 Renesas Electronics Corporation. All rights reserved. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 /**************************************************************************//** 00017 * @file MotionEventConverter.h 00018 * @brief MotionEventConverter API 00019 ******************************************************************************/ 00020 00021 #ifndef MOTION_EVENT_CONVERTER_H 00022 #define MOTION_EVENT_CONVERTER_H 00023 00024 #include "mbed.h" 00025 #include "rtos.h" 00026 #include "MotionEvent.h" 00027 #include "TouchKey.h" 00028 00029 /** 00030 * A class to communicate a MotionEventConverter 00031 */ 00032 class MotionEventConverter { 00033 00034 public: 00035 /** Constructor 00036 * 00037 */ 00038 MotionEventConverter(); 00039 00040 /** Run the touch panel process. 00041 * 00042 * @param fptr A pointer to a void function 00043 * @param p_touch pointer of TouchKey class 00044 */ 00045 void Process(int (*fptr)(MotionEvent event), TouchKey * p_touch) { 00046 _callback.attach(fptr); 00047 touch_process(p_touch); 00048 } 00049 00050 /** Run the touch panel process. 00051 * 00052 * @param tptr pointer to the object to call the member function on 00053 * @param mptr pointer to the member function to be called 00054 * @param p_touch pointer of TouchKey class 00055 */ 00056 template<typename T> 00057 void Process(T* tptr, int (T::*mptr)(MotionEvent event), TouchKey * p_touch) { 00058 _callback.attach(tptr, mptr); 00059 touch_process(p_touch); 00060 } 00061 00062 private: 00063 TouchKey * p_touch; 00064 MotionEventCtl event; 00065 Timer t; 00066 Semaphore sem_touch_int; 00067 TouchKey::touch_pos_t touch_pos[MotionEvent::TOUCH_NUM_MAX]; 00068 TouchKey::touch_pos_t touch_pos_last[MotionEvent::TOUCH_NUM_MAX]; 00069 uint32_t time_cnt; 00070 int pidx; 00071 uint8_t touch_num; 00072 uint8_t touch_num_last; 00073 FunctionPointerArg1<int, MotionEvent> _callback; 00074 00075 void touch_process(TouchKey * p_touch); 00076 void touch_int_callback(void); 00077 }; 00078 00079 #endif
Generated on Mon Jul 18 2022 11:39:08 by
1.7.2