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@31:eefa1d23a843, 2019-05-08 (annotated)
- Committer:
- shahidsajid
- Date:
- Wed May 08 12:13:28 2019 +0000
- Revision:
- 31:eefa1d23a843
- Parent:
- 24:23fd6b451db7
- Child:
- 33:9d34ef219fff
Documented and updated in-line comments for all the classes;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| shahidsajid | 0:bed27dc63dea | 1 | /* |
| shahidsajid | 0:bed27dc63dea | 2 | ELEC2645 Embedded Systems Project |
| shahidsajid | 0:bed27dc63dea | 3 | School of Electronic & Electrical Engineering |
| shahidsajid | 0:bed27dc63dea | 4 | University of Leeds |
| shahidsajid | 1:ce0d477de314 | 5 | Name: Shahid Zubin Sajid |
| shahidsajid | 1:ce0d477de314 | 6 | Username: el17szs |
| shahidsajid | 1:ce0d477de314 | 7 | Student ID Number: 201197609 |
| shahidsajid | 1:ce0d477de314 | 8 | Date: 21/03/2019 |
| shahidsajid | 1:ce0d477de314 | 9 | */ |
| shahidsajid | 1:ce0d477de314 | 10 | |
| shahidsajid | 1:ce0d477de314 | 11 | #include "mbed.h" |
| shahidsajid | 1:ce0d477de314 | 12 | #include "Gamepad.h" |
| shahidsajid | 1:ce0d477de314 | 13 | #include "N5110.h" |
| shahidsajid | 3:bd3465a70a5a | 14 | #include "Ball.h" |
| shahidsajid | 4:55a0509c4874 | 15 | #include "Bat.h" |
| shahidsajid | 10:6c6e09023942 | 16 | #include "Cricket.h" |
| shahidsajid | 1:ce0d477de314 | 17 | |
| shahidsajid | 31:eefa1d23a843 | 18 | #define BALL_SIZE 2 |
| shahidsajid | 31:eefa1d23a843 | 19 | #define BAT_HEIGHT 3 |
| shahidsajid | 31:eefa1d23a843 | 20 | #define BAT_WIDTH 6 |
| shahidsajid | 1:ce0d477de314 | 21 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
| shahidsajid | 20:9d21599fe350 | 22 | Gamepad mainpad; |
| shahidsajid | 10:6c6e09023942 | 23 | Cricket cricket; |
| shahidsajid | 1:ce0d477de314 | 24 | |
| shahidsajid | 12:954da4f4e565 | 25 | |
| shahidsajid | 1:ce0d477de314 | 26 | void init(); |
| shahidsajid | 1:ce0d477de314 | 27 | |
| shahidsajid | 20:9d21599fe350 | 28 | void welcome(); |
| shahidsajid | 3:bd3465a70a5a | 29 | void draw(); |
| shahidsajid | 3:bd3465a70a5a | 30 | void ball_test(); |
| shahidsajid | 1:ce0d477de314 | 31 | |
| shahidsajid | 1:ce0d477de314 | 32 | int main(){ |
| shahidsajid | 20:9d21599fe350 | 33 | int fps=14; |
| shahidsajid | 1:ce0d477de314 | 34 | init(); |
| shahidsajid | 18:a260ce8db9e7 | 35 | |
| shahidsajid | 20:9d21599fe350 | 36 | //welcome(); |
| shahidsajid | 20:9d21599fe350 | 37 | //draw(); |
| shahidsajid | 24:23fd6b451db7 | 38 | cricket.intro(lcd); |
| shahidsajid | 3:bd3465a70a5a | 39 | while(1){ |
| shahidsajid | 20:9d21599fe350 | 40 | |
| shahidsajid | 20:9d21599fe350 | 41 | cricket.game(lcd,mainpad); |
| shahidsajid | 10:6c6e09023942 | 42 | draw(); |
| shahidsajid | 11:f481ec642cc5 | 43 | wait(1.0f/fps); |
| shahidsajid | 10:6c6e09023942 | 44 | } |
| shahidsajid | 20:9d21599fe350 | 45 | |
| shahidsajid | 1:ce0d477de314 | 46 | } |
| shahidsajid | 1:ce0d477de314 | 47 | void init(){ |
| shahidsajid | 1:ce0d477de314 | 48 | lcd.init(); |
| shahidsajid | 20:9d21599fe350 | 49 | mainpad.init(); |
| shahidsajid | 31:eefa1d23a843 | 50 | cricket.init(BALL_SIZE,BAT_WIDTH,BAT_HEIGHT); |
| shahidsajid | 2:e9ac69c17a75 | 51 | } |
| shahidsajid | 3:bd3465a70a5a | 52 | void draw(){ |
| shahidsajid | 2:e9ac69c17a75 | 53 | lcd.clear(); |
| shahidsajid | 10:6c6e09023942 | 54 | cricket.draw(lcd); |
| shahidsajid | 2:e9ac69c17a75 | 55 | lcd.refresh(); |
| shahidsajid | 3:bd3465a70a5a | 56 | } |