ELEC2645 (2018/19) / Mbed 2 deprecated el17cr

Dependencies:   mbed

main.cpp

Committer:
el17cr
Date:
2019-04-22
Revision:
4:03d13a53308c
Parent:
3:5edefa83f8f0
Child:
5:1a9d84df7207

File content as of revision 4:03d13a53308c:

/*
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_SIZE 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_HEIGHT,BALL_SIZE);
}

void render()
{
    
    lcd.clear();
    falldown.draw(lcd);
    lcd.refresh();
    
}