A board support package for the LPC4088 Display Module.

Dependencies:   DM_HttpServer DM_USBHost

Dependents:   lpc4088_displaymodule_emwin lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI ... more

Fork of DMSupport by EmbeddedArtists AB

Revision:
10:1ac4b213f0f7
Parent:
9:a33326afd686
Child:
22:1a58a518435c
--- a/Display/TouchPanel.h	Thu Dec 11 18:23:07 2014 +0000
+++ b/Display/TouchPanel.h	Fri Dec 19 09:03:25 2014 +0100
@@ -17,6 +17,8 @@
 #ifndef TOUCHPANEL_H
 #define TOUCHPANEL_H
 
+#include "bios.h"
+
 /**
  * An abstract class that represents touch panels.
  */
@@ -24,39 +26,43 @@
 public:
 
     typedef struct {
-        int32_t x;
-        int32_t y;
-        int32_t z;
+        uint16_t x;
+        uint16_t y;
+        uint16_t z;
     } touchCoordinate_t;
 
-
-    /**
-     * Initialize the touch controller. This method must be called before
-     * calibrating or reading data from the controller
-     *
-     * @param width the width of the touch panel. This is usually the same as
-     * the width of the display
-     * @param height the height of the touch panel. This is usually the same
-     * as the height of the display.
-     *
-     * @return true if the request was successful; otherwise false
-     */
-    virtual bool init(uint16_t width, uint16_t height) = 0;
+    enum TouchError {
+        TouchError_Ok                =   BiosError_Ok,
+        TouchError_ConfigError       =   BiosError_ConfigError,
+        TouchError_WrongBPP          =   BiosError_WrongBPP,
+        TouchError_InvalidParam      =   BiosError_InvalidParam,
+        TouchError_NoInit            =   BiosError_NoInit,
+        TouchError_CalibrationError  =   BiosError_Calibration,        
+        TouchError_MemoryError,
+        TouchError_TouchNotSupported,
+        TouchError_Timeout,
+    };
 
     /**
      * Read coordinates from the touch panel.
      *
      * @param coord pointer to coordinate object. The read coordinates will be
      * written to this object.
+     *
+     *  @returns
+     *       Ok on success
+     *       An error code on failure
      */
-    virtual bool read(touchCoordinate_t &coord) = 0;
+    virtual TouchError read(touchCoordinate_t &coord) = 0;
 
     /**
      * Start to calibrate the display
      *
-     * @return true if the request was successful; otherwise false
+     *  @returns
+     *       Ok on success
+     *       An error code on failure
      */
-    virtual bool calibrateStart() = 0;
+    virtual TouchError calibrateStart() = 0;
 
     /**
      * Get the next calibration point. Draw an indicator on the screen
@@ -68,9 +74,11 @@
      * @param y    the y coordinate is written to this argument
      * @param last true if this is the last coordinate in the series
      *
-     * @return true if the request was successful; otherwise false
+     *  @returns
+     *       Ok on success
+     *       An error code on failure
      */
-    virtual bool getNextCalibratePoint(uint16_t* x, uint16_t* y, bool* last=NULL) = 0;
+    virtual TouchError getNextCalibratePoint(uint16_t* x, uint16_t* y, bool* last=NULL) = 0;
 
     /**
      * Wait for a calibration point to have been pressed and recored.
@@ -81,9 +89,11 @@
      * @param timeout maximum number of milliseconds to wait for
      * a calibration point. Set this argument to 0 to wait indefinite.
      *
-     * @return true if the request was successful; otherwise false
+     *  @returns
+     *       Ok on success
+     *       An error code on failure
      */
-    virtual bool waitForCalibratePoint(bool* morePoints, uint32_t timeout) = 0;
+    virtual TouchError waitForCalibratePoint(bool* morePoints, uint32_t timeout) = 0;
 };
 
 #endif