Ellipses - MBED + SmartGPU2 board

Dependencies:   SMARTGPU2 mbed

main.cpp

Committer:
emmanuelchio
Date:
2013-07-10
Revision:
0:fac3a822a910
Child:
1:974361f7ce8c

File content as of revision 0:fac3a822a910:

/**************************************************************************************/
/*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 point;
  RADIUS radiusx, radiusy;
  COLOUR colour;
  FILLGEOM fill;
      
  initializeSmartGPU2();             //Init communication with SmartGPU2 board
  
  lcd.baudChange(BAUD7);             //set a fast baud! for fast drawing
  
  while(1){//forever
    point.x= (rand()%LCD_WIDTH);   //get a random number 0-319
    point.y= (rand()%LCD_HEIGHT);  //get a random number 0-239
    radiusx= (rand()%81)+1;        //get a random number 1-80
    radiusy= (rand()%81)+1;        //get a random number 1-80      
    colour=  (rand()%65536);       //get a random number 0-65535
    fill=(FILLGEOM)(rand()%2);     //get a random number 0-1
    
    //draw the Ellipse
    if(lcd.drawEllipse(point.x,point.y,radiusx,radiusy,colour,fill) != 'O'){  //draw an Ellipse
      while(1);                    //loop forever if different than 'O'--OK
    }      
  }
}