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-05-04
- Revision:
- 5:1a9d84df7207
- Parent:
- 4:03d13a53308c
- Child:
- 6:85314a3d69cd
File content as of revision 5:1a9d84df7207:
/*
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 GROUND_WIDTH 50
#define BALL_SIZE 3
#define LINE_HEIGHT 1
#define LINE_WIDTH WIDTH
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);
if (falldown.check_goal() == 1) {
//falldown.read_input(pad);
//falldown.update(pad);
//render();
falldown.init(GROUND_HEIGHT,BALL_SIZE,LINE_HEIGHT,LINE_WIDTH);
wait(0.1);
//clear lines
//redraw lines
}
}
/*while (falldown.check_goal == 1) {
falldown.init(GROUND_HEIGHT,BALL_SIZE);
wait(0.1);*/
}
void init()
{
lcd.init();
pad.init();
falldown.init(GROUND_HEIGHT,BALL_SIZE,LINE_HEIGHT,LINE_WIDTH);
}
void render()
{
lcd.clear();
falldown.draw(lcd);
lcd.refresh();
}