Ellipses - MBED + SmartGPU2 board

Dependencies:   SMARTGPU2 mbed

Committer:
emmanuelchio
Date:
Wed Jul 10 03:27:38 2013 +0000
Revision:
0:fac3a822a910
Child:
1:974361f7ce8c
Ellipses - MBED + SmartGPU2 board

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emmanuelchio 0:fac3a822a910 1 /**************************************************************************************/
emmanuelchio 0:fac3a822a910 2 /*SMARTGPU2 intelligent embedded graphics processor unit
emmanuelchio 0:fac3a822a910 3 those examples are for use the SMARTGPU2 with the mbed microcontoller, just connect tx,rx,and reset
emmanuelchio 0:fac3a822a910 4 Board:
emmanuelchio 0:fac3a822a910 5 http://vizictechnologies.com/#/smart-gpu-2/4577779046
emmanuelchio 0:fac3a822a910 6
emmanuelchio 0:fac3a822a910 7 www.vizictechnologies.com
emmanuelchio 0:fac3a822a910 8 Vizic Technologies copyright 2013 */
emmanuelchio 0:fac3a822a910 9 /**************************************************************************************/
emmanuelchio 0:fac3a822a910 10
emmanuelchio 0:fac3a822a910 11 #include "mbed.h"
emmanuelchio 0:fac3a822a910 12 #include "SMARTGPU2.h"
emmanuelchio 0:fac3a822a910 13
emmanuelchio 0:fac3a822a910 14 SMARTGPU2 lcd(TXPIN,RXPIN,RESETPIN); //create our object called "lcd"
emmanuelchio 0:fac3a822a910 15
emmanuelchio 0:fac3a822a910 16
emmanuelchio 0:fac3a822a910 17 /***************************************************/
emmanuelchio 0:fac3a822a910 18 /***************************************************/
emmanuelchio 0:fac3a822a910 19 void initializeSmartGPU2(void){ //Initialize SMARTGPU2 Board
emmanuelchio 0:fac3a822a910 20 lcd.reset(); //physically reset SMARTGPU2
emmanuelchio 0:fac3a822a910 21 lcd.start(); //initialize the SMARTGPU2 processor
emmanuelchio 0:fac3a822a910 22 }
emmanuelchio 0:fac3a822a910 23
emmanuelchio 0:fac3a822a910 24 /***************************************************/
emmanuelchio 0:fac3a822a910 25 /***************************************************/
emmanuelchio 0:fac3a822a910 26 /***************************************************/
emmanuelchio 0:fac3a822a910 27 /***************************************************/
emmanuelchio 0:fac3a822a910 28 int main() {
emmanuelchio 0:fac3a822a910 29 POINT point;
emmanuelchio 0:fac3a822a910 30 RADIUS radiusx, radiusy;
emmanuelchio 0:fac3a822a910 31 COLOUR colour;
emmanuelchio 0:fac3a822a910 32 FILLGEOM fill;
emmanuelchio 0:fac3a822a910 33
emmanuelchio 0:fac3a822a910 34 initializeSmartGPU2(); //Init communication with SmartGPU2 board
emmanuelchio 0:fac3a822a910 35
emmanuelchio 0:fac3a822a910 36 lcd.baudChange(BAUD7); //set a fast baud! for fast drawing
emmanuelchio 0:fac3a822a910 37
emmanuelchio 0:fac3a822a910 38 while(1){//forever
emmanuelchio 0:fac3a822a910 39 point.x= (rand()%LCD_WIDTH); //get a random number 0-319
emmanuelchio 0:fac3a822a910 40 point.y= (rand()%LCD_HEIGHT); //get a random number 0-239
emmanuelchio 0:fac3a822a910 41 radiusx= (rand()%81)+1; //get a random number 1-80
emmanuelchio 0:fac3a822a910 42 radiusy= (rand()%81)+1; //get a random number 1-80
emmanuelchio 0:fac3a822a910 43 colour= (rand()%65536); //get a random number 0-65535
emmanuelchio 0:fac3a822a910 44 fill=(FILLGEOM)(rand()%2); //get a random number 0-1
emmanuelchio 0:fac3a822a910 45
emmanuelchio 0:fac3a822a910 46 //draw the Ellipse
emmanuelchio 0:fac3a822a910 47 if(lcd.drawEllipse(point.x,point.y,radiusx,radiusy,colour,fill) != 'O'){ //draw an Ellipse
emmanuelchio 0:fac3a822a910 48 while(1); //loop forever if different than 'O'--OK
emmanuelchio 0:fac3a822a910 49 }
emmanuelchio 0:fac3a822a910 50 }
emmanuelchio 0:fac3a822a910 51 }