Declaration class (driver for) of touchpanel based on ADS7843 or XPT2046

Dependents:   TFT_MyTouch

Committer:
micchassek
Date:
Fri Nov 28 22:33:06 2014 +0000
Revision:
0:bd11ac9148e2
Wersja perwsza v1.0 do rozbudowy

Who changed what in which revision?

UserRevisionLine numberNew contents of line
micchassek 0:bd11ac9148e2 1 // MyTouch.h - Declaration class (driver for) of touchpanel based on ADS7843 or XPT2046
micchassek 0:bd11ac9148e2 2 // version: 1.0
micchassek 0:bd11ac9148e2 3 // author: Mchał Pyszka
micchassek 0:bd11ac9148e2 4 // date: 28 NOV 2014
micchassek 0:bd11ac9148e2 5 //
micchassek 0:bd11ac9148e2 6 #ifndef MyTouch_h
micchassek 0:bd11ac9148e2 7 #define MyTOUCH_H
micchassek 0:bd11ac9148e2 8
micchassek 0:bd11ac9148e2 9 #include "mbed.h"
micchassek 0:bd11ac9148e2 10
micchassek 0:bd11ac9148e2 11 #define USE_12BITS 0
micchassek 0:bd11ac9148e2 12 #define USE_8BITS 2
micchassek 0:bd11ac9148e2 13
micchassek 0:bd11ac9148e2 14 #define TP_GETX_8BIT 0x98
micchassek 0:bd11ac9148e2 15 #define TP_GETY_8BIT 0xD8
micchassek 0:bd11ac9148e2 16 #define TP_GETX_12BIT 0x90
micchassek 0:bd11ac9148e2 17 #define TP_GETY_12BIT 0xD0
micchassek 0:bd11ac9148e2 18
micchassek 0:bd11ac9148e2 19 #define TP_X 0
micchassek 0:bd11ac9148e2 20 #define TP_Y 1
micchassek 0:bd11ac9148e2 21
micchassek 0:bd11ac9148e2 22 #define TP_FREQUENCY 500000
micchassek 0:bd11ac9148e2 23
micchassek 0:bd11ac9148e2 24 class MYTOUCH
micchassek 0:bd11ac9148e2 25 {
micchassek 0:bd11ac9148e2 26 public:
micchassek 0:bd11ac9148e2 27 MYTOUCH(PinName _tp_mosi, PinName _tp_miso, PinName _tp_sclk, PinName _tp_cs, PinName _tp_irq, unsigned char _resolution, void (*pointer_To_TP_IRQ_Handler)(void)) ;
micchassek 0:bd11ac9148e2 28 unsigned int TP_GetX(){return TP_Get(TP_X);}
micchassek 0:bd11ac9148e2 29 unsigned int TP_GetY(){return TP_Get(TP_Y);}
micchassek 0:bd11ac9148e2 30 void TP_ChangeMode(unsigned char _tp_mode){tp_mode = _tp_mode ;}
micchassek 0:bd11ac9148e2 31 protected:
micchassek 0:bd11ac9148e2 32 unsigned int TP_Get(unsigned char XY) ;
micchassek 0:bd11ac9148e2 33
micchassek 0:bd11ac9148e2 34 unsigned char tp_mode ;
micchassek 0:bd11ac9148e2 35 SPI tp_spi ;
micchassek 0:bd11ac9148e2 36 DigitalOut tp_cs ;
micchassek 0:bd11ac9148e2 37 InterruptIn tp_irqhandler ;
micchassek 0:bd11ac9148e2 38 unsigned char argument_type[4] ;
micchassek 0:bd11ac9148e2 39 } ;
micchassek 0:bd11ac9148e2 40
micchassek 0:bd11ac9148e2 41 #endif