James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

main.cpp

Committer:
JamesCummins
Date:
2019-04-07
Revision:
6:952ac12c7f00
Parent:
5:7e8f5fad7b6b
Child:
7:6eb9cade57ab

File content as of revision 6:952ac12c7f00:

/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
Name: James Nathan Cummins
Username: el17jnc
Student ID Number: 201096364
Date: 22/03/19
*/

#include "Gamepad.h"
#include "mbed.h"
#include "N5110.h"

Gamepad gamepad;
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
bool startmenu();

int main(){
    gamepad.init();
    lcd.init();
    wait(1);
    bool cont = startmenu();
    
}
    
bool startmenu() {
    lcd.clear();
    char gamename[] = {'L', 'A', 'B', 'Y', 'R', 'I', 'N', 'T', 'H', ' ', ' ', '\0'};
    int i = 0;
    for(int a = 0; a < 35; a++){
        lcd.clear();
        lcd.drawCircle(24+2*a, 21, 3, FILL_BLACK);
        for (i = 0; i < a/3; i++) {
            lcd.printChar(gamename[i], 15+i*6, 2);
            lcd.refresh();
            }
    wait(0.05);
    }
    lcd.printString("Press start", 9, 4);
    lcd.printString("to play >", 15, 5);
    lcd.refresh();
    bool advance = false;
    while (!advance){
        if (gamepad.check_event(gamepad.START_PRESSED)){
            lcd.clear();
            lcd.refresh();
            advance = true;
            }
        else { advance = false; }
    }
    return advance;    
}