touch screen handler for the microchip AR1020

Committer:
hlipka
Date:
Mon Feb 21 22:29:40 2011 +0000
Revision:
0:cf4dd04052e3
Child:
4:510ea5b28a05

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hlipka 0:cf4dd04052e3 1 /*
hlipka 0:cf4dd04052e3 2 * mbed AR1020 library
hlipka 0:cf4dd04052e3 3 * Copyright (c) 2010 Hendrik Lipka
hlipka 0:cf4dd04052e3 4 *
hlipka 0:cf4dd04052e3 5 * Permission is hereby granted, free of charge, to any person obtaining a copy
hlipka 0:cf4dd04052e3 6 * of this software and associated documentation files (the "Software"), to deal
hlipka 0:cf4dd04052e3 7 * in the Software without restriction, including without limitation the rights
hlipka 0:cf4dd04052e3 8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
hlipka 0:cf4dd04052e3 9 * copies of the Software, and to permit persons to whom the Software is
hlipka 0:cf4dd04052e3 10 * furnished to do so, subject to the following conditions:
hlipka 0:cf4dd04052e3 11 *
hlipka 0:cf4dd04052e3 12 * The above copyright notice and this permission notice shall be included in
hlipka 0:cf4dd04052e3 13 * all copies or substantial portions of the Software.
hlipka 0:cf4dd04052e3 14 *
hlipka 0:cf4dd04052e3 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
hlipka 0:cf4dd04052e3 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
hlipka 0:cf4dd04052e3 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
hlipka 0:cf4dd04052e3 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
hlipka 0:cf4dd04052e3 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
hlipka 0:cf4dd04052e3 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
hlipka 0:cf4dd04052e3 21 * THE SOFTWARE.
hlipka 0:cf4dd04052e3 22 */
hlipka 0:cf4dd04052e3 23
hlipka 0:cf4dd04052e3 24 #ifndef __TOUCHPANEL_H_
hlipka 0:cf4dd04052e3 25 #define __TOUCHPANEL_H_
hlipka 0:cf4dd04052e3 26
hlipka 0:cf4dd04052e3 27 #include "FPointer.h"
hlipka 0:cf4dd04052e3 28
hlipka 0:cf4dd04052e3 29 class TouchPanel
hlipka 0:cf4dd04052e3 30 {
hlipka 0:cf4dd04052e3 31 public:
hlipka 0:cf4dd04052e3 32 virtual void init()=0;
hlipka 0:cf4dd04052e3 33 virtual int x()=0;
hlipka 0:cf4dd04052e3 34 virtual int y()=0;
hlipka 0:cf4dd04052e3 35 virtual int pen()=0;
hlipka 0:cf4dd04052e3 36 virtual void read()=0;
hlipka 0:cf4dd04052e3 37
hlipka 0:cf4dd04052e3 38 class T;
hlipka 0:cf4dd04052e3 39 template<class T>
hlipka 0:cf4dd04052e3 40 void attachPenDown(T* item, uint32_t (T::*method)(uint32_t)) { _callbackPD.attach(item, method); }
hlipka 0:cf4dd04052e3 41 void attachPenDown(uint32_t (*function)(uint32_t)) { _callbackPD.attach(function); }
hlipka 0:cf4dd04052e3 42 template<class T>
hlipka 0:cf4dd04052e3 43 void attachPenMove(T* item, uint32_t (T::*method)(uint32_t)) { _callbackPM.attach(item, method); }
hlipka 0:cf4dd04052e3 44 void attachPenMove(uint32_t (*function)(uint32_t)) { _callbackPM.attach(function); }
hlipka 0:cf4dd04052e3 45 template<class T>
hlipka 0:cf4dd04052e3 46 void attachPenUp(T* item, uint32_t (T::*method)(uint32_t)) { _callbackPU.attach(item, method); }
hlipka 0:cf4dd04052e3 47 void attachPenUp(uint32_t (*function)(uint32_t)) { _callbackPU.attach(function); }
hlipka 0:cf4dd04052e3 48
hlipka 0:cf4dd04052e3 49 protected:
hlipka 0:cf4dd04052e3 50 FPointer _callbackPD;
hlipka 0:cf4dd04052e3 51 FPointer _callbackPM;
hlipka 0:cf4dd04052e3 52 FPointer _callbackPU;
hlipka 0:cf4dd04052e3 53 };
hlipka 0:cf4dd04052e3 54
hlipka 0:cf4dd04052e3 55
hlipka 0:cf4dd04052e3 56 #endif