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 Nov 07 21:48:11 2012 +0000
Revision:
0:d199d2362859
Child:
1:8ff91fe70bfc
For communication with a Gameduino shield which provides a colour VGA display, sprites with hardware collision detection and stereo sound.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RichardE 0:d199d2362859 1 /*
RichardE 0:d199d2362859 2 * SOURCE FILE : Gameduino.h
RichardE 0:d199d2362859 3 *
RichardE 0:d199d2362859 4 * Definition of class Gameduino.
RichardE 0:d199d2362859 5 * Each instance of this class allows communication with
RichardE 0:d199d2362859 6 * a Gameduino shield over an SPI communications link.
RichardE 0:d199d2362859 7 *
RichardE 0:d199d2362859 8 */
RichardE 0:d199d2362859 9
RichardE 0:d199d2362859 10 #ifndef GameduinoDefined
RichardE 0:d199d2362859 11
RichardE 0:d199d2362859 12 #define GameduinoDefined
RichardE 0:d199d2362859 13
RichardE 0:d199d2362859 14 #include "mbed.h" // mbed library
RichardE 0:d199d2362859 15 #include "Types.h" // integer types
RichardE 0:d199d2362859 16
RichardE 0:d199d2362859 17 // These #defines allow you to use data arrays from an Arduino background that make
RichardE 0:d199d2362859 18 // use of program memory.
RichardE 0:d199d2362859 19 #define PROGMEM const
RichardE 0:d199d2362859 20 #define prog_uchar UInt8
RichardE 0:d199d2362859 21
RichardE 0:d199d2362859 22 /** Gameduino class to support SPI communications with the Gameduino game adapter
RichardE 0:d199d2362859 23 *
RichardE 0:d199d2362859 24 * Example:
RichardE 0:d199d2362859 25 * @code
RichardE 0:d199d2362859 26 * #include "mbed.h"
RichardE 0:d199d2362859 27 * #include "Gameduino.h"
RichardE 0:d199d2362859 28 *
RichardE 0:d199d2362859 29 * int main() {
RichardE 0:d199d2362859 30 * // Make a digital output for use with Gameduino.
RichardE 0:d199d2362859 31 * DigitalOut cs( p8 );
RichardE 0:d199d2362859 32 * // Initialise an SPI link for communications with Gameduino.
RichardE 0:d199d2362859 33 * // Use pin 5 for MOSI.
RichardE 0:d199d2362859 34 * // Use pin 6 for MISO.
RichardE 0:d199d2362859 35 * // Use pin 7 for SCK.
RichardE 0:d199d2362859 36 * SPI spi( p5, p6, p7 );
RichardE 0:d199d2362859 37 * // 8MHz clock should be OK.
RichardE 0:d199d2362859 38 * spi.frequency( 8000000 );
RichardE 0:d199d2362859 39 * // Set SPI format to use.
RichardE 0:d199d2362859 40 * // Use 8 bits per SPI frame.
RichardE 0:d199d2362859 41 * // Use SPI mode 0.
RichardE 0:d199d2362859 42 * spi.format( 8, 0 );
RichardE 0:d199d2362859 43 * // Make a Gameduino and pass SPI link and digital output for chip select.
RichardE 0:d199d2362859 44 * Gameduino gd( &spi, &cs );
RichardE 0:d199d2362859 45 * // Reset the Gameduino.
RichardE 0:d199d2362859 46 * gd.begin();
RichardE 0:d199d2362859 47 * // Lets have a default ASCII character set.
RichardE 0:d199d2362859 48 * gd.ascii();
RichardE 0:d199d2362859 49 * // Write something to character memory.
RichardE 0:d199d2362859 50 * gd.__wstart( Gameduino::RAM_PIC );
RichardE 0:d199d2362859 51 * for( UInt8 c = 'A'; c <= 'Z'; ++c ) {
RichardE 0:d199d2362859 52 * gd.__tr8( c );
RichardE 0:d199d2362859 53 * }
RichardE 0:d199d2362859 54 * gd.__end();
RichardE 0:d199d2362859 55 * // Test copy method.
RichardE 0:d199d2362859 56 * UInt8 copyData[] = "HELLO";
RichardE 0:d199d2362859 57 * gd.copy( Gameduino::RAM_PIC + 64, copyData, 5 );
RichardE 0:d199d2362859 58 * // Test putstr method.
RichardE 0:d199d2362859 59 * gd.putstr( 3, 10, "Ambidextrous!" );
RichardE 0:d199d2362859 60 * // Finished with Gameduino.
RichardE 0:d199d2362859 61 * gd.end();
RichardE 0:d199d2362859 62 * }
RichardE 0:d199d2362859 63 * @endcode
RichardE 0:d199d2362859 64 */
RichardE 0:d199d2362859 65 class Gameduino {
RichardE 0:d199d2362859 66
RichardE 0:d199d2362859 67 public :
RichardE 0:d199d2362859 68
RichardE 0:d199d2362859 69 // Registers on Gameduino.
RichardE 0:d199d2362859 70 enum Reg {
RichardE 0:d199d2362859 71 RAM_PIC = 0x0000, // Screen Picture, 64 x 64 = 4096 bytes
RichardE 0:d199d2362859 72 RAM_CHR = 0x1000, // Screen Characters, 256 x 16 = 4096 bytes
RichardE 0:d199d2362859 73 RAM_PAL = 0x2000, // Screen Character Palette, 256 x 8 = 2048 bytes
RichardE 0:d199d2362859 74 IDENT = 0x2800,
RichardE 0:d199d2362859 75 REV = 0x2801,
RichardE 0:d199d2362859 76 FRAME = 0x2802,
RichardE 0:d199d2362859 77 VBLANK = 0x2803,
RichardE 0:d199d2362859 78 SCROLL_X = 0x2804,
RichardE 0:d199d2362859 79 SCROLL_Y = 0x2806,
RichardE 0:d199d2362859 80 JK_MODE = 0x2808,
RichardE 0:d199d2362859 81 J1_RESET = 0x2809,
RichardE 0:d199d2362859 82 SPR_DISABLE = 0x280a,
RichardE 0:d199d2362859 83 SPR_PAGE = 0x280b,
RichardE 0:d199d2362859 84 IOMODE = 0x280c,
RichardE 0:d199d2362859 85 BG_COLOR = 0x280e,
RichardE 0:d199d2362859 86 SAMPLE_L = 0x2810,
RichardE 0:d199d2362859 87 SAMPLE_R = 0x2812,
RichardE 0:d199d2362859 88 MODULATOR = 0x2814,
RichardE 0:d199d2362859 89 VIDEO_MODE = 0x2815,
RichardE 0:d199d2362859 90 SCREENSHOT_Y = 0x281e,
RichardE 0:d199d2362859 91 PALETTE16A = 0x2840, // 16-color palette RAM A, 32 bytes
RichardE 0:d199d2362859 92 PALETTE16B = 0x2860, // 16-color palette RAM B, 32 bytes
RichardE 0:d199d2362859 93 PALETTE4A = 0x2880, // 4-color palette RAM A, 8 bytes
RichardE 0:d199d2362859 94 PALETTE4B = 0x2888, // 4-color palette RAM A, 8 bytes
RichardE 0:d199d2362859 95 COMM = 0x2890, // Communication buffer
RichardE 0:d199d2362859 96 COLLISION = 0x2900, // Collision detection RAM, 256 bytes
RichardE 0:d199d2362859 97 VOICES = 0x2a00, // Voice controls
RichardE 0:d199d2362859 98 J1_CODE = 0x2b00, // J1 coprocessor microcode RAM
RichardE 0:d199d2362859 99 SCREENSHOT = 0x2c00, // screenshot line RAM
RichardE 0:d199d2362859 100 RAM_SPR = 0x3000, // Sprite Control, 512 x 4 = 2048 bytes
RichardE 0:d199d2362859 101 RAM_SPRPAL = 0x3800, // Sprite Palettes, 4 x 256 = 2048 bytes
RichardE 0:d199d2362859 102 RAM_SPRIMG = 0x4000, // Sprite Image, 64 x 256 = 16384 bytes
RichardE 0:d199d2362859 103 };
RichardE 0:d199d2362859 104
RichardE 0:d199d2362859 105 // Modes of operation.
RichardE 0:d199d2362859 106 enum Mode {
RichardE 0:d199d2362859 107 MODE_800x600_72 = 0,
RichardE 0:d199d2362859 108 MODE_800x600_60 = 1,
RichardE 0:d199d2362859 109 };
RichardE 0:d199d2362859 110
RichardE 0:d199d2362859 111 // Sprite rotations.
RichardE 0:d199d2362859 112 enum Rotation {
RichardE 0:d199d2362859 113 None = 0,
RichardE 0:d199d2362859 114 SwapXY = 1,
RichardE 0:d199d2362859 115 FlipX = 2,
RichardE 0:d199d2362859 116 FlipXSwapXY = 3,
RichardE 0:d199d2362859 117 FlipY = 4,
RichardE 0:d199d2362859 118 FlipYSwapXY = 5,
RichardE 0:d199d2362859 119 FlipYFlipX = 6,
RichardE 0:d199d2362859 120 FlipYFlipXSwapXY = 7,
RichardE 0:d199d2362859 121 };
RichardE 0:d199d2362859 122
RichardE 0:d199d2362859 123 // Sound waveforms used with voice method.
RichardE 0:d199d2362859 124 enum WaveForm {
RichardE 0:d199d2362859 125 SineWave,
RichardE 0:d199d2362859 126 WhiteNoise,
RichardE 0:d199d2362859 127 };
RichardE 0:d199d2362859 128
RichardE 0:d199d2362859 129 // Other constants.
RichardE 0:d199d2362859 130 enum {
RichardE 0:d199d2362859 131 TRANSPARENT = ( 1 << 15 ),
RichardE 0:d199d2362859 132 };
RichardE 0:d199d2362859 133
RichardE 0:d199d2362859 134 // Structure used with plots method.
RichardE 0:d199d2362859 135 struct sprplot {
RichardE 0:d199d2362859 136 Int8 x, y; // offsets from origin
RichardE 0:d199d2362859 137 UInt8 image, palette; // sprite image number and palette information
RichardE 0:d199d2362859 138 };
RichardE 0:d199d2362859 139
RichardE 0:d199d2362859 140 /** Constructor.
RichardE 0:d199d2362859 141 * @param spi Pointer to SPI datalink to use for comms.
RichardE 0:d199d2362859 142 * @param cs Pointer to digital output used Gameduino as chip select.
RichardE 0:d199d2362859 143 */
RichardE 0:d199d2362859 144 Gameduino( SPI *spi, DigitalOut *cs );
RichardE 0:d199d2362859 145
RichardE 0:d199d2362859 146 /** Destructor.
RichardE 0:d199d2362859 147 */
RichardE 0:d199d2362859 148 virtual ~Gameduino();
RichardE 0:d199d2362859 149
RichardE 0:d199d2362859 150 /** Initialise connection to adapter and reset things.
RichardE 0:d199d2362859 151 */
RichardE 0:d199d2362859 152 void begin( void );
RichardE 0:d199d2362859 153
RichardE 0:d199d2362859 154 /** Close down connection.
RichardE 0:d199d2362859 155 */
RichardE 0:d199d2362859 156 void end( void ) {
RichardE 0:d199d2362859 157 // Can't think of anything to do.
RichardE 0:d199d2362859 158 }
RichardE 0:d199d2362859 159
RichardE 0:d199d2362859 160 /** Set default ASCII character set and palette.
RichardE 0:d199d2362859 161 */
RichardE 0:d199d2362859 162 void ascii( void );
RichardE 0:d199d2362859 163
RichardE 0:d199d2362859 164 /** Start an SPI transaction.
RichardE 0:d199d2362859 165 *
RichardE 0:d199d2362859 166 * @param address Address to read or write to. Bit 15 must be set for a write.
RichardE 0:d199d2362859 167 */
RichardE 0:d199d2362859 168 void __start( UInt16 address );
RichardE 0:d199d2362859 169
RichardE 0:d199d2362859 170 /** Start an SPI write transaction.
RichardE 0:d199d2362859 171 *
RichardE 0:d199d2362859 172 * @param address Address to write to.
RichardE 0:d199d2362859 173 */
RichardE 0:d199d2362859 174 void __wstart( UInt16 address );
RichardE 0:d199d2362859 175
RichardE 0:d199d2362859 176 /** Start a sprite transaction.
RichardE 0:d199d2362859 177 * Use this before calling xhide, xsprite or TransferSprite.
RichardE 0:d199d2362859 178 * @param sprnum Sprite number to start at.
RichardE 0:d199d2362859 179 */
RichardE 0:d199d2362859 180 void __wstartspr( UInt8 sprnum );
RichardE 0:d199d2362859 181
RichardE 0:d199d2362859 182 /** Transfer byte via SPI.
RichardE 0:d199d2362859 183 * Use only after a call to __start or __wstart.
RichardE 0:d199d2362859 184 * @param data Data to send.
RichardE 0:d199d2362859 185 */
RichardE 0:d199d2362859 186 UInt8 __tr8( UInt8 data );
RichardE 0:d199d2362859 187
RichardE 0:d199d2362859 188 /** Transfer 16 bit word via SPI.
RichardE 0:d199d2362859 189 * Use only after a call to __start or __wstart.
RichardE 0:d199d2362859 190 * @param data Data to send.
RichardE 0:d199d2362859 191 */
RichardE 0:d199d2362859 192 UInt8 __tr16( UInt16 data );
RichardE 0:d199d2362859 193
RichardE 0:d199d2362859 194 /** End an SPI transaction.
RichardE 0:d199d2362859 195 */
RichardE 0:d199d2362859 196 void __end( void );
RichardE 0:d199d2362859 197
RichardE 0:d199d2362859 198 /** Read a byte.
RichardE 0:d199d2362859 199 * @param address Address in Gameduino memory to read from.
RichardE 0:d199d2362859 200 * @param returns Byte at that address.
RichardE 0:d199d2362859 201 */
RichardE 0:d199d2362859 202 UInt8 rd( UInt16 address );
RichardE 0:d199d2362859 203
RichardE 0:d199d2362859 204 /** Read a 16 bit word.
RichardE 0:d199d2362859 205 * @param address Address in Gameduino memory to read from.
RichardE 0:d199d2362859 206 * @param returns Word at that address.
RichardE 0:d199d2362859 207 */
RichardE 0:d199d2362859 208 UInt16 rd16( UInt16 address );
RichardE 0:d199d2362859 209
RichardE 0:d199d2362859 210 /** Write a byte.
RichardE 0:d199d2362859 211 * @param address Address to write to.
RichardE 0:d199d2362859 212 * @param data Data to write.
RichardE 0:d199d2362859 213 */
RichardE 0:d199d2362859 214 void wr( UInt16 address, UInt8 data );
RichardE 0:d199d2362859 215
RichardE 0:d199d2362859 216 /** Write a 16 bit word.
RichardE 0:d199d2362859 217 * @param address Address to write to.
RichardE 0:d199d2362859 218 * @param data Data to write.
RichardE 0:d199d2362859 219 */
RichardE 0:d199d2362859 220 void wr16( UInt16 address, UInt16 data );
RichardE 0:d199d2362859 221
RichardE 0:d199d2362859 222 /** Fill area of Gameduino memory.
RichardE 0:d199d2362859 223 * @param address Address to write to.
RichardE 0:d199d2362859 224 * @param data Data to write to entire area.
RichardE 0:d199d2362859 225 * @param count Number of bytes to write.
RichardE 0:d199d2362859 226 */
RichardE 0:d199d2362859 227 void fill( UInt16 address, UInt8 data, UInt16 count );
RichardE 0:d199d2362859 228
RichardE 0:d199d2362859 229 /** Copy data into Gameduino memory.
RichardE 0:d199d2362859 230 * @param address Address to write to.
RichardE 0:d199d2362859 231 * @param src Pointer to data to copy from.
RichardE 0:d199d2362859 232 * @param count Number of bytes to write.
RichardE 0:d199d2362859 233 */
RichardE 0:d199d2362859 234 void copy( UInt16 address, const UInt8 *src, UInt16 count );
RichardE 0:d199d2362859 235
RichardE 0:d199d2362859 236 /** Hide a sprite.
RichardE 0:d199d2362859 237 * Use only after specifying address to write to.
RichardE 0:d199d2362859 238 * Basically just writes 400 twice to SPI.
RichardE 0:d199d2362859 239 */
RichardE 0:d199d2362859 240 void xhide( void );
RichardE 0:d199d2362859 241
RichardE 0:d199d2362859 242 /** Send sprite information to Gameduino.
RichardE 0:d199d2362859 243 * Use only after specifying address to write to.
RichardE 0:d199d2362859 244 * @param x X coordinate.
RichardE 0:d199d2362859 245 * @param y Y coordinate.
RichardE 0:d199d2362859 246 * @param image Sprite image number.
RichardE 0:d199d2362859 247 * @param palette Palette selection information (use 0 for 256 colour palette).
RichardE 0:d199d2362859 248 * @param rot Rotation and flip setting.
RichardE 0:d199d2362859 249 * @param jk JK collision information.
RichardE 0:d199d2362859 250 */
RichardE 0:d199d2362859 251 void TransferSprite( Int16 x, Int16 y, UInt8 image, UInt8 palette, Rotation rot=None, UInt8 jk=0 );
RichardE 0:d199d2362859 252
RichardE 0:d199d2362859 253 /** Draw a sprite at an offset from an origin taking into account rotation.
RichardE 0:d199d2362859 254 * Use only after specifying address to write to.
RichardE 0:d199d2362859 255 * @param ox Origin X coordinate.
RichardE 0:d199d2362859 256 * @param oy Origin Y coordinate.
RichardE 0:d199d2362859 257 * @param x X offset from origin.
RichardE 0:d199d2362859 258 * @param y Y offset from origin.
RichardE 0:d199d2362859 259 * @param image Sprite image number.
RichardE 0:d199d2362859 260 * @param palette Palette selection information (use 0 for 256 colour palette).
RichardE 0:d199d2362859 261 * @param rot Rotation and flip setting.
RichardE 0:d199d2362859 262 * @param jk JK collision information.
RichardE 0:d199d2362859 263 */
RichardE 0:d199d2362859 264 void xsprite( Int16 ox, Int16 oy, Int8 x, Int8 y, UInt8 image, UInt8 palette, Rotation rot=None, UInt8 jk=0 );
RichardE 0:d199d2362859 265
RichardE 0:d199d2362859 266 /** Construct RGB value.
RichardE 0:d199d2362859 267 * @param r Red level.
RichardE 0:d199d2362859 268 * @param g Green level.
RichardE 0:d199d2362859 269 * @param b Blue level.
RichardE 0:d199d2362859 270 * @param returns RGB value.
RichardE 0:d199d2362859 271 */
RichardE 0:d199d2362859 272 static UInt16 RGB( UInt8 r, UInt8 g, UInt8 b );
RichardE 0:d199d2362859 273
RichardE 0:d199d2362859 274 /** Set palette entry.
RichardE 0:d199d2362859 275 * @param Pallete entry.
RichardE 0:d199d2362859 276 * @param rgb RGB value to store.
RichardE 0:d199d2362859 277 */
RichardE 0:d199d2362859 278 void setpal( UInt16 pal, UInt16 rgb );
RichardE 0:d199d2362859 279
RichardE 0:d199d2362859 280 /** Write text at given coordinates.
RichardE 0:d199d2362859 281 * @param x X coordinate.
RichardE 0:d199d2362859 282 * @param y Y coordinate.
RichardE 0:d199d2362859 283 * @param s pointer to zero terminated text.
RichardE 0:d199d2362859 284 */
RichardE 0:d199d2362859 285 void putstr( UInt8 x, UInt8 y, const char *s );
RichardE 0:d199d2362859 286
RichardE 0:d199d2362859 287 /** Position a sprite.
RichardE 0:d199d2362859 288 * @param spr Sprite number.
RichardE 0:d199d2362859 289 * @param x X coordinate.
RichardE 0:d199d2362859 290 * @param y Y coordinate.
RichardE 0:d199d2362859 291 * @param image Sprite image number.
RichardE 0:d199d2362859 292 * @param palette Palette selection information (use 0 for 256 colour palette).
RichardE 0:d199d2362859 293 * @param rot Rotation and flip setting.
RichardE 0:d199d2362859 294 * @param jk JK collision information.
RichardE 0:d199d2362859 295 */
RichardE 0:d199d2362859 296 void sprite( UInt8 spr, Int16 x, Int16 y, UInt8 image, UInt8 palette, Rotation rot=None, UInt8 jk=0 );
RichardE 0:d199d2362859 297
RichardE 0:d199d2362859 298 /** Draw 4 sprites as a 2 by 2 block.
RichardE 0:d199d2362859 299 * @param spr Sprite number for first sprite.
RichardE 0:d199d2362859 300 * @param x X coordinate for centre of group.
RichardE 0:d199d2362859 301 * @param y Y coordinate for centre of group.
RichardE 0:d199d2362859 302 * @param image Sprite image number for first image.
RichardE 0:d199d2362859 303 * @param palette Palette selection information (use 0 for 256 colour palette).
RichardE 0:d199d2362859 304 * @param rot Rotation and flip setting.
RichardE 0:d199d2362859 305 * @param jk JK collision information.
RichardE 0:d199d2362859 306 */
RichardE 0:d199d2362859 307 void sprite2x2( UInt8 spr, Int16 x, Int16 y, UInt8 image, UInt8 palette, Rotation rot=None, UInt8 jk=0 );
RichardE 0:d199d2362859 308
RichardE 0:d199d2362859 309 /** Plot a number of sprites relative to an origin.
RichardE 0:d199d2362859 310 * @param x X coordinate of origin.
RichardE 0:d199d2362859 311 * @param y Y coordinate of origin.
RichardE 0:d199d2362859 312 * @param psp Pointer to an array of sprplot structures.
RichardE 0:d199d2362859 313 * @param count Number of structures in the psp array.
RichardE 0:d199d2362859 314 * @param rot Rotation and flip setting.
RichardE 0:d199d2362859 315 * @param jk JK collision information.
RichardE 0:d199d2362859 316 */
RichardE 0:d199d2362859 317 void plots( Int16 ox, Int16 oy, const sprplot *psp, UInt8 count, Rotation rot=None, UInt8 jk=0 );
RichardE 0:d199d2362859 318
RichardE 0:d199d2362859 319 /** Wait for vertical blanking.
RichardE 0:d199d2362859 320 */
RichardE 0:d199d2362859 321 void waitvblank( void );
RichardE 0:d199d2362859 322
RichardE 0:d199d2362859 323 /****************/
RichardE 0:d199d2362859 324 /* MAKE A NOISE */
RichardE 0:d199d2362859 325 /****************/
RichardE 0:d199d2362859 326 /** Make a noise.
RichardE 0:d199d2362859 327 * @param v Voice number.
RichardE 0:d199d2362859 328 * @param wave Waveform type.
RichardE 0:d199d2362859 329 * @param freq Frequency in quarter Hz (so 100 Hz is 400).
RichardE 0:d199d2362859 330 * @param lamp Amplitude for left channel.
RichardE 0:d199d2362859 331 * @param ramp Amplitude for right channel.
RichardE 0:d199d2362859 332 */
RichardE 0:d199d2362859 333 void voice( UInt8 v, WaveForm wave, UInt16 freq, UInt8 lamp, UInt8 ramp );
RichardE 0:d199d2362859 334
RichardE 0:d199d2362859 335 private :
RichardE 0:d199d2362859 336
RichardE 0:d199d2362859 337 // Pointer to SPI datalink.
RichardE 0:d199d2362859 338 SPI *spi;
RichardE 0:d199d2362859 339
RichardE 0:d199d2362859 340 // Pointer to chip select digital output.
RichardE 0:d199d2362859 341 DigitalOut *cs;
RichardE 0:d199d2362859 342
RichardE 0:d199d2362859 343 // Current sprite. Used by xsprite and xhide etc.
RichardE 0:d199d2362859 344 UInt8 spr;
RichardE 0:d199d2362859 345
RichardE 0:d199d2362859 346 };
RichardE 0:d199d2362859 347
RichardE 0:d199d2362859 348 #endif
RichardE 0:d199d2362859 349
RichardE 0:d199d2362859 350 /* END of Gameduino.h */