Vlad Craciun / SSD1289_TouchScreen
Revision:
0:55a3f0eda74d
Child:
1:e7ae315a1ceb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TouchPanel.h	Sat Sep 14 11:40:09 2013 +0000
@@ -0,0 +1,64 @@
+#ifndef __TOUCH_PANEL__
+#define __TOUCH_PANEL__
+
+#include "mbed.h"
+#include "ssd1289.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct POINT 
+{
+   uint16_t x;
+   uint16_t y;
+}Coordinate;
+
+typedef struct Matrix 
+{                       
+    long double An,Bn,Cn,Dn,En,Fn,Divider;
+} Matrix ;
+
+/* Private variables ---------------------------------------------------------*/
+extern Coordinate ScreenSample[3];
+extern Coordinate DisplaySample[3];
+extern Matrix matrix ;
+extern Coordinate  display ;
+
+/* Private define ------------------------------------------------------------*/
+
+#define CHX     0x90
+#define CHY     0xD0
+
+#define THRESHOLD 2
+
+class Touch
+{
+    public:
+        Touch(SSD1289_LCD *lcd,SPI *spi, DigitalOut *cs, DigitalIn *irq);
+        void InitializeTouch();
+        int RD_AD(void);
+        int Read_X(void);
+        int Read_Y(void);
+        void TP_GetAdXY(int *x,int *y);
+        void TP_DrawPoint(int Xpos,int Ypos);
+        void DrawCross(int Xpos,int Ypos);
+        Coordinate *Read_Ads7846(void);
+        bool setCalibrationMatrix( Coordinate * displayPtr, Coordinate * screenPtr, Matrix * matrixPtr);
+        void TouchPanel_Calibrate(void);
+        
+        
+    private:
+        SPI *_spi;
+        DigitalOut *_cs;
+        DigitalIn *_irq;
+        SSD1289_LCD *_lcd;
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
\ No newline at end of file