ELEC2645 (2019/20) / Mbed 2 deprecated el18loc_final

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
00004 University of Leeds
00005 2019/20
00006 
00007 Name: Luke Cartwright
00008 Username: el18loc
00009 Student ID Number: 201225242
00010 Start Date: 06/02/2020
00011 Last Edited: 26/05/2020
00012 */
00013 
00014 // Includes
00015 #include "mbed.h"
00016 #include "Gamepad.h"
00017 #include "N5110.h"
00018 #include "Menu.h"
00019 #include "startup.h"
00020 #include "Front.h"
00021 
00022 #ifdef DEBUG
00023 # include "Debug.h"
00024 #endif
00025 
00026 // Objects
00027 Gamepad pad;
00028 N5110 lcd;
00029 Menu menu;
00030 startup start;
00031 Ticker tick;
00032 
00033 //Functions
00034 void noise_isr();
00035 
00036 //Global Variables
00037 volatile extern int g_isr_flag; //flag set by ISR for sound
00038 
00039 int main()
00040 {
00041     //printf("RUNNING CODE \n");
00042     start.initialise(lcd,pad); //initialises board and displays start screen
00043 #ifdef DEBUG
00044     printf("DEBUG COMPILE RUNNING\n");
00045     run_LUTs_debug(); //debug value checking function
00046 #endif
00047 #ifdef SLOW_TIME 
00048     printf("Running in SLOW_TIME\n");
00049     tick.attach(&noise_isr, 1); //extended for debug (1Hz)
00050 #endif
00051 #ifdef CSV
00052     printf("Running CSV\n");
00053     tick.attach_us(&noise_isr, 5000); //extended for CV printfs (200Hz)
00054 #endif
00055 #ifndef SLOW_TIME 
00056 #ifndef CSV //ATTACH TICKERS FOR SOUND
00057     tick.attach_us(&noise_isr, 100); //normal mode Fs=10kHz
00058 #endif 
00059 #endif
00060     while (1) { menu.mainmenu(lcd,pad); } //Main Menu
00061 }
00062 
00063 void noise_isr() { //Triggers Sound Generation
00064     #ifdef SLOW_TIME
00065     if (g_isr_flag==0) {
00066     //printf("ISR INTTERUPT = 1\n");
00067     }
00068     #endif
00069     g_isr_flag=1;
00070     }