This is a simple program using the Mikroelectronika TFT resistive touchscreen to create a sketchpad application.

Dependencies:   SPI_TFT_ILI9341 TFT_fonts mbed

Fork of TFT_Mikroelectronika_IL9341 by Oxford CWM Team

Code to make a simple sketchpad using the touchscreen from Mikroelectronika

The Mikroelectronika touch screen is a good sized display we are using for the first time in 2016. It's got a touch panel layer and can be addressed by either SPI or parallel buses.

http://www.mikroe.com/add-on-boards/display/tft-proto/

/media/uploads/cstevens/sketchpad.jpg

Pin connections for use with an mbed

Referring to the pin names on the screen pcb

Pins:

Screenmbed nameKL25Z example
sdimosiPTD2
sdomisoPTD3
rssckPTD1
RDGNDGND
IM0GNDGND
IM13.3V3V3
IM23.3V3V3
IM33.3V3V3
CSdigitalout pinPTD5
RSTdigitaloutpinPTD0
WRdigitaloutpinPTA13

You will need 2 wires to drive the backlight on leda and ledk (anode(connect to +V via a current limiting resistor) and cathode) Link +3.3V to IM1, IM2, IM3 to setup spi communication mode link

Files at this revision

API Documentation at this revision

Comitter:
pegcjs
Date:
Mon Oct 20 11:05:02 2014 +0000
Parent:
0:7c3b9bfd6ead
Child:
2:25bfb21253a6
Commit message:
latest 2014

Changed in this revision

SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
SPI_TFT_ILI9341.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/SDFileSystem.lib	Sun Jan 26 20:55:50 2014 +0000
+++ b/SDFileSystem.lib	Mon Oct 20 11:05:02 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/SDFileSystem/#c8f66dc765d4
+http://mbed.org/users/mbed_official/code/SDFileSystem/#7b35d1709458
--- a/SPI_TFT_ILI9341.lib	Sun Jan 26 20:55:50 2014 +0000
+++ b/SPI_TFT_ILI9341.lib	Mon Oct 20 11:05:02 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/dreschpe/code/SPI_TFT_ILI9341/#4c30bea883bc
+http://mbed.org/users/dreschpe/code/SPI_TFT_ILI9341/#b2b3e5430f81
--- a/main.cpp	Sun Jan 26 20:55:50 2014 +0000
+++ b/main.cpp	Mon Oct 20 11:05:02 2014 +0000
@@ -14,20 +14,22 @@
 #include "SDFileSystem.h"
  
 // the SD-connector is connected to SPI pin 11-13 
-SDFileSystem sd(p11, p12, p13, p14, "sd"); // mosi,miso,sck,cs
+//SDFileSystem sd(p11, p12, p13, p14, "sd"); // mosi,miso,sck,cs
 
-LocalFileSystem local("local");
+//LocalFileSystem local("local");
 
 extern unsigned char p1[];  // the mbed logo graphic
 
 // the display has a backlight switch on board 
-DigitalOut LCD_LED(p21);       
+DigitalOut LCD_LED(PTA13);       
 
 // the TFT is connected to SPI pin 5-7
-SPI_TFT_ILI9341 TFT(p5, p6, p7, p8, p9, p10,"TFT"); // mosi, miso, sclk, cs, reset, dc
+//SPI_TFT_ILI9341 TFT(p5, p6, p7, p8, p9, p10,"TFT"); // mosi, miso, sclk, cs, reset, dc for lpc1768
+SPI_TFT_ILI9341 TFT(PTD2, PTD3, PTD1, PTD5, PTD0, PTC12,"TFT"); // mosi, miso, sclk, cs, reset, dc for frdmkl25z
 
 int main()
 {
+    while(1){
     int i;
     LCD_LED = 1;            // backlite on
    
@@ -54,12 +56,43 @@
     TFT.set_orientation(3);
     TFT.locate(0,0);
     printf("  Hello Mbed 3");
-    TFT.set_orientation(1);
+    TFT.set_orientation(3);
     TFT.set_font((unsigned char*) Arial24x23);
     TFT.locate(50,100);
     TFT.printf("TFT orientation");
 
-    wait(5);        // wait two seconds
+    wait(1);        // wait two seconds
+      TFT.cls();
+           LCD_LED = 1;   
+   TFT.set_font((unsigned char*) Arial12x12);
+    TFT.locate(1,10);
+    TFT.foreground(Green);
+    TFT.printf("Depth          Max Depth   Dive Time");
+    TFT.locate(1,24);
+    TFT.foreground(White);
+    TFT.set_font((unsigned char*) Arial28x28);
+    TFT.printf("32.4m");
+    
+    TFT.locate(130,24);
+    TFT.foreground(White);
+    TFT.set_font((unsigned char*) Arial24x23);
+    TFT.printf("45.6m");
+    TFT.locate(240,24);
+    TFT.printf("37'");
+    
+    TFT.locate(1,70);
+    TFT.set_font((unsigned char*) Arial12x12);
+    TFT.foreground(Green);
+    TFT.printf("ppO2:\nSensor 1     Sensor 2     Sensor 3");
+    
+     TFT.locate(1,100);
+    TFT.foreground(White);
+    TFT.set_font((unsigned char*) Arial28x28);
+    TFT.printf("1.21   1.21   1.21");
+    wait(10);
+    
+    /*
+    wait(5);
 
     // draw some graphics
     TFT.cls();
@@ -125,14 +158,19 @@
     // to compare the speed of the internal file system and a SD-card
     TFT.locate(10,10);
     TFT.printf("Graphic from internal File System");
-    TFT.locate(10,20);
+    TFT.locate(20,20);
     TFT.printf("open test.bmp");
-    int err = TFT.BMP_16(1,50,"/local/test.bmp");
+    int err = TFT.BMP_16(50,50,"/local/test.bmp");
     if (err != 1) TFT.printf(" - Err: %d",err);
-    
-    TFT.locate(10,110);
-    TFT.printf("Graphic from external SD-card");
-    TFT.locate(10,120);
-    err = TFT.BMP_16(1,140,"/sd/test.bmp");
-    if (err != 1) TFT.printf(" - Err: %d",err);
+    wait(5);
+    for(i=0;i<10;i++){
+          LCD_LED = 1;   
+          wait(0.2);
+            LCD_LED = 0;   
+        wait(0.2);
+        }
+  
+    */
+    }
+   
 }
--- a/mbed.bld	Sun Jan 26 20:55:50 2014 +0000
+++ b/mbed.bld	Mon Oct 20 11:05:02 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file