Ellipses - MBED + SmartGPU2 board

Dependencies:   SMARTGPU2 mbed

Committer:
emmanuelchio
Date:
Thu Apr 17 21:42:46 2014 +0000
Revision:
1:974361f7ce8c
Parent:
0:fac3a822a910
SmartGPU2 Ellipses_SG2 demo- Please select(uncomment) your smartGPU2 board under SMARTGPU2.h file before compiling!!!

Who changed what in which revision?

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