Roland Fuchs / FT5206
Revision:
3:51917db9e147
Parent:
2:5ebf8736e4b2
--- a/FT5206.h	Fri Jun 19 08:39:50 2015 +0000
+++ b/FT5206.h	Fri Feb 01 08:17:00 2019 +0000
@@ -1,3 +1,37 @@
+// FT5206.h für FT5206.cpp
+// Roland Fuchs
+
+#include "mbed.h"
+/*
+//-- Tastatur
+#define Hoch   20
+#define Tief   21
+#define Rechts 22
+#define Links  23
+#define Ja     24
+#define Weg    25
+*/
+struct Tip
+{
+    int x[5];
+    int y[5];
+}; // 40 Bytes
+
+
+void init_FT5206();
+int  getTip5(Tip*);
+int  getTip(int *x,int *y);
+int  getTipPoll(int *x,int *y);
+void getTipWait(int ms);
+
+void tip_irq_ein();
+void tip_irq_aus();
+
+void writeReg8(char reg,char val);
+char readReg8(char reg);
+int  readReg16(char reg);
+
+
 /** This is a library to handling capacitive multitouch sensors using FT5206.
  * FT5206 Capatitive Touch Panel driver for 7 inch BuyDisplay LCD, with 5-point touch
  * http://www.buydisplay.com/default/7-inch-lcd-module-capacitive-touch-screen-panel-i2c-spi-serial
@@ -10,27 +44,23 @@
  *  #define PIN_INT_FT5206  D7
  *  FT5206 FT5206(PIN_SDA_FT5206, PIN_SCL_FT5206, PIN_INT_FT5206); // sda, scl, int
  *  FT5206.init();
- *  while(1) {
- *      if(FT5206.getPanelTouched()) {
- *          for (int i = 0; i < FT5206.numberOfTouchPoints; i++) {
+ *  while(1)
+ *  {
+ *      if(FT5206.getPanelTouched())
+ *      {
+ *          for (int i = 0; i < FT5206.numberOfTouchPoints; i++)
  *              printf("Coord %d: %d, %d  \r\n", i+1, FT5206.touchCoordinatesX[i], FT5206.touchCoordinatesY[i]);
- *          }
  *      }
  *  }
  * @endcode
  *
  */
 
-#ifndef FT5206_H
-#define FT5206_H
-
-#include "mbed.h"
-
+/*
 #define DEBUG_OUTPUT_ENABLED                false
-
 #define FT5206_I2C_FREQUENCY                400000
 
-/* FT5206 definitions */
+// FT5206 definitions 
 #define FT5206_I2C_ADDRESS                  0x38
 #define FT5206_NUMBER_OF_REGISTERS          31     // there are more registers, but this
                                             // is enought to get all 5 touch coordinates.
@@ -39,32 +69,33 @@
 
 #define FT5206_DEVICE_MODE                  0x00
 #define FT5206_GEST_ID                      0x01
-#define FT5206_TD_STATUS                    0x02 // How many points detected (3:0). 1-5 is valid.
+
+#define TD_STATUS                    0x02 // How many points detected (3:0). 1-5 is valid.
 
-#define FT5206_TOUCH1_XH                    0x03 // Event Flag, Touch X Position
-#define FT5206_TOUCH1_XL                    0x04
-#define FT5206_TOUCH1_YH                    0x05 // Touch ID, Touch Y Position
-#define FT5206_TOUCH1_YL                    0x06
+#define TOUCH1_XH                    0x03 // Event Flag, Touch X Position
+#define TOUCH1_XL                    0x04
+#define TOUCH1_YH                    0x05 // Touch ID, Touch Y Position
+#define TOUCH1_YL                    0x06
 
-#define FT5206_TOUCH2_XH                    0x09 // Event Flag, Touch X Position
-#define FT5206_TOUCH2_XL                    0x0a
-#define FT5206_TOUCH2_YH                    0x0b // Touch ID, Touch Y Position
-#define FT5206_TOUCH2_YL                    0x0c
+#define TOUCH2_XH                    0x09 // Event Flag, Touch X Position
+#define TOUCH2_XL                    0x0a
+#define TOUCH2_YH                    0x0b // Touch ID, Touch Y Position
+#define TOUCH2_YL                    0x0c
 
-#define FT5206_TOUCH3_XH                    0x0f // Event Flag, Touch X Position
-#define FT5206_TOUCH3_XL                    0x10
-#define FT5206_TOUCH3_YH                    0x11 // Touch ID, Touch Y Position
-#define FT5206_TOUCH3_YL                    0x12
+#define TOUCH3_XH                    0x0f // Event Flag, Touch X Position
+#define TOUCH3_XL                    0x10
+#define TOUCH3_YH                    0x11 // Touch ID, Touch Y Position
+#define TOUCH3_YL                    0x12
 
-#define FT5206_TOUCH4_XH                    0x15 // Event Flag, Touch X Position
-#define FT5206_TOUCH4_XL                    0x16
-#define FT5206_TOUCH4_YH                    0x17 // Touch ID, Touch Y Position
-#define FT5206_TOUCH4_YL                    0x18
+#define TOUCH4_XH                    0x15 // Event Flag, Touch X Position
+#define TOUCH4_XL                    0x16
+#define TOUCH4_YH                    0x17 // Touch ID, Touch Y Position
+#define TOUCH4_YL                    0x18
 
-#define FT5206_TOUCH5_XH                    0x1b // Event Flag, Touch X Position
-#define FT5206_TOUCH5_XL                    0x1c
-#define FT5206_TOUCH5_YH                    0x1d // Touch ID, Touch Y Position
-#define FT5206_TOUCH5_YL                    0x1e
+#define TOUCH5_XH                    0x1b // Event Flag, Touch X Position
+#define TOUCH5_XL                    0x1c
+#define TOUCH5_YH                    0x1d // Touch ID, Touch Y Position
+#define TOUCH5_YL                    0x1e
 
 #define FT5206_ID_G_THGROUP                 0x80 // Valid touching detect threshold
 #define FT5206_ID_G_THPEAK                  0x81 // Valid touching peak detect threshold
@@ -123,20 +154,20 @@
 public:
     FT5206(PinName sda, PinName scl, PinName interrupt);
 
-    void init(void);
-    uint8_t getTouchPositions(void);
-    void intPanelTouched(void);
-    bool getPanelTouched(void);
+    void init();
+    int  getTouchPositions();
+    void intPanelTouched();
+    bool getPanelTouched();
 
-    uint8_t numberOfTouchPoints;
-    uint16_t touchCoordinatesX[5];
-    uint16_t touchCoordinatesY[5];
+    int tipanz;//numberOfTouchPoints;
+    int tipx[5];//touchCoordinatesX[5];
+    int tipy[5];//touchCoordinatesY[5];
 
 private:
     InterruptIn m_interrupt;
 
     I2C m_i2c;
-    int m_addr;
+    //int m_addr;
     char data[2];
 
     bool debug_output_enabled;
@@ -145,5 +176,4 @@
     char readRegister8(char reg);
 
 };
-
-#endif
+*/
\ No newline at end of file