| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Adafruit_FT6206.h
Go to the documentation of this file.
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 #if ARDUINO >= 100
21 #include "Arduino.h"
22 #else
23 #include "WProgram.h"
24 #endif
25
26 #include <Wire.h>
27
28
29 #define FT6206_ADDR 0x38
30 #define FT6206_G_FT5201ID 0xA8
31 #define FT6206_REG_NUMTOUCHES 0x02
32
33 #define FT6206_NUM_X 0x33
34 #define FT6206_NUM_Y 0x34
35
36 #define FT6206_REG_MODE 0x00
37 #define FT6206_REG_CALIBRATE 0x02
38 #define FT6206_REG_WORKMODE 0x00
39 #define FT6206_REG_FACTORYMODE 0x40
40 #define FT6206_REG_THRESHHOLD 0x80
41 #define FT6206_REG_POINTRATE 0x88
42 #define FT6206_REG_FIRMVERS 0xA6
43 #define FT6206_REG_CHIPID 0xA3
44 #define FT6206_REG_VENDID 0xA8
45
46 // calibrated for Adafruit 2.8" ctp screen
47 #define FT6206_DEFAULT_THRESSHOLD 128
48
49 class TS_Point
50 {
51 public:
52 TS_Point(void);
53 TS_Point(int16_t x, int16_t y, int16_t z);
54
55 bool operator==(TS_Point);
56 bool operator!=(TS_Point);
57
58 int16_t x, y, z;
59 };
60
61 class Adafruit_FT6206
62 {
63 public:
64
65 Adafruit_FT6206(void);
66 boolean begin(uint8_t thresh = FT6206_DEFAULT_THRESSHOLD);
67
68 void writeRegister8(uint8_t reg, uint8_t val);
69 uint8_t readRegister8(uint8_t reg);
70
71 void readData(uint16_t *x, uint16_t *y);
72 void autoCalibrate(void);
73
74 boolean touched(void);
75 TS_Point getPoint(void);
76
77 private:
78 uint8_t touches;
79 uint16_t touchX[2], touchY[2], touchID[2];
80
81 };
82
83 #endif //ADAFRUIT_FT6206_LIBRARY
TS_Point::z
int16_t z
Definition: Adafruit_FT6206.h:58
TS_Point
Definition: Adafruit_FT6206.h:49
FT6206_DEFAULT_THRESSHOLD
#define FT6206_DEFAULT_THRESSHOLD
Definition: Adafruit_FT6206.h:47
TS_Point::x
int16_t x
Definition: Adafruit_FT6206.h:58
TS_Point::TS_Point
TS_Point(void)
Definition: Adafruit_FT6206.cpp:222
TS_Point::y
int16_t y
Definition: Adafruit_FT6206.h:58
TS_Point::operator==
bool operator==(TS_Point)
Definition: Adafruit_FT6206.cpp:234
TS_Point::operator!=
bool operator!=(TS_Point)
Definition: Adafruit_FT6206.cpp:239
Adafruit_FT6206
Definition: Adafruit_FT6206.h:61