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
main.cpp@6:4c55dd4b6d42, 2019-05-03 (annotated)
- Committer:
- batJoro
- Date:
- Fri May 03 19:17:56 2019 +0000
- Revision:
- 6:4c55dd4b6d42
- Parent:
- 5:5e92567d0a44
- Child:
- 7:9e9424f5ec4b
graphics1;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| batJoro | 1:3183193cf44e | 1 | |
| batJoro | 0:a0dedca5e89f | 2 | |
| batJoro | 0:a0dedca5e89f | 3 | /* |
| batJoro | 0:a0dedca5e89f | 4 | ELEC2645 Embedded Systems Project |
| batJoro | 0:a0dedca5e89f | 5 | School of Electronic & Electrical Engineering University of Leeds |
| batJoro | 0:a0dedca5e89f | 6 | |
| batJoro | 0:a0dedca5e89f | 7 | Name: Dobri Tsvetkov |
| batJoro | 0:a0dedca5e89f | 8 | Username: el17dtt |
| batJoro | 0:a0dedca5e89f | 9 | Student ID Number: 201154059 |
| batJoro | 0:a0dedca5e89f | 10 | Date: 12.03.2019 |
| batJoro | 0:a0dedca5e89f | 11 | */ |
| batJoro | 0:a0dedca5e89f | 12 | |
| batJoro | 3:f686f6d7bdff | 13 | |
| batJoro | 5:5e92567d0a44 | 14 | #include "mbed.h" |
| batJoro | 5:5e92567d0a44 | 15 | #include "Gamepad.h" |
| batJoro | 5:5e92567d0a44 | 16 | #include "N5110.h" |
| batJoro | 5:5e92567d0a44 | 17 | #include "menu.h" |
| batJoro | 6:4c55dd4b6d42 | 18 | #include "Tone.h" |
| batJoro | 6:4c55dd4b6d42 | 19 | #include "engine.h" |
| batJoro | 6:4c55dd4b6d42 | 20 | |
| batJoro | 6:4c55dd4b6d42 | 21 | |
| batJoro | 5:5e92567d0a44 | 22 | |
| batJoro | 3:f686f6d7bdff | 23 | /////////////// structs ///////////////// |
| batJoro | 3:f686f6d7bdff | 24 | |
| batJoro | 3:f686f6d7bdff | 25 | |
| batJoro | 3:f686f6d7bdff | 26 | /////////////// objects /////////////// |
| batJoro | 3:f686f6d7bdff | 27 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
| batJoro | 1:3183193cf44e | 28 | Gamepad gamepad; |
| batJoro | 1:3183193cf44e | 29 | |
| batJoro | 3:f686f6d7bdff | 30 | ///////////// prototypes /////////////// |
| batJoro | 4:2deeeeb6c1e1 | 31 | void init(); |
| batJoro | 4:2deeeeb6c1e1 | 32 | void welcome(); |
| batJoro | 6:4c55dd4b6d42 | 33 | void render(); |
| batJoro | 3:f686f6d7bdff | 34 | |
| batJoro | 3:f686f6d7bdff | 35 | ///////////// functions //////////////// |
| batJoro | 0:a0dedca5e89f | 36 | int main() { |
| batJoro | 0:a0dedca5e89f | 37 | |
| batJoro | 4:2deeeeb6c1e1 | 38 | init(); |
| batJoro | 1:3183193cf44e | 39 | |
| batJoro | 6:4c55dd4b6d42 | 40 | welcome(); |
| batJoro | 6:4c55dd4b6d42 | 41 | |
| batJoro | 6:4c55dd4b6d42 | 42 | // game loop - read input, update the game state and render the display |
| batJoro | 6:4c55dd4b6d42 | 43 | while(1) { |
| batJoro | 6:4c55dd4b6d42 | 44 | render(); |
| batJoro | 4:2deeeeb6c1e1 | 45 | } |
| batJoro | 4:2deeeeb6c1e1 | 46 | } |
| batJoro | 3:f686f6d7bdff | 47 | |
| batJoro | 4:2deeeeb6c1e1 | 48 | // initialies all classes and libraries |
| batJoro | 4:2deeeeb6c1e1 | 49 | void init() |
| batJoro | 4:2deeeeb6c1e1 | 50 | { |
| batJoro | 6:4c55dd4b6d42 | 51 | |
| batJoro | 4:2deeeeb6c1e1 | 52 | // need to initialise LCD and Gamepad |
| batJoro | 4:2deeeeb6c1e1 | 53 | lcd.init(); |
| batJoro | 4:2deeeeb6c1e1 | 54 | gamepad.init(); |
| batJoro | 4:2deeeeb6c1e1 | 55 | |
| batJoro | 4:2deeeeb6c1e1 | 56 | gamepad.leds_on(); |
| batJoro | 4:2deeeeb6c1e1 | 57 | lcd.setContrast(0.4); |
| batJoro | 4:2deeeeb6c1e1 | 58 | } |
| batJoro | 6:4c55dd4b6d42 | 59 | // function to call the intro method of the menu class |
| batJoro | 4:2deeeeb6c1e1 | 60 | void welcome() { |
| batJoro | 4:2deeeeb6c1e1 | 61 | |
| batJoro | 4:2deeeeb6c1e1 | 62 | Menu menu; |
| batJoro | 6:4c55dd4b6d42 | 63 | menu.intro(lcd, gamepad); |
| batJoro | 6:4c55dd4b6d42 | 64 | } |
| batJoro | 6:4c55dd4b6d42 | 65 | // this function draws each frame on the LCD |
| batJoro | 6:4c55dd4b6d42 | 66 | void render() { |
| batJoro | 6:4c55dd4b6d42 | 67 | |
| batJoro | 6:4c55dd4b6d42 | 68 | lcd.clear(); |
| batJoro | 6:4c55dd4b6d42 | 69 | lcd.refresh(); |
| batJoro | 0:a0dedca5e89f | 70 | } |