From c91fee0e09eb0386fdd55acdc8080e47a73cee69 Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Tue, 17 May 2016 11:13:23 +1000 Subject: Revised --- megalogger/touch.h | 106 ----------------------------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 megalogger/touch.h (limited to 'megalogger/touch.h') diff --git a/megalogger/touch.h b/megalogger/touch.h deleted file mode 100644 index d0e6d01..0000000 --- a/megalogger/touch.h +++ /dev/null @@ -1,106 +0,0 @@ -#define T_CLK 6 -#define T_CS 5 -#define T_DIN 4 -#define T_DOUT 3 -#define T_IRQ 2 - -#define X_CONST 240 -#define Y_CONST 320 - -#define PREC_TOUCH_CONST 10 - -#define PixSizeX 13.78 -#define PixOffsX 411 - -#define PixSizeY 11.01 -#define PixOffsY 378 - -class CTouch { -public: - void init(void) - { - pinMode(T_CLK, OUTPUT); - pinMode(T_CS, OUTPUT); - pinMode(T_DIN, OUTPUT); - pinMode(T_DOUT, INPUT); - pinMode(T_IRQ, INPUT); - - digitalWrite(T_CS, HIGH); - digitalWrite(T_CLK, HIGH); - digitalWrite(T_DIN, HIGH); - digitalWrite(T_CLK, HIGH); - } - - void writeData(unsigned char data) - { - unsigned char temp; - unsigned char nop; - unsigned char count; - - temp=data; - digitalWrite(T_CLK,LOW); - - for(count=0; count<8; count++) - { - if(temp & 0x80) - digitalWrite(T_DIN, HIGH); - else - digitalWrite(T_DIN, LOW); - temp = temp << 1; - digitalWrite(T_CLK, LOW); - nop++; - digitalWrite(T_CLK, HIGH); - nop++; - } - } - - unsigned int readData() - { - unsigned char nop; - unsigned int data = 0; - unsigned char count; - for(count=0; count<12; count++) - { - data <<= 1; - digitalWrite(T_CLK, HIGH); - nop++; - digitalWrite(T_CLK, LOW); - nop++; - if (digitalRead(T_DOUT)) - data++; - } - return(data); - } - - void read(int& x, int& y) - { - unsigned long tx=0; - unsigned long ty=0; - - digitalWrite(T_CS,LOW); - - for (int i=0; i