ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jgb

Dependencies:   mbed

Eng.cpp

Committer:
el18jgb
Date:
2020-05-14
Revision:
4:6f898b000797
Child:
5:c37f4ed2cad3

File content as of revision 4:6f898b000797:

#include "Aim.h"
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Heston.h"
Eng::Eng()
{

}

Eng::~Eng()
{

}
// objects
Gamepad pad;
N5110 lcd;
Aim Aim;
Heston heston;

InterruptIn buttonA(PTC7);
InterruptIn buttonB(PTC9);
InterruptIn buttonX(PTC5);
InterruptIn buttonY(PTC0);

DigitalOut led1(PTA2);
DigitalOut led2(PTC2);
DigitalOut led3(PTC3);
DigitalOut led4(PTA1);

void init()
{
    buttonA.mode(PullUp); // turn on internal pull-up resistor
    // pin will be 1 (3.3 V) when not pressed and 0 (0 V) when pressed
    buttonB.mode(PullUp);
    buttonY.mode(PullUp);
    buttonX.mode(PullUp);
    // We therefore need to look for a falling edge on the pin to fire the interrupt
    // when the button is pressed
    buttonA.fall(&buttonA_isr);
    buttonB.fall(&buttonB_isr);
    buttonX.fall(&buttonX_isr);
    buttonY.fall(&buttonY_isr);
}
void read_input(Gamepad &pad);
void update(Gamepad &pad);
void draw(N5110 &lcd);