ELEC2645 (2018/19) / Mbed 2 deprecated el16y2m

Dependencies:   mbed

main.cpp

Committer:
MYY
Date:
2019-05-09
Revision:
11:ef3d6696ae84
Parent:
10:3ecbf164c0d3
Child:
17:9f7ff626210b

File content as of revision 11:ef3d6696ae84:

#include "Level.h"

N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Menu Menu;
Level Level;
Rotate Rotate;
Release Release;
Detect detect;
Pull Pull;
logistic logistic;
Tool Tool;
Image Image;
InterruptIn A(PTB9);
InterruptIn START(PTC5);
InterruptIn B(PTD0);
InterruptIn Back(PTB19);
Gamepad Gamepad;

void init();

int main()
{   //initialize lcd, gamepad, and debut values
    init();
    while(1) {
        //this switch decides which level you are at, whenever you finish one level, you can break and change the value of variable "value". So switch can transfer you to another level.
        switch(level) {
            case 1:
                Level.level_1(Menu, Image, lcd, Rotate, Release, detect, Pull, START, B, Back, A, Gamepad, logistic, Level, Tool);
                break;

            case 2:
                Menu.TNT_m(lcd, A, B);
                Level.level_2(Image, lcd, Rotate, Release, detect, Pull, A, B, logistic, Level, Tool);
                break;

            case 3:
                Menu.TNT_m(lcd, A, B);
                Level.level_3(Image, lcd, Rotate, Release, detect, Pull, Gamepad, A, B, logistic, Level, Menu, Tool);
                break;
        }
    }
}

void init()
{   Gamepad.init();
    lcd.init();
    int ii;
    for(ii=0; ii<3; ii=ii+1) {
    Rotate.return_angle[ii]=PI;
    Rotate.return_flag[ii]=1;
    }
    Level.g_Start_flag=0;
    Level.g_Back_flag=0;
    Level.g_B_flag=0;
    Level.detector=0;
}