Library for communicating with a Gameduino shield. Provides colour VGA display, hardware sprites with collision detection and stero sound. See http://excamera.com/sphinx/gameduino/ for more details.

Dependents:   GameduinoTest SimpleGameduinoTest RobotRic

Note that to use this library you must also import the CommonTypes library because this library uses it.

To get an mbed talking to a Gameduino shield all you really have to do is connect the Gameduino to the SPI bus. I did it using an LPC11U24 mbed and wired it to the Gameduino as follows:

  • mbed pin...................Gameduino pin
  • 5 (MOSI)...................11 (MOSI)
  • 6 (MISO)...................12 (MISO)
  • 7 (SCK)....................13 (SCK)
  • 8..........................9 (SEL)
  • 40 (VOUT)..................5V and 3.3V
  • 1 (GND)....................GND

mbed pins 5, 6 and 7 make up the SPI datalink. mbed pin 8 should be configured as a digital output and is driven low to communicate with the Gameduino.

Probably best to run the whole lot off a regulated 5V supply rather than relying on the 5V supply from the USB cable. I have had problems with the mbed's 3.3V VOUT supply. If the USB voltage is very low (nearer 4V than 5V) then the mbed's 3.3V regulator won't work properly and can't provide much current. I struggled to draw 10 mA for an LED. These problems go away if you power everything off an external 5V supply. It also means you can unplug the mbed from your computer of course.

Mounting the Gameduino is a bit awkward. I put it on some stripboard using 3 SIL sockets designed for an Arduino. Then I mounted the mbed alongside using two 20 pin SIL sockets. Unfortunately Arduino shields like the Gameduino don't fit nicely on a 0.1 inch grid (like the mbed does) so some connections have to be made using flying wires.

Here are some screenshots:

/media/uploads/RichardE/_scaled_img_0055_compressed.jpg

/media/uploads/RichardE/_scaled_img_0057_compressed.jpg

The code for generating this last display is found here:

Import programGameduinoTest

More complicated test program that generates text, coloured sprites and sound.

Here's the games console:

/media/uploads/RichardE/_scaled_img_0058_compressed.jpg

and the insides. Don't worry about the cables and the 8 pin chips. You don't need them if all you want is a display. They are an RS485 chip and a serial EEPROM.

/media/uploads/RichardE/_scaled_img_0059_compressed.jpg

Committer:
RichardE
Date:
Wed Jun 05 22:03:35 2013 +0000
Revision:
5:d614b857b940
Parent:
0:d199d2362859
Made the spr variable in the Gameduino class public.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RichardE 0:d199d2362859 1 static const UInt8 font8x8[] = {
RichardE 0:d199d2362859 2
RichardE 0:d199d2362859 3 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,
RichardE 0:d199d2362859 4 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x7f, 0x36, 0x7f, 0x36, 0x36, 0x00,
RichardE 0:d199d2362859 5 0x0c, 0x3f, 0x68, 0x3e, 0x0b, 0x7e, 0x18, 0x00, 0x60, 0x66, 0x0c, 0x18, 0x30, 0x66, 0x06, 0x00,
RichardE 0:d199d2362859 6 0x38, 0x6c, 0x6c, 0x38, 0x6d, 0x66, 0x3b, 0x00, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
RichardE 0:d199d2362859 7 0x0c, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00,
RichardE 0:d199d2362859 8 0x00, 0x18, 0x7e, 0x3c, 0x7e, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00,
RichardE 0:d199d2362859 9 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
RichardE 0:d199d2362859 10 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00,
RichardE 0:d199d2362859 11 0x3c, 0x66, 0x6e, 0x7e, 0x76, 0x66, 0x3c, 0x00, 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00,
RichardE 0:d199d2362859 12 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x3c, 0x66, 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00,
RichardE 0:d199d2362859 13 0x0c, 0x1c, 0x3c, 0x6c, 0x7e, 0x0c, 0x0c, 0x00, 0x7e, 0x60, 0x7c, 0x06, 0x06, 0x66, 0x3c, 0x00,
RichardE 0:d199d2362859 14 0x1c, 0x30, 0x60, 0x7c, 0x66, 0x66, 0x3c, 0x00, 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00,
RichardE 0:d199d2362859 15 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00, 0x3c, 0x66, 0x66, 0x3e, 0x06, 0x0c, 0x38, 0x00,
RichardE 0:d199d2362859 16 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30,
RichardE 0:d199d2362859 17 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00,
RichardE 0:d199d2362859 18 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x3c, 0x66, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x00,
RichardE 0:d199d2362859 19
RichardE 0:d199d2362859 20 0x3c, 0x66, 0x6e, 0x6a, 0x6e, 0x60, 0x3c, 0x00, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00,
RichardE 0:d199d2362859 21 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00,
RichardE 0:d199d2362859 22 0x78, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x00, 0x7e, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x7e, 0x00,
RichardE 0:d199d2362859 23 0x7e, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3c, 0x00,
RichardE 0:d199d2362859 24 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00,
RichardE 0:d199d2362859 25 0x3e, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38, 0x00, 0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00,
RichardE 0:d199d2362859 26 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00, 0x63, 0x77, 0x7f, 0x6b, 0x6b, 0x63, 0x63, 0x00,
RichardE 0:d199d2362859 27 0x66, 0x66, 0x76, 0x7e, 0x6e, 0x66, 0x66, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
RichardE 0:d199d2362859 28 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x6a, 0x6c, 0x36, 0x00,
RichardE 0:d199d2362859 29 0x7c, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00,
RichardE 0:d199d2362859 30 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
RichardE 0:d199d2362859 31 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x63, 0x63, 0x6b, 0x6b, 0x7f, 0x77, 0x63, 0x00,
RichardE 0:d199d2362859 32 0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00,
RichardE 0:d199d2362859 33 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00, 0x7c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x00,
RichardE 0:d199d2362859 34 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x3e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3e, 0x00,
RichardE 0:d199d2362859 35 0x18, 0x3c, 0x66, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
RichardE 0:d199d2362859 36
RichardE 0:d199d2362859 37 0x1c, 0x36, 0x30, 0x7c, 0x30, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00,
RichardE 0:d199d2362859 38 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00,
RichardE 0:d199d2362859 39 0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00,
RichardE 0:d199d2362859 40 0x1c, 0x30, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x3c,
RichardE 0:d199d2362859 41 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00,
RichardE 0:d199d2362859 42 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x70, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x00,
RichardE 0:d199d2362859 43 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x36, 0x7f, 0x6b, 0x6b, 0x63, 0x00,
RichardE 0:d199d2362859 44 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00,
RichardE 0:d199d2362859 45 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x07,
RichardE 0:d199d2362859 46 0x00, 0x00, 0x6c, 0x76, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x00,
RichardE 0:d199d2362859 47 0x30, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00,
RichardE 0:d199d2362859 48 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00,
RichardE 0:d199d2362859 49 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c,
RichardE 0:d199d2362859 50 0x00, 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x0c, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0c, 0x00,
RichardE 0:d199d2362859 51 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0x30, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x30, 0x00,
RichardE 0:d199d2362859 52 0x31, 0x6b, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
RichardE 0:d199d2362859 53 };