Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Eng.cpp@4:6f898b000797, 2020-05-14 (annotated)
- Committer:
- el18jgb
- Date:
- Thu May 14 16:16:49 2020 +0000
- Revision:
- 4:6f898b000797
- Child:
- 5:c37f4ed2cad3
not a working commit but want to go to this point if what i try from here fails;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el18jgb | 4:6f898b000797 | 1 | #include "Aim.h" |
el18jgb | 4:6f898b000797 | 2 | #include "mbed.h" |
el18jgb | 4:6f898b000797 | 3 | #include "N5110.h" |
el18jgb | 4:6f898b000797 | 4 | #include "Gamepad.h" |
el18jgb | 4:6f898b000797 | 5 | #include "Heston.h" |
el18jgb | 4:6f898b000797 | 6 | Eng::Eng() |
el18jgb | 4:6f898b000797 | 7 | { |
el18jgb | 4:6f898b000797 | 8 | |
el18jgb | 4:6f898b000797 | 9 | } |
el18jgb | 4:6f898b000797 | 10 | |
el18jgb | 4:6f898b000797 | 11 | Eng::~Eng() |
el18jgb | 4:6f898b000797 | 12 | { |
el18jgb | 4:6f898b000797 | 13 | |
el18jgb | 4:6f898b000797 | 14 | } |
el18jgb | 4:6f898b000797 | 15 | // objects |
el18jgb | 4:6f898b000797 | 16 | Gamepad pad; |
el18jgb | 4:6f898b000797 | 17 | N5110 lcd; |
el18jgb | 4:6f898b000797 | 18 | Aim Aim; |
el18jgb | 4:6f898b000797 | 19 | Heston heston; |
el18jgb | 4:6f898b000797 | 20 | |
el18jgb | 4:6f898b000797 | 21 | InterruptIn buttonA(PTC7); |
el18jgb | 4:6f898b000797 | 22 | InterruptIn buttonB(PTC9); |
el18jgb | 4:6f898b000797 | 23 | InterruptIn buttonX(PTC5); |
el18jgb | 4:6f898b000797 | 24 | InterruptIn buttonY(PTC0); |
el18jgb | 4:6f898b000797 | 25 | |
el18jgb | 4:6f898b000797 | 26 | DigitalOut led1(PTA2); |
el18jgb | 4:6f898b000797 | 27 | DigitalOut led2(PTC2); |
el18jgb | 4:6f898b000797 | 28 | DigitalOut led3(PTC3); |
el18jgb | 4:6f898b000797 | 29 | DigitalOut led4(PTA1); |
el18jgb | 4:6f898b000797 | 30 | |
el18jgb | 4:6f898b000797 | 31 | void init() |
el18jgb | 4:6f898b000797 | 32 | { |
el18jgb | 4:6f898b000797 | 33 | buttonA.mode(PullUp); // turn on internal pull-up resistor |
el18jgb | 4:6f898b000797 | 34 | // pin will be 1 (3.3 V) when not pressed and 0 (0 V) when pressed |
el18jgb | 4:6f898b000797 | 35 | buttonB.mode(PullUp); |
el18jgb | 4:6f898b000797 | 36 | buttonY.mode(PullUp); |
el18jgb | 4:6f898b000797 | 37 | buttonX.mode(PullUp); |
el18jgb | 4:6f898b000797 | 38 | // We therefore need to look for a falling edge on the pin to fire the interrupt |
el18jgb | 4:6f898b000797 | 39 | // when the button is pressed |
el18jgb | 4:6f898b000797 | 40 | buttonA.fall(&buttonA_isr); |
el18jgb | 4:6f898b000797 | 41 | buttonB.fall(&buttonB_isr); |
el18jgb | 4:6f898b000797 | 42 | buttonX.fall(&buttonX_isr); |
el18jgb | 4:6f898b000797 | 43 | buttonY.fall(&buttonY_isr); |
el18jgb | 4:6f898b000797 | 44 | } |
el18jgb | 4:6f898b000797 | 45 | void read_input(Gamepad &pad); |
el18jgb | 4:6f898b000797 | 46 | void update(Gamepad &pad); |
el18jgb | 4:6f898b000797 | 47 | void draw(N5110 &lcd); |