KL25Z driving an ILI9320 LCD board with touch panel (HY28A-LCDB SPI)

Dependencies:   SPI_TFT_ILI9320 mbed

Revision:
1:76f92f6b3737
Parent:
0:ff976ad09b2f
Child:
2:e21bf3a79d1f
--- a/TouchADS7843/Touch.h	Tue Mar 18 19:36:05 2014 +0000
+++ b/TouchADS7843/Touch.h	Sun Mar 23 19:45:33 2014 +0000
@@ -38,7 +38,7 @@
     Coordinate  screen;
 
     /*
-    * Create a Touchscreen object connected to SPI and two pins
+    * Create a Touchscreen object connected to SPI and two pins.
     *
     * @param mosi,miso,sclk SPI
     * @param cs pin connected to CS of ADS7843
@@ -49,7 +49,7 @@
     TouchScreenADS7843(PinName tp_mosi, PinName tp_miso, PinName tp_sclk, PinName tp_cs, PinName tp_irq, SPI_TFT *_LCD);
 
     /*
-    * Draw a 2 by 2 dot on the LCD screen
+    * Draw a 2 by 2 dot on the LCD screen.
     *
     * @param x (horizontal position)
     * @param y (vertical position)
@@ -59,7 +59,7 @@
     void TP_DrawPoint(unsigned int Xpos,unsigned int Ypos,unsigned int color);
     
     /*
-    * Obtain averaged data from ADS7846
+    * Obtain averaged data from ADS7846.
     * does 9 consecutive reads and only stores averaged data
     * when the 9 points are within the treshold limits.
     *
@@ -81,7 +81,7 @@
     void TouchPanel_Calibrate(void);
     
     /*
-    * Obtain real x,y coordinates
+    * Obtain real x,y coordinates.
     * The x,y coordinates are calculated using the calibration matrix.
     *
     */
@@ -92,6 +92,34 @@
     DigitalOut _tp_cs;
     DigitalIn  _tp_irq;
 
+    /*
+    * Read touchpanel screensample and matrix values.
+    * 
+    * In your code, create 2 structures using Matrix and screenPtr
+    * and call this function with these structures.
+    * the calibration values are returned into these structures.
+    * Example:
+    * Matrix matrix;
+    * Coordinate ScreenSample[3];
+    * GetCalibration(&matrix, &ScreenSample[0]);
+    */
+    void GetCalibration(Matrix * matrixPtr, Coordinate * screenPtr);
+
+    /*
+    * Set touchpanel calibration using screensample and matrix values.
+    * 
+    * In your code, create 2 structures based on Matrix and screenPtr,
+    * copy saved calibration values into these structures
+    * and call this function with these structures.
+    * Example:
+    * Matrix matrix;
+    * Coordinate ScreenSample[3];
+    * <pseudocode> load matrix with values from external storage (eg eeprom).
+    * <pseudocode> load ScreenSample with values from external storage (eg eeprom).
+    * SetCalibration(&matrix, &ScreenSample[0]);
+    */
+    void SetCalibration(Matrix * matrixPtr, Coordinate * screenPtr);
+
 protected:
 
     #define    SPI_RD_DELAY    1