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
- Committer:
- el17cr
- Date:
- 2019-04-05
- Revision:
- 2:7f91a86b4dc0
- Parent:
- 0:adb2f501dd61
- Child:
- 3:5edefa83f8f0
File content as of revision 2:7f91a86b4dc0:
/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
Name:
Username:
Student ID Number:
Date:
*/
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "Falldown.h"
#define GROUND_WIDTH 70
#define GROUND_HEIGHT 2
#define BALL_WIDTH 3
#define BALL_HEIGHT 3
struct UserInput {
Direction d;
float mag;
};
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); // K64F - pwr from 3V3
Gamepad pad;
Falldown falldown;
void init();
void update_game(UserInput input);
void render();
int main()
{
init();
render();
wait(0.1);
while (1) {
falldown.read_input(pad);
falldown.update(pad);
render();
wait(0.1);
}
}
void init()
{
lcd.init();
pad.init();
falldown.init(GROUND_WIDTH,GROUND_HEIGHT,BALL_WIDTH,BALL_HEIGHT);
}
void render()
{
lcd.clear();
//lcd.drawRect(2, 2, 80, 44, FILL_TRANSPARENT);
//gr.draw(lcd);
//ba.draw(lcd);
falldown.draw(lcd);
lcd.refresh();
}