Adafruit FT6206 Arduino Library
Adafruit_FT6206.h
Go to the documentation of this file.
1 
5 #ifndef ADAFRUIT_FT6206_LIBRARY
6 #define ADAFRUIT_FT6206_LIBRARY
7 
8 #include "Arduino.h"
9 #include <Wire.h>
10 
11 #define FT62XX_ADDR 0x38
12 #define FT62XX_G_FT5201ID 0xA8
13 #define FT62XX_REG_NUMTOUCHES 0x02
14 
15 #define FT62XX_NUM_X 0x33
16 #define FT62XX_NUM_Y 0x34
17 
18 #define FT62XX_REG_MODE 0x00
19 #define FT62XX_REG_CALIBRATE 0x02
20 #define FT62XX_REG_WORKMODE 0x00
21 #define FT62XX_REG_FACTORYMODE 0x40
22 #define FT62XX_REG_THRESHHOLD 0x80
23 #define FT62XX_REG_POINTRATE 0x88
24 #define FT62XX_REG_FIRMVERS 0xA6
25 #define FT62XX_REG_CHIPID 0xA3
26 #define FT62XX_REG_VENDID 0xA8
27 
28 #define FT62XX_VENDID 0x11
29 #define FT6206_CHIPID 0x06
30 #define FT6236_CHIPID 0x36
31 #define FT6236U_CHIPID 0x64
32 
33 // calibrated for Adafruit 2.8" ctp screen
34 #define FT62XX_DEFAULT_THRESHOLD 128
35 
36 /**************************************************************************/
41 /**************************************************************************/
42 class TS_Point {
43 public:
44  TS_Point(void);
45  TS_Point(int16_t x, int16_t y, int16_t z);
46 
47  bool operator==(TS_Point);
48  bool operator!=(TS_Point);
49 
50  int16_t x;
51  int16_t y;
52  int16_t z;
53 };
54 
55 /**************************************************************************/
60 /**************************************************************************/
62 public:
63  Adafruit_FT6206(void);
64  boolean begin(uint8_t thresh = FT62XX_DEFAULT_THRESHOLD);
65  uint8_t touched(void);
66  TS_Point getPoint(uint8_t n = 0);
67 
68  // void autoCalibrate(void);
69 
70 private:
71  void writeRegister8(uint8_t reg, uint8_t val);
72  uint8_t readRegister8(uint8_t reg);
73 
74  void readData(void);
75  uint8_t touches;
76  uint16_t touchX[2], touchY[2], touchID[2];
77 };
78 
79 #endif // ADAFRUIT_FT6206_LIBRARY
TS_Point(void)
Instantiates a new FT6206 class with x, y and z set to 0 by default.
Definition: Adafruit_FT6206.cpp:267
bool operator==(TS_Point)
Simple == comparator for two TS_Point objects.
Definition: Adafruit_FT6206.cpp:290
bool operator!=(TS_Point)
Simple != comparator for two TS_Point objects.
Definition: Adafruit_FT6206.cpp:300
int16_t z
Definition: Adafruit_FT6206.h:52
#define FT62XX_DEFAULT_THRESHOLD
Default threshold for touch detection.
Definition: Adafruit_FT6206.h:34
Class that stores state and functions for interacting with FT6206 capacitive touch chips...
Definition: Adafruit_FT6206.h:61
Helper class that stores a TouchScreen Point with x, y, and z coordinates, for easy math/comparison...
Definition: Adafruit_FT6206.h:42
int16_t y
Definition: Adafruit_FT6206.h:51
int16_t x
Definition: Adafruit_FT6206.h:50