Vizic Technologies
/
Triangles_SG2
Triangle Drawing Demo - MBED + SmartGPU2 board
Diff: main.cpp
- Revision:
- 0:6c3f2e4dca14
- Child:
- 1:28df954ecec5
diff -r 000000000000 -r 6c3f2e4dca14 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jul 10 03:42:12 2013 +0000 @@ -0,0 +1,52 @@ +/**************************************************************************************/ +/*SMARTGPU2 intelligent embedded graphics processor unit + those examples are for use the SMARTGPU2 with the mbed microcontoller, just connect tx,rx,and reset + Board: + http://vizictechnologies.com/#/smart-gpu-2/4577779046 + + www.vizictechnologies.com + Vizic Technologies copyright 2013 */ +/**************************************************************************************/ + +#include "mbed.h" +#include "SMARTGPU2.h" + +SMARTGPU2 lcd(TXPIN,RXPIN,RESETPIN); //create our object called "lcd" + + +/***************************************************/ +/***************************************************/ +void initializeSmartGPU2(void){ //Initialize SMARTGPU2 Board + lcd.reset(); //physically reset SMARTGPU2 + lcd.start(); //initialize the SMARTGPU2 processor +} + +/***************************************************/ +/***************************************************/ +/***************************************************/ +/***************************************************/ +int main() { + POINT p1, p2, p3; + COLOUR colour; + FILLGEOM fill; + + initializeSmartGPU2(); //Init communication with SmartGPU2 board + + lcd.baudChange(BAUD7); //set a fast baud! for fast drawing + + while(1){//forever + p1.x= (rand()%LCD_WIDTH); //get a random number 0-319 + p1.y= (rand()%LCD_HEIGHT); //get a random number 0-239 + p2.x= (rand()%LCD_WIDTH); //get a random number 0-319 + p2.y= (rand()%LCD_HEIGHT); //get a random number 0-239 + p3.x= (rand()%LCD_WIDTH); //get a random number 0-319 + p3.y= (rand()%LCD_HEIGHT); //get a random number 0-239 + colour= (rand()%65536); //get a random number 0-65535 + fill=(FILLGEOM)(rand()%2); //get a random number 0-1 + + //draw the triangle + if(lcd.drawTriangle(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, colour,fill) != 'O'){ //draw random triangles + while(1); //loop forever if different than 'O'--OK + } + } +} \ No newline at end of file