Doxygen comments added
Dependencies: mbed Gamepad N5110
main.cpp@1:beceda7046fb, 2019-03-29 (annotated)
- Committer:
- rafeh
- Date:
- Fri Mar 29 19:27:10 2019 +0000
- Revision:
- 1:beceda7046fb
- Parent:
- 0:43364ffd7cf6
- Child:
- 2:9f5714571c41
welcome screen with picture displayed by setting pixels commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rafeh | 0:43364ffd7cf6 | 1 | /* |
rafeh | 0:43364ffd7cf6 | 2 | ELEC2645 Embedded Systems Project |
rafeh | 0:43364ffd7cf6 | 3 | School of Electronic & Electrical Engineering |
rafeh | 0:43364ffd7cf6 | 4 | University of Leeds |
rafeh | 0:43364ffd7cf6 | 5 | Name: Rafeh Ishtiaq |
rafeh | 0:43364ffd7cf6 | 6 | Username: el17ri |
rafeh | 0:43364ffd7cf6 | 7 | Student ID Number: 201062291 |
rafeh | 0:43364ffd7cf6 | 8 | Date: 20/03/2019 |
rafeh | 0:43364ffd7cf6 | 9 | */ |
rafeh | 0:43364ffd7cf6 | 10 | |
rafeh | 0:43364ffd7cf6 | 11 | #include "mbed.h" |
rafeh | 0:43364ffd7cf6 | 12 | #include "N5110.h" |
rafeh | 0:43364ffd7cf6 | 13 | #include "Gamepad.h" |
rafeh | 0:43364ffd7cf6 | 14 | |
rafeh | 0:43364ffd7cf6 | 15 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
rafeh | 0:43364ffd7cf6 | 16 | Gamepad pad; |
rafeh | 1:beceda7046fb | 17 | |
rafeh | 1:beceda7046fb | 18 | const int bird [40][40] = |
rafeh | 1:beceda7046fb | 19 | { |
rafeh | 1:beceda7046fb | 20 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
rafeh | 1:beceda7046fb | 21 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0, |
rafeh | 1:beceda7046fb | 52 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0, |
rafeh | 1:beceda7046fb | 53 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0, |
rafeh | 1:beceda7046fb | 54 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
rafeh | 1:beceda7046fb | 55 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
rafeh | 1:beceda7046fb | 56 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
rafeh | 1:beceda7046fb | 57 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
rafeh | 1:beceda7046fb | 58 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
rafeh | 1:beceda7046fb | 59 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
rafeh | 0:43364ffd7cf6 | 60 | |
rafeh | 1:beceda7046fb | 61 | }; |
rafeh | 0:43364ffd7cf6 | 62 | |
rafeh | 0:43364ffd7cf6 | 63 | void welcome(); |
rafeh | 0:43364ffd7cf6 | 64 | |
rafeh | 0:43364ffd7cf6 | 65 | int main() { |
rafeh | 0:43364ffd7cf6 | 66 | lcd.init(); |
rafeh | 0:43364ffd7cf6 | 67 | pad.init(); |
rafeh | 0:43364ffd7cf6 | 68 | lcd.clear(); |
rafeh | 1:beceda7046fb | 69 | lcd.setContrast(0.5); |
rafeh | 1:beceda7046fb | 70 | welcome(); |
rafeh | 0:43364ffd7cf6 | 71 | |
rafeh | 0:43364ffd7cf6 | 72 | } |
rafeh | 0:43364ffd7cf6 | 73 | |
rafeh | 0:43364ffd7cf6 | 74 | void welcome() { |
rafeh | 1:beceda7046fb | 75 | lcd.drawSprite(0,0,40,40,(int*)bird); |
rafeh | 1:beceda7046fb | 76 | lcd.printString(" Flappy ",40,0); |
rafeh | 1:beceda7046fb | 77 | lcd.printString(" Bird ",40,1); |
rafeh | 1:beceda7046fb | 78 | lcd.printString(" Press ",40,3); |
rafeh | 1:beceda7046fb | 79 | lcd.printString(" Start ",40,4); |
rafeh | 1:beceda7046fb | 80 | lcd.refresh(); |
rafeh | 1:beceda7046fb | 81 | while ( pad.check_event(Gamepad::START_PRESSED) == false) { |
rafeh | 1:beceda7046fb | 82 | pad.leds_on(); |
rafeh | 1:beceda7046fb | 83 | wait(0.1); |
rafeh | 1:beceda7046fb | 84 | pad.leds_off(); |
rafeh | 1:beceda7046fb | 85 | wait(0.1); |
rafeh | 1:beceda7046fb | 86 | } |
rafeh | 1:beceda7046fb | 87 | |
rafeh | 1:beceda7046fb | 88 | |
rafeh | 1:beceda7046fb | 89 | |
rafeh | 0:43364ffd7cf6 | 90 | |
rafeh | 0:43364ffd7cf6 | 91 | } |
rafeh | 0:43364ffd7cf6 | 92 |