Screen shot demo and test program for the Gameduino

Dependencies:   Gameduino mbed

main.cpp

Committer:
TheChrisyd
Date:
2012-12-21
Revision:
0:e506a4bb403e

File content as of revision 0:e506a4bb403e:

#include "mbed.h"
#include "GD.h"
#include "arduino.h"
#include "shield.h"

GDClass GD(ARD_MOSI, ARD_MISO, ARD_SCK, ARD_D9, USBTX, USBRX) ;

#define RED RGB(255,0,0)
#define GREEN RGB(0,255,0)

void setup()
{
  int i;

  GD.begin();
  GD.ascii();
  GD.putstr(20, 0, "Screenshot");

  GD.wr16(RAM_PAL + (8 * 127), RED);   // char 127: 0=red, 3=green
  GD.wr16(RAM_PAL + (8 * 127) + 6, GREEN);
  static PROGMEM prog_uchar box[] = {
     0xff, 0xff,
     0xc0, 0x03,
     0xc0, 0x03,
     0xc0, 0x03,
     0xc0, 0x03,
     0xc0, 0x03,
     0xc0, 0x03,
     0xff, 0xff };
  GD.copy(RAM_CHR + (16 * 127), box, sizeof(box));

  for (i = 0; i < 64; i++) {
    GD.wr(64 * i + i, 127);     // diagonal boxes

    char msg[20];
    sprintf(msg, "Line %d", i);
    GD.putstr(i + 2, i, msg);

    GD.wr(64 * i + 49, 127);    // boxes on right
  }

  //Serial.begin(1000000);
  long started = millis();
  GD.screenshot(0);
}


int main(){

   timer_start();
   setup();
   
}