ELEC2645 (2018/19) / Mbed 2 deprecated el17lw

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002 ELEC2645 Embedded Systems Project
00003 School of Electronic & Electrical Engineering University of Leeds
00004 Name: Lewis Wooltorton
00005 Username: el17lw
00006 Student ID Number: 201122085 Date: March 2019
00007 */
00008 
00009 #include "N5110.h"
00010 #include "Gamepad.h"
00011 #include "mbed.h"
00012 #include "Menu.h"
00013 #include "Tests.h" 
00014 
00015 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
00016 Gamepad gamepad;
00017 Menu menu;
00018 Tests test;  // Create a test object if tests are to be done.
00019 
00020 void init_game();
00021 
00022 int main() {
00023   init_game();  
00024   while(1) {
00025     lcd.setContrast(gamepad.read_pot());  // Contrast is controlled by pot.
00026     lcd.clear();  
00027     menu.run(lcd, gamepad);  // Comment this out when running tests.
00028     // Blelow line is an example of testing sprites. See documentation for 
00029     // parameters and details.
00030     //test.run_tests(1,1,Skate_right,20,20,20,10,30,50,5,lcd);          
00031     lcd.refresh();
00032     wait(0.01);  
00033   }     
00034 }  
00035  
00036 void init_game() {
00037   test.init(20);  // argument is the vertical height of test platforms.
00038   gamepad.init();
00039   menu.init(); 
00040   lcd.init(); 
00041   lcd.normalMode();      
00042   lcd.setBrightness(0.5); 
00043 }