Library for SeeedStudioTFTv2 2.8 Zoll 240x360 pixel touch SD card
Dependencies: SPI_TFT_ILI9341
Dependents: Seeed_TFT_Touch_Shield Seeed_TFT_Touch_Shield Adafruit_TFT_Touch_Shield UIT2_SpectrumAnalyzer ... more
Fork of SeeedStudioTFTv2 by
Diff: touch_tft.h
- Revision:
- 0:d78b00f167cb
- Child:
- 1:1745fdf054b5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/touch_tft.h Thu Jul 14 21:02:43 2011 +0000
@@ -0,0 +1,73 @@
+#ifndef MBED_TOUCH_H
+#define MBED_TOUCH_H
+
+#include "mbed.h"
+#include "SPI_TFT.h"
+
+struct point{
+ unsigned short x;
+ unsigned short y;
+ };
+
+class touch_tft : public SPI_TFT{
+public:
+ /** create a TFT with touch object connected to the pins
+ *
+ * @param pin xp resistiv touch x+
+ * @param pin xm resistiv touch x-
+ * @param pin yp resistiv touch y+
+ * @param pin ym resistiv touch y-
+ * @param mosi,miso,sclk SPI connection to TFT
+ * @param cs pin connected to CS of display
+ * @param reset pin connected to RESET of display
+ * based on my SPI_TFT lib
+ */
+ touch_tft(PinName xp, PinName xm, PinName yp, PinName ym,PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset,const char* name ="TFT");
+
+ /** calibrate the touch display
+ *
+ */
+ void calibrate(void);
+
+ /** read x and y analog samples
+ *
+ * @returns point(x,y)
+ */
+ point get_touch(void);
+
+ /** calculate coord on screen
+ *
+ * @param a_point point(analog x, analog y)
+ * @returns point(pixel x, pixel y)
+ *
+ */
+ point to_pixel(point a_point);
+
+ /** test if screen is touched
+ *
+ * @param point analog x,y
+ * @returns true is touched
+ *
+ */
+ bool is_touched(point a);
+
+protected:
+ DigitalInOut _xp;
+ DigitalInOut _xm;
+ DigitalInOut _yp;
+ DigitalInOut _ym;
+ AnalogIn _ax;
+ AnalogIn _ay;
+ PinName xa;
+ PinName ya;
+
+
+ unsigned short x_a,y_a;
+ unsigned short x_off,y_off;
+ unsigned short pp_tx,pp_ty;
+
+
+
+ };
+
+#endif
\ No newline at end of file

Seeed Studio 2.8'' TFT Touch Shield V2.0
Adafruit 2.8" TFT Touch Shield v2