ELEC2645 (2015/16) / Mbed 2 deprecated 2645_ProjectCode

Dependencies:   N5110 mbed

main.cpp

Committer:
el15s3p
Date:
2016-04-25
Revision:
0:d3a050703801
Child:
1:9d69901e18d0

File content as of revision 0:d3a050703801:

#include "mbed.h"
#include "N5110.h"

#define DIRECTION_TOLERANCE 0.05

//         VCC,    SCE,   RST,   D/C,   MOSI,  SCLK,   LED
N5110 lcd (PTE26 , PTA0 , PTC4 , PTD0 , PTD2 , PTD1 , PTC3);

// connections for joystick
DigitalIn buttonJoy(PTB11);
AnalogIn xPot(PTB2);
AnalogIn yPot(PTB3);

AnalogIn Pot1(PTB10);

BusOut leds(LED1,LED2);
DigitalOut led1(LED1);
DigitalOut led2(LED2);


InterruptIn sw2 (SW2);
DigitalIn buttonA(PTB18);
DigitalIn buttonB(PTB19);
PwmOut buzzer(PTA2);

// timer to regularly read the joystick
Ticker pollJoystick;

enum DirectionName {
    UP,
    DOWN,
    LEFT,
    RIGHT,
    CENTRE,
    UNKNOWN
};

// struct for Joystick
typedef struct JoyStick Joystick;
struct JoyStick {
    float x;    // current x value
    float x0;   // 'centred' x value
    float y;    // current y value
    float y0;   // 'centred' y value
    int button; // button state (assume pull-down used, so 1 = pressed, 0 = unpressed)
    DirectionName direction;  // current direction
};
// create struct variable
Joystick joystick;

int printFlag = 0;

int main()
{
    lcd.init();
    lcd.clear();
    lcd.normalMode();
    lcd.printString("Comet Crusher!",0,0);
    lcd.printString("Start",10,2);
    lcd.printString("Difficulty",10,3);
    lcd.printString("Scores",10,4);
    lcd.printString("Instructions",10,5);
    lcd.printString(">",5,2);
    while(1) {
    }
}

void Game()
{
}

void DifficultySet()
{
}

void HighScore()
{
}

void Instructions()
{
}