Vizic Technologies / Mbed 2 deprecated Ellipses_SG2

Dependencies:   SMARTGPU2 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /**************************************************************************************/
00002 /**************************************************************************************/
00003 /*SMARTGPU2 intelligent embedded graphics processor unit
00004  those examples are for using the SMARTGPU2 with the mbed microcontoller, just connect tx,rx,and reset
00005  Board:
00006  http://www.vizictechnologies.com/
00007  
00008  www.vizictechnologies.com 
00009  Vizic Technologies copyright 2014 */
00010 /**************************************************************************************/
00011 /**************************************************************************************/
00012 
00013 #include "mbed.h"
00014 #include "SMARTGPU2.h"
00015 
00016 SMARTGPU2 lcd(TXPIN,RXPIN,RESETPIN);  //create our object called "lcd"
00017 
00018 
00019 /***************************************************/
00020 /***************************************************/
00021 void initializeSmartGPU2(void){      //Initialize SMARTGPU2 Board
00022   lcd.reset();                       //physically reset SMARTGPU2
00023   lcd.start();                       //initialize the SMARTGPU2 processor
00024 }
00025 
00026 /***************************************************/
00027 /***************************************************/
00028 /***************************************************/
00029 /***************************************************/
00030 int main() {
00031   POINT point;
00032   RADIUS radiusx, radiusy;
00033   COLOUR colour;
00034   FILLGEOM fill;
00035       
00036   initializeSmartGPU2();             //Init communication with SmartGPU2 board
00037   
00038   lcd.baudChange(BAUD7);             //set a fast baud! for fast drawing
00039   
00040   while(1){//forever
00041     point.x= (rand()%LCD_WIDTH);   //get a random number 0-319
00042     point.y= (rand()%LCD_HEIGHT);  //get a random number 0-239
00043     radiusx= (rand()%81)+1;        //get a random number 1-80
00044     radiusy= (rand()%81)+1;        //get a random number 1-80      
00045     colour=  (rand()%65536);       //get a random number 0-65535
00046     fill=(FILLGEOM)(rand()%2);     //get a random number 0-1
00047     
00048     //draw the Ellipse
00049     if(lcd.drawEllipse(point.x,point.y,radiusx,radiusy,colour,fill) != 'O'){  //draw an Ellipse
00050       while(1);                    //loop forever if different than 'O'--OK
00051     }      
00052   }
00053 }