Source code of my entry for Retro gaming contest (www.outrageouscircuits.com)

Dependencies:   MMA8453 mbed

Fork of LCD_DEMO by Chris Taylor

NOTE: I don't why mbed says that it's a fork form LCD_DEMO by Chris Taylor -> I don't use that library

SHAKE THE MAZE!!!

Shake your RETRO board and solve the maze!!! /media/uploads/gbr1mbed/dscn0738.jpg

Different maze everytime! /media/uploads/gbr1mbed/dscn0739.jpg

Here a case I built. /media/uploads/gbr1mbed/dscn0742.jpg

More details in main.cpp comments

video:

Committer:
gbr1mbed
Date:
Sun Mar 01 11:18:52 2015 +0000
Revision:
1:600980390cf7
Hello! this is my source for "Shake the Maze" game.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gbr1mbed 1:600980390cf7 1 #include "mbed.h"
gbr1mbed 1:600980390cf7 2
gbr1mbed 1:600980390cf7 3 #pragma once
gbr1mbed 1:600980390cf7 4
gbr1mbed 1:600980390cf7 5 class DisplayN18 {
gbr1mbed 1:600980390cf7 6 static const unsigned char STEP = 4;
gbr1mbed 1:600980390cf7 7
gbr1mbed 1:600980390cf7 8 DigitalOut resetPin;
gbr1mbed 1:600980390cf7 9 DigitalOut backlightPin;
gbr1mbed 1:600980390cf7 10 DigitalOut rsPin;
gbr1mbed 1:600980390cf7 11 DigitalOut csPin;
gbr1mbed 1:600980390cf7 12 SPI spi;
gbr1mbed 1:600980390cf7 13
gbr1mbed 1:600980390cf7 14 void writeCommand(unsigned char command);
gbr1mbed 1:600980390cf7 15 void writeData(unsigned char data);
gbr1mbed 1:600980390cf7 16 void writeData(const unsigned char* data, unsigned int length);
gbr1mbed 1:600980390cf7 17
gbr1mbed 1:600980390cf7 18 void reset();
gbr1mbed 1:600980390cf7 19 void initialize();
gbr1mbed 1:600980390cf7 20 void setClippingArea(unsigned char x, unsigned char y, unsigned char width, unsigned char height);
gbr1mbed 1:600980390cf7 21
gbr1mbed 1:600980390cf7 22 public:
gbr1mbed 1:600980390cf7 23 DisplayN18();
gbr1mbed 1:600980390cf7 24
gbr1mbed 1:600980390cf7 25 static const unsigned short BLUE = 0x00F8;
gbr1mbed 1:600980390cf7 26 static const unsigned short GREEN = 0xE007;
gbr1mbed 1:600980390cf7 27 static const unsigned short RED = 0x1F00;
gbr1mbed 1:600980390cf7 28 static const unsigned short WHITE = 0xFFFF;
gbr1mbed 1:600980390cf7 29 static const unsigned short BLACK = 0x0000;
gbr1mbed 1:600980390cf7 30
gbr1mbed 1:600980390cf7 31 static const unsigned int WIDTH = 160;
gbr1mbed 1:600980390cf7 32 static const unsigned int HEIGHT = 128;
gbr1mbed 1:600980390cf7 33 static const unsigned char CHAR_WIDTH = 5;
gbr1mbed 1:600980390cf7 34 static const unsigned char CHAR_HEIGHT = 8;
gbr1mbed 1:600980390cf7 35 static const unsigned char CHAR_SPACING = 1;
gbr1mbed 1:600980390cf7 36
gbr1mbed 1:600980390cf7 37 static unsigned short rgbToShort(unsigned char r, unsigned char g, unsigned char b);
gbr1mbed 1:600980390cf7 38
gbr1mbed 1:600980390cf7 39 void clear(unsigned short backColor = 0x0000);
gbr1mbed 1:600980390cf7 40 void draw(const unsigned short* data, int x, int y, int width, int height);
gbr1mbed 1:600980390cf7 41 void setPixel(int x, int y, unsigned short foreColor);
gbr1mbed 1:600980390cf7 42
gbr1mbed 1:600980390cf7 43 void fillRect(int x, int y, int width, int height, unsigned short foreColor);
gbr1mbed 1:600980390cf7 44 void drawRect(int x, int y, int width, int height, unsigned short foreColor);
gbr1mbed 1:600980390cf7 45
gbr1mbed 1:600980390cf7 46 void fillCircle(int x, int y, int radius, unsigned short foreColor);
gbr1mbed 1:600980390cf7 47 void drawCircle(int x, int y, int radius, unsigned short foreColor);
gbr1mbed 1:600980390cf7 48
gbr1mbed 1:600980390cf7 49 void drawLine(int x0, int y0, int x1, int y1, unsigned short foreColor);
gbr1mbed 1:600980390cf7 50
gbr1mbed 1:600980390cf7 51 void drawCharacter(int x, int y, const char character, unsigned short foreColor, unsigned short backColor, unsigned char fontSize = 1);
gbr1mbed 1:600980390cf7 52 void drawString(int x, int y, const char* str, unsigned short foreColor, unsigned short backColor, unsigned char fontSize = 1);
gbr1mbed 1:600980390cf7 53 };