A demo program using uVGAIII board.

Dependencies:   mbed uVGAIII

Fork of uVGAIII_demo by Jingyi Zhang

Committer:
ivygatech
Date:
Mon Mar 24 19:58:17 2014 +0000
Revision:
2:6ecb8ceea422
Parent:
1:333b7b189790
update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ivygatech 0:9e5b26a137ec 1 //
ivygatech 0:9e5b26a137ec 2 // uVGAIII is a class to drive 4D Systems TFT touch screens
ivygatech 0:9e5b26a137ec 3 //
ivygatech 0:9e5b26a137ec 4 // Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr>
ivygatech 0:9e5b26a137ec 5 //
ivygatech 0:9e5b26a137ec 6 // uVGAIII is free software: you can redistribute it and/or modify
ivygatech 0:9e5b26a137ec 7 // it under the terms of the GNU General Public License as published by
ivygatech 0:9e5b26a137ec 8 // the Free Software Foundation, either version 3 of the License, or
ivygatech 0:9e5b26a137ec 9 // (at your option) any later version.
ivygatech 0:9e5b26a137ec 10 //
ivygatech 0:9e5b26a137ec 11 // uVGAIII is distributed in the hope that it will be useful,
ivygatech 0:9e5b26a137ec 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
ivygatech 0:9e5b26a137ec 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ivygatech 0:9e5b26a137ec 14 // GNU General Public License for more details.
ivygatech 0:9e5b26a137ec 15 //
ivygatech 0:9e5b26a137ec 16 // You should have received a copy of the GNU General Public License
ivygatech 0:9e5b26a137ec 17 // along with uVGAIII. If not, see <http://www.gnu.org/licenses/>.
ivygatech 0:9e5b26a137ec 18
ivygatech 0:9e5b26a137ec 19 #include "mbed.h"
ivygatech 0:9e5b26a137ec 20 #include "uVGAIII.h"
ivygatech 0:9e5b26a137ec 21
ivygatech 0:9e5b26a137ec 22 #define SIZE_X 480
ivygatech 0:9e5b26a137ec 23 #define SIZE_Y 800
ivygatech 0:9e5b26a137ec 24
ivygatech 0:9e5b26a137ec 25 // overwrite 4DGL library screen size settings in uVGAIII.h
ivygatech 0:9e5b26a137ec 26
ivygatech 0:9e5b26a137ec 27 uVGAIII ecran(p9,p10,p11); // serial tx, serial rx, reset pin;
ivygatech 0:9e5b26a137ec 28
ivygatech 0:9e5b26a137ec 29 int main() {
ivygatech 0:9e5b26a137ec 30 char c;
ivygatech 0:9e5b26a137ec 31
ivygatech 0:9e5b26a137ec 32 printf("\n\n-----Starting-----\n\n");
ivygatech 0:9e5b26a137ec 33
ivygatech 1:333b7b189790 34 ecran.baudrate(128000);
ivygatech 0:9e5b26a137ec 35 ecran.screen_mode(LANDSCAPE);
ivygatech 0:9e5b26a137ec 36 ecran.graphics_parameters(RESOLUTION, 2); // set screen resolution to 800*480
ivygatech 0:9e5b26a137ec 37 ecran.touch_status();
ivygatech 0:9e5b26a137ec 38 ecran.background_color(DGREY);
ivygatech 0:9e5b26a137ec 39 ecran.cls();
ivygatech 0:9e5b26a137ec 40
ivygatech 0:9e5b26a137ec 41 ecran.circle(120, 160, 80, CYAN);
ivygatech 0:9e5b26a137ec 42 ecran.filled_triangle(320, 100, 340, 300, 500, 270, LIME);
ivygatech 0:9e5b26a137ec 43
ivygatech 0:9e5b26a137ec 44 ecran.move_cursor(5, 60);
ivygatech 0:9e5b26a137ec 45 ecran.char_width('d');
ivygatech 0:9e5b26a137ec 46 ecran.char_height('d');
ivygatech 0:9e5b26a137ec 47 ecran.text_fgd_color(MAGENTA);
ivygatech 0:9e5b26a137ec 48 ecran.text_bgd_color(YELLOW);
ivygatech 0:9e5b26a137ec 49 ecran.put_string("This is a test of string!\nHappy Pi Day :-)");
ivygatech 0:9e5b26a137ec 50
ivygatech 0:9e5b26a137ec 51 ecran.move_cursor(10, 10);
ivygatech 0:9e5b26a137ec 52 ecran.puts("This is a test of puts...\n");
ivygatech 0:9e5b26a137ec 53
ivygatech 1:333b7b189790 54 ecran.move_cursor(15, 98);
ivygatech 0:9e5b26a137ec 55 ecran.printf("This is a test of printf!\rMew...\nYeah!");
ivygatech 0:9e5b26a137ec 56
ivygatech 0:9e5b26a137ec 57 ecran.move_cursor(20,10);
ivygatech 0:9e5b26a137ec 58 ecran.printf("Starting real-time display...\n\n");
ivygatech 1:333b7b189790 59 ecran.move_cursor(20,78);
ivygatech 0:9e5b26a137ec 60 while((c=getchar())!= '~'){ // when type '~', exit the real time display
ivygatech 0:9e5b26a137ec 61 ecran.printf("%c",c);
ivygatech 0:9e5b26a137ec 62 }
ivygatech 0:9e5b26a137ec 63 ecran.printf("\n\nClosing real-time display...\n");
ivygatech 0:9e5b26a137ec 64
ivygatech 0:9e5b26a137ec 65 printf("\n\n-----Completed-----\n\n");
ivygatech 0:9e5b26a137ec 66 }