SMARTGPU general graphics demo (trianges, lines, rectangles, images, circles, text, etc). Be sure to load image and text to microSD first!
main.cpp@0:556a70b19254, 2011-09-14 (annotated)
- Committer:
- emmanuelchio
- Date:
- Wed Sep 14 05:28:43 2011 +0000
- Revision:
- 0:556a70b19254
REV1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emmanuelchio | 0:556a70b19254 | 1 | /**************************************************************************************/ |
emmanuelchio | 0:556a70b19254 | 2 | /*SMARTGPU intelligent embedded graphics processor unit |
emmanuelchio | 0:556a70b19254 | 3 | those examples are for use the SMARTGPU with the mbed microcontoller, just connect tx,rx,and reset |
emmanuelchio | 0:556a70b19254 | 4 | Board: |
emmanuelchio | 0:556a70b19254 | 5 | http://www.vizictechnologies.com/#/desarrollo/4554296549 |
emmanuelchio | 0:556a70b19254 | 6 | |
emmanuelchio | 0:556a70b19254 | 7 | This example requires pre-loaded content to the micro SD card, images and text files! |
emmanuelchio | 0:556a70b19254 | 8 | |
emmanuelchio | 0:556a70b19254 | 9 | www.vizictechnologies.com |
emmanuelchio | 0:556a70b19254 | 10 | Vizic Technologies copyright 2011 */ |
emmanuelchio | 0:556a70b19254 | 11 | /**************************************************************************************/ |
emmanuelchio | 0:556a70b19254 | 12 | /**************************************************************************************/ |
emmanuelchio | 0:556a70b19254 | 13 | |
emmanuelchio | 0:556a70b19254 | 14 | #include "mbed.h" |
emmanuelchio | 0:556a70b19254 | 15 | #include "SMARTGPU.h" |
emmanuelchio | 0:556a70b19254 | 16 | |
emmanuelchio | 0:556a70b19254 | 17 | SMARTGPU lcd(p13,p14,p15); //(TX,RX,Reset); |
emmanuelchio | 0:556a70b19254 | 18 | |
emmanuelchio | 0:556a70b19254 | 19 | char message[]="Hello World"; //an array containing some text for later use |
emmanuelchio | 0:556a70b19254 | 20 | |
emmanuelchio | 0:556a70b19254 | 21 | int main() { |
emmanuelchio | 0:556a70b19254 | 22 | lcd.reset(); //physically reset SMARTGPU |
emmanuelchio | 0:556a70b19254 | 23 | lcd.start(); //initialize the SMARTGPU processor |
emmanuelchio | 0:556a70b19254 | 24 | |
emmanuelchio | 0:556a70b19254 | 25 | while (1) { |
emmanuelchio | 0:556a70b19254 | 26 | wait_ms(1000); //wait some time |
emmanuelchio | 0:556a70b19254 | 27 | lcd.drawLine(50,50,150,200,WHITE); //draw a line |
emmanuelchio | 0:556a70b19254 | 28 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 29 | lcd.drawRectangle(10,10,200,180,RED,UNFILL); //draw a rectangle |
emmanuelchio | 0:556a70b19254 | 30 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 31 | lcd.drawCircle(160,120,50,GREEN,UNFILL); //draw a circle |
emmanuelchio | 0:556a70b19254 | 32 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 33 | lcd.drawTriangle(15,15,200,210,180,70,BLUE,UNFILL); //draw a triangle |
emmanuelchio | 0:556a70b19254 | 34 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 35 | lcd.string(10,10,300,220,YELLOW,FONT3,TRANS,"This is the string test for SMARTGPU lcd320x240"); //write a string on the screen |
emmanuelchio | 0:556a70b19254 | 36 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 37 | lcd.string(10,60,300,220,GREEN,FONT3,TRANS,message); //write the string previously created (char message[]="Hello World";) |
emmanuelchio | 0:556a70b19254 | 38 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 39 | lcd.putLetter(100,100,MAGENTA,FONT3,TRANS,'E'); //write a single letter 'E' |
emmanuelchio | 0:556a70b19254 | 40 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 41 | lcd.putPixel(300,200,CYAN); //draw a pixel |
emmanuelchio | 0:556a70b19254 | 42 | wait_ms(3000); |
emmanuelchio | 0:556a70b19254 | 43 | lcd.imageSD(0,0,"hydra320"); //call the image "hydra320.bmp" previously stored on the micro SD card |
emmanuelchio | 0:556a70b19254 | 44 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 45 | lcd.stringSD(5,50,300,230,MAGENTA,FONT3,TRANS,BEGINNING,ALLCONTENTS,"text1"); //call the text file "text1.txt" previously stored on the micro SD card |
emmanuelchio | 0:556a70b19254 | 46 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 47 | lcd.drawRectangle(10,10,200,180,RED,FILL); //draw a rectangle |
emmanuelchio | 0:556a70b19254 | 48 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 49 | lcd.drawCircle(160,120,50,GREEN,FILL); //draw a circle |
emmanuelchio | 0:556a70b19254 | 50 | wait_ms(1000); |
emmanuelchio | 0:556a70b19254 | 51 | lcd.drawTriangle(15,15,200,210,180,70,BLUE,FILL); //draw a triangle |
emmanuelchio | 0:556a70b19254 | 52 | wait_ms(3000); |
emmanuelchio | 0:556a70b19254 | 53 | lcd.erase(); //erase screen |
emmanuelchio | 0:556a70b19254 | 54 | } |
emmanuelchio | 0:556a70b19254 | 55 | } |