aitendo 1.8" TFT,ST7735B,SPI,FRDM-KL25Z

Dependencies:   ST7735B_TFT mbed

Fork of SPI18TFT by Jonne Valola

main.cpp

Committer:
king33jp
Date:
2015-03-19
Revision:
1:4ca66dd49b64
Parent:
0:309c546f048d

File content as of revision 1:4ca66dd49b64:

#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "mbed.h"
#include "ST7735B_TFT.h"
#include "Consolas10.h"
#include "Consolas12.h"
#include "Prototype20x25_T.h"
#include "keroro_160x128.h"

ST7735_TFT TFT(PTD2, PTD3, PTD1, PTA13, PTD0, PTD5,"TFT"); // mosi, miso, sclk, cs, rs, reset
//Serial pc(USBTX, USBRX); // tx, rx


int main() {
    TFT.set_orientation( 3 );
    TFT.claim(stdout);      // send stdout to the TFT display 
    //TFT.claim(stderr);      // send stderr to the TFT display
    TFT.background(Black);    // set background to black
    TFT.foreground(White);    // set chars to white
    TFT.cls();
    TFT.locate(0,0);
    TFT.set_font((unsigned char*) Consolas7x13);  // select the font

    wait(1);

    while(1){

        TFT.Bitmap(  0,  0,160,128,(unsigned char*)keroro_160x128);
        wait(3);
        TFT.cls();
        TFT.set_font((unsigned char*) Consolas7x13);  // select the font
        TFT.locate(0,0);
        TFT.foreground(Red);TFT.printf("aitendo 1.8\"TFT\n\r");
        for(int i=0;i<4;i++){
            TFT.foreground(White);TFT.printf("Demo demo Demo\n\r");
            TFT.foreground(Green);TFT.printf("Demo demo Demo\n\r");
        }
        wait(3);
        TFT.cls();
        int dx=0,dy=0;
        for(int i=0;i<60;i+=2){
            dx=i;dy=i;
            TFT.rect(dx,dy,160-dx,128-dy,Cyan);
        }
        wait(3);
        TFT.cls();
        TFT.set_font( (unsigned char*)Prototype20x25 );
        TFT.locate(0,0);
        TFT.foreground(Yellow);
        TFT.printf("01234567");
        TFT.printf("12345678");
        TFT.printf("23456789");
        TFT.printf("34567890");
        TFT.printf("45678901");
        wait(3);
        TFT.cls();
    }
}