FT6206 Library for Adafruit 2.8" TFT Touch Shield for Arduino w/Capacitive Touch
Dependents: ArchPro_TFT ATT_AWS_IoT_demo_v06 ArchPro_TFT TermProject
Diff: FT6206.h
- Revision:
- 4:b9ff3c020e7f
- Parent:
- 0:d146e986a07f
- Child:
- 5:652684757b6b
diff -r 8e16a8987166 -r b9ff3c020e7f FT6206.h --- a/FT6206.h Mon Mar 23 19:59:37 2015 +0000 +++ b/FT6206.h Mon Mar 23 22:02:01 2015 +0000 @@ -1,19 +1,80 @@ -/*************************************************** - This is a library for the Adafruit Capacitive Touch Screens +/* +Copyright (c) 2015 Jack Berkhout +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +This is a library for the Adafruit Capacitive Touch Screens ----> http://www.adafruit.com/products/1947 - - Check out the links above for our tutorials and wiring diagrams - This chipset uses I2C to communicate +This chipset uses I2C to communicate + +Based on Arduino written by Limor Fried/Ladyada for Adafruit Industries. + +On the shield, these jumpers were bridged: +Int - #7 (default) +SCK - 13 (default) +SO - 12 (default) +SI - 11 +SCL - SCL +SDA - SDA + +Usage: - Adafruit invests time and resources providing this open source code, - please support Adafruit and open-source hardware by purchasing - products from Adafruit! +#include "mbed.h" +#include "SPI_TFT_ILI9341.h" +#include "FT6206.h" +#include "Arial12x12.h" + +#define PIN_XP A3 +#define PIN_XM A1 +#define PIN_YP A2 +#define PIN_YM A0 +#define PIN_SCLK D13 +#define PIN_MISO D12 +#define PIN_MOSI D11 +#define PIN_CS_TFT D10 // chip select pin +#define PIN_DC_TFT D9 // data/command select pin. +#define PIN_RESET_TFT D8 +//#define PIN_BL_TFT D7 +#define PIN_CS_SD D4 - Written by Limor Fried/Ladyada for Adafruit Industries. - MIT license, all text above must be included in any redistribution - ****************************************************/ +#define PORTRAIT 0 +#define LANDSCAPE 1 + +#define PIN_SCL_FT6206 P0_28 +#define PIN_SDA_FT6206 P0_27 +#define PIN_INT_FT6206 D7 + +SPI_TFT_ILI9341 TFT(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TFT, PIN_RESET_TFT, PIN_DC_TFT, "TFT"); // mosi, miso, sclk, cs, reset, dc +FT6206 FT6206(PIN_SDA_FT6206, PIN_SCL_FT6206, PIN_INT_FT6206); // sda, scl, int +int main() +{ + while(1) { +// if (FT6206.touched()) { + if (FT6206.dataReceived()) { + // Retrieve a point + TS_Point p = FT6206.getPoint(); + printf("Touch %3d %3d\n", p.x, p.y); + } + } +} +*/ #ifndef FT6206_H #define FT6206_H