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 Michael Ammann

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Sat Oct 19 21:07:54 2013 +0000
Parent:
4:4542d1ff81e4
Child:
6:2612205220c5
Commit message:
added backlight support

Changed in this revision

SeeedStudioTFTv2.cpp Show annotated file Show diff for this revision Revisions of this file
SeeedStudioTFTv2.h Show annotated file Show diff for this revision Revisions of this file
--- a/SeeedStudioTFTv2.cpp	Sat Oct 19 20:51:48 2013 +0000
+++ b/SeeedStudioTFTv2.cpp	Sat Oct 19 21:07:54 2013 +0000
@@ -20,10 +20,11 @@
                                    PinName mosi, PinName miso, PinName sclk,
                                    PinName csTft, PinName rstTft, PinName dcTft, PinName blTft,
                                    PinName csSd):
-    SPI_TFT_ILI9341(mosi,miso,sclk,csTft,rstTft,dcTft, "tft") 
+    SPI_TFT_ILI9341(mosi,miso,sclk,csTft,rstTft,dcTft, "tft"),
 #ifdef USE_SDCARD
-    ,SDFileSystem(mosi,miso,sclk,csSd, "sdc")
+    SDFileSystem(mosi,miso,sclk,csSd, "sdc"),
 #endif
+    bl(blTft)
 {
 #ifndef USE_SDCARD
     // sd card
@@ -31,7 +32,6 @@
     cs = 1;
 #endif
     // backlight
-    DigitalOut bl(blTft);
     bl = 1;
     // touch screen pins
     _xp = xp;
@@ -46,6 +46,11 @@
     pp_ty =    356;  //    261   -355   -239    356
 }
 
+void SeeedStudioTFTv2::setBacklight(bool enabled)
+{
+    bl = enabled;
+}
+
 int SeeedStudioTFTv2::readTouch(PinName p, PinName m, PinName a, PinName i)
 {
     DigitalOut _p(p);
--- a/SeeedStudioTFTv2.h	Sat Oct 19 20:51:48 2013 +0000
+++ b/SeeedStudioTFTv2.h	Sat Oct 19 21:07:54 2013 +0000
@@ -17,7 +17,7 @@
 #include "mbed.h"
 #include "SPI_TFT_ILI9341.h"
 #ifdef USE_SDCARD
-#include "SDFileSystem.h"
+#include "SDFileSystem.h" // import the SDFileSystem library 
 #endif
 
 struct point {
@@ -47,6 +47,8 @@
                      PinName csTft, PinName rstTft, PinName dcTft, PinName blTft,
                      PinName csSd);
 
+    void setBacklight(bool enabled);
+    
     /** calibrate the touch display
      *
      * User is asked to touch on two points on the screen
@@ -73,6 +75,7 @@
     PinName _ym;
     PinName _xp;
     PinName _yp;
+    DigitalOut bl;
 
     typedef enum { YES, MAYBE, NO } TOUCH;
     TOUCH getTouch(point& p);