STMPE610 touch sensor driver library

Dependents:   TS_Eyes Tokei testUniGraphic_150217 AfficheurTFTAdafruit ... more

Revision:
1:43990f1c0a8b
Parent:
0:68779c92cffa
Child:
2:ee910b63c077
--- a/SPI_STMPE610.h	Sat Nov 08 05:17:25 2014 +0000
+++ b/SPI_STMPE610.h	Sat Nov 08 06:51:34 2014 +0000
@@ -1,17 +1,41 @@
-/*
- * File description 
+/**
+ * STMPE610 Touch Sensor
+ * 
  *
  */
-
 #ifndef SPI_STMPE610_H
 #define SPI_STMPE610_H
 
 #include "mbed.h"
 
-/**
- * STMPE610 Touch Sensor
+
+/** SPI_STMPE610 Touch Sensor
+ * Example:
+ * @code
+ * #include "mbed.h"
+ * #include "SPI_STMPE610.h"
+ *
+ * #define PIN_MOSI        PTD2
+ * #define PIN_MISO        PTD3 
+ * #define PIN_SCLK        PTD1 
+ * #define PIN_CS_TSC      PTA13
+ * #define PIN_TSC_INTR    PTC9
  * 
+ * SPI_STMPE610 TSC(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ;
  *
+ * int main()
+ * {
+ *    uint16_t touched, x, y, z ;
+ *    printf("Test SPI STMPE610\n\r") ;
+ *    while (true) {
+ *        touched = TSC.getRAWPoint(&x, &y, &z) ;
+ *        if (touched) {
+ *            printf("x = %d, y = %d, z = %d\n\r", x, y, z) ;
+ *        }
+ *        wait(0.1) ;
+ *    }
+ * }
+ * @endcode
  */
 
 class SPI_STMPE610 
@@ -25,8 +49,12 @@
  * @param sclk SPI_CLK pin
  * @param cs   SPI_CS  pin
  */
+ 
  SPI_STMPE610(PinName mosi, PinName miso, PinName sclk, PinName cs) ;
  
+ /** 
+  * Destructor 
+  */
  ~SPI_STMPE610() ;
 
  /*
@@ -44,8 +72,18 @@
   uint16_t read16(int addr) ;
   void write16(int addr, uint16_t data) ;
   
+  /**
+   * get RAW value of x, y, z 
+   * @param *x  raw value of x
+   * @param *y  raw value of y
+   * @param *z  raw value of z
+   * @return if touched 
+   * @note For my device usually the value seems to be between 300 ~ 3000 
+   * @note when it fails to acquire value the value of 0 seems to be returned
+   */
   int getRAWPoint(uint16_t *x, uint16_t *y, uint16_t *z) ;
   
   private:
 } ;
+
 #endif /* SPI_STMPE610_H */
\ No newline at end of file