Contains the main execution of the clock uses headers to import functions

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of TFT_Mikroelectronika_IL9341_sketchpad by Oxford CWM Team

main.cpp

Committer:
cstevens
Date:
2016-06-09
Revision:
4:14043cafbec7
Parent:
3:676adf84c914
Child:
5:424af4fa03ab

File content as of revision 4:14043cafbec7:

// example to test the TFT Display from Mikroelectronika

#include "stdio.h"
#include "mbed.h"
#include "SPI_TFT_ILI9341.h"
#include "string"
#include "Arial12x12.h"
#include "Arial24x23.h"
#include "Arial28x28.h"
#include "font_big.h"

 





// the display has a backlight switch on board 
DigitalOut LCD_LED(PTA13);       
DigitalOut pwr(PTD7);

// 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 for lpc1768
SPI_TFT_ILI9341 TFT(PTD2, PTD3, PTD1, PTD5, PTD0, PTC12,"TFT"); // mosi, miso, sclk, cs, reset, dc for frdmkl25z
//NB better combination to use a coherent 2x4 block for lcd 
//   SPI_TFT_ILI9341 TFT(PTD2, PTD3, PTD1, PTA16, PTA17, PTC16,"TFT"); // mosi, miso, sclk, cs, reset, dc for frdmkl25z
//   DigitalOut LCD_LED(PTC17);  

int main()
{
    pwr=1;
    wait(0.2);
    while(1){
    int i;
    LCD_LED = 1;            // backlight on
   
    TFT.claim(stdout);        // send stdout to the TFT display
    TFT.set_orientation(1);
    TFT.background(Black);    // set background to black
    TFT.foreground(White);    // set chars to white
    TFT.cls();                // clear the screen

    //first show the 4 directions
    TFT.set_orientation(0);
    TFT.background(Black);
    TFT.cls();

    TFT.set_font((unsigned char*) Arial12x12);
    TFT.locate(0,0);
    printf("  Hello Mbed 0");
    TFT.set_orientation(1);
    TFT.locate(0,0);
    printf("  Hello Mbed 1");
    TFT.set_orientation(2);
    TFT.locate(0,0);
    printf("  Hello Mbed 2");
    TFT.set_orientation(3);
    TFT.locate(0,0);
    printf("  Hello Mbed 3");
    TFT.set_orientation(3);
    TFT.set_font((unsigned char*) Arial24x23);
    TFT.locate(50,100);
    TFT.printf("TFT orientation");

    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);
    
   
    }
   
}