Adafruit FT6206 Library
Adafruit_FT6206.h
1 /***************************************************
2  This is a library for the Adafruit Capacitive Touch Screens
3 
4  ----> http://www.adafruit.com/products/1947
5 
6  Check out the links above for our tutorials and wiring diagrams
7  This chipset uses I2C to communicate
8 
9  Adafruit invests time and resources providing this open source code,
10  please support Adafruit and open-source hardware by purchasing
11  products from Adafruit!
12 
13  Written by Limor Fried/Ladyada for Adafruit Industries.
14  MIT license, all text above must be included in any redistribution
15  ****************************************************/
16 
17 #ifndef ADAFRUIT_FT6206_LIBRARY
18 #define ADAFRUIT_FT6206_LIBRARY
19 
20 #include "Arduino.h"
21 #include <Wire.h>
22 
23 #define FT6206_ADDR 0x38
24 #define FT6206_G_FT5201ID 0xA8
25 #define FT6206_REG_NUMTOUCHES 0x02
26 
27 #define FT6206_NUM_X 0x33
28 #define FT6206_NUM_Y 0x34
29 
30 #define FT6206_REG_MODE 0x00
31 #define FT6206_REG_CALIBRATE 0x02
32 #define FT6206_REG_WORKMODE 0x00
33 #define FT6206_REG_FACTORYMODE 0x40
34 #define FT6206_REG_THRESHHOLD 0x80
35 #define FT6206_REG_POINTRATE 0x88
36 #define FT6206_REG_FIRMVERS 0xA6
37 #define FT6206_REG_CHIPID 0xA3
38 #define FT6206_REG_VENDID 0xA8
39 
40 // calibrated for Adafruit 2.8" ctp screen
41 #define FT6206_DEFAULT_THRESSHOLD 128
42 
43 class TS_Point {
44  public:
45  TS_Point(void);
46  TS_Point(int16_t x, int16_t y, int16_t z);
47 
48  bool operator==(TS_Point);
49  bool operator!=(TS_Point);
50 
51  int16_t x, y, z;
52 };
53 
55  public:
56 
57  Adafruit_FT6206(void);
58  boolean begin(uint8_t thresh = FT6206_DEFAULT_THRESSHOLD);
59  uint8_t touched(void);
60  TS_Point getPoint(uint8_t n = 0);
61 
62  //void autoCalibrate(void);
63 
64  private:
65  void writeRegister8(uint8_t reg, uint8_t val);
66  uint8_t readRegister8(uint8_t reg);
67 
68  void readData(void);
69  uint8_t touches;
70  uint16_t touchX[2], touchY[2], touchID[2];
71 
72 };
73 
74 #endif //ADAFRUIT_FT6206_LIBRARY
Definition: Adafruit_FT6206.h:54
Definition: Adafruit_FT6206.h:43