touch screen handler for the microchip AR1020

Revision:
4:510ea5b28a05
Parent:
2:1a436d154c84
--- a/ar1020.h	Tue Feb 22 22:54:25 2011 +0000
+++ b/ar1020.h	Thu Feb 24 14:00:17 2011 +0000
@@ -28,25 +28,55 @@
     
 #include "touchpanel.h"
 #include "touchevent.h"
-    
+
+/**
+    class handling all the connections to a AR1020 touch screen controller
+    SPI is handled by bit-banging, since the SPI-mode is non-standard. Therefore all pins can be used for the connection.
+    Since the AR1020 seems to be sensitive to the changing pin signals during reset and startup, this library controls the AR1020 power (so it's Vcc must be connected to an mbed pin)   
+*/    
 class AR1020: public TouchPanel
 {
     public:
         /**
-            requires
-                SPI mode=1 (POL=0, PHA=1 [falling edge])
-                SPI frequency lower than 900 kHz (something about 100kHz preferred)
-            @param spi the SPI object where the AR1020 is connected
-            @params enable the pin name where /CS is connected
+            @params mosi the MOSI pin name (SDI)
+            @params miso the MISO pin name (SDO)
+            @params clk the CLK pin (SCL)
+            @params enable the enable pin name (/CS)
+            @params siq the SIQ pin name (SIQ)
+            @params power the power pin name (connected to Vdd - this library does power handling for the AR1020)
+        */
+        AR1020(PinName mosi, PinName miso, PinName clk, PinName enable, PinName siq, PinName power);
+        ~AR1020();
+        
+        /**
+            initialize the controller
+        */
+        virtual void init();
+        
+        /**
+            read X coordinate (from last update)
+            @returns last known X coordinate
         */
-        AR1020(SPI *spi, PinName enable, PinName sqi, PinName power, bool swapX=false, bool swapY=false, bool swapXY=false);
-        AR1020(PinName mosi, PinName miso, PinName clk, PinName enable, PinName sqi, PinName power, bool swapX=false, bool swapY=false, bool swapXY=false);
-        ~AR1020();
-        virtual void init();
         virtual int x();
+        /**
+            read Y coordinate (from last update)
+            @returns last known Y coordinate
+        */
         virtual int y();
+        
+        /**
+            @return 0 if pen is up, 1 if pen is down
+        */
         virtual int pen();
+        
+        /**
+            read coordinates on request
+        */
         virtual void read();
+        
+        /**
+            execute touch screen calibration
+        */
         void calibrate();
     private:
         int cmd(char cmd,char* data, int len, bool doEnable=true);
@@ -57,7 +87,7 @@
         SPI *_spi;
         DigitalOut *_enable;   
         InterruptIn *_irq;
-        DigitalIn *_sqi;
+        DigitalIn *_siq;
         int _x, _y, _pen; 
         
         DigitalOut *_led;