Luke Cartwright / Mbed 2 deprecated ELEC2645_Project_el18loc_nearlythere

Dependencies:   mbed

Committer:
lukeocarwright
Date:
Mon May 25 20:00:31 2020 +0000
Revision:
29:207111ffd6e6
Parent:
27:da783f414f67
Child:
31:cfdb014ff086
Added Back from Front Panel. Fixed minor Bugs. Tidied some code up.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lukeocarwright 2:07cef563acdf 1 /*
eencae 0:b7f1f47bb26a 2 ELEC2645 Embedded Systems Project
eencae 0:b7f1f47bb26a 3 School of Electronic & Electrical Engineering
eencae 0:b7f1f47bb26a 4 University of Leeds
eencae 0:b7f1f47bb26a 5 2019/20
eencae 0:b7f1f47bb26a 6
lukeocarwright 1:766a293c9b07 7 Name: Luke Cartwright
lukeocarwright 1:766a293c9b07 8 Username: el18loc
lukeocarwright 1:766a293c9b07 9 Student ID Number: 201225242
lukeocarwright 2:07cef563acdf 10 Start Date: 06/02/2020
lukeocarwright 29:207111ffd6e6 11 Last Edited: 25/05/2020
eencae 0:b7f1f47bb26a 12 */
eencae 0:b7f1f47bb26a 13
lukeocarwright 2:07cef563acdf 14 // Includes
eencae 0:b7f1f47bb26a 15 #include "mbed.h"
eencae 0:b7f1f47bb26a 16 #include "Gamepad.h"
eencae 0:b7f1f47bb26a 17 #include "N5110.h"
lukeocarwright 8:f305ea78b2b1 18 #include "Menu.h"
lukeocarwright 7:33cb5f2db1ee 19 #include "startup.h"
lukeocarwright 7:33cb5f2db1ee 20 #include "Front.h"
eencae 0:b7f1f47bb26a 21
lukeocarwright 9:f6ba53e355a0 22 #ifdef DEBUG
lukeocarwright 9:f6ba53e355a0 23 # include "Debug.h"
lukeocarwright 9:f6ba53e355a0 24 #endif
lukeocarwright 9:f6ba53e355a0 25
lukeocarwright 2:07cef563acdf 26 // Objects
eencae 0:b7f1f47bb26a 27 Gamepad pad;
eencae 0:b7f1f47bb26a 28 N5110 lcd;
lukeocarwright 8:f305ea78b2b1 29 Menu menu;
lukeocarwright 7:33cb5f2db1ee 30 startup start;
lukeocarwright 14:9cfe0041cc4e 31 Ticker tick;
lukeocarwright 4:9b7ea5528a5c 32
lukeocarwright 2:07cef563acdf 33 //Functions
lukeocarwright 14:9cfe0041cc4e 34 void noise_isr();
lukeocarwright 2:07cef563acdf 35
lukeocarwright 2:07cef563acdf 36 //Global Variables
lukeocarwright 29:207111ffd6e6 37 volatile extern int g_isr_flag; //flag set by ISR for sound
lukeocarwright 15:1c67f064278e 38
eencae 0:b7f1f47bb26a 39 int main()
eencae 0:b7f1f47bb26a 40 {
lukeocarwright 29:207111ffd6e6 41 //printf("RUNNING CODE \n");
lukeocarwright 7:33cb5f2db1ee 42 start.initialise(lcd,pad); //initialises board and displays start screen
lukeocarwright 14:9cfe0041cc4e 43 #ifdef DEBUG
lukeocarwright 14:9cfe0041cc4e 44 printf("DEBUG COMPILE RUNNING\n");
lukeocarwright 29:207111ffd6e6 45 run_LUTs_debug(); //debug value checking function
lukeocarwright 14:9cfe0041cc4e 46 #endif
lukeocarwright 29:207111ffd6e6 47 #ifdef SLOW_TIME
lukeocarwright 15:1c67f064278e 48 printf("Running in SLOW_TIME\n");
lukeocarwright 15:1c67f064278e 49 tick.attach(&noise_isr, 1); //extended for debug (1Hz)
lukeocarwright 15:1c67f064278e 50 #endif
lukeocarwright 18:204cd747b54a 51 #ifdef CSV
lukeocarwright 29:207111ffd6e6 52 printf("Running CSV\n");
lukeocarwright 29:207111ffd6e6 53 tick.attach_us(&noise_isr, 5000); //extended for CV printfs (200Hz)
lukeocarwright 18:204cd747b54a 54 #endif
lukeocarwright 29:207111ffd6e6 55 #ifndef SLOW_TIME
lukeocarwright 29:207111ffd6e6 56 #ifndef CSV //ATTACH TICKERS FOR SOUND
lukeocarwright 29:207111ffd6e6 57 tick.attach_us(&noise_isr, 100); //normal mode Fs=10kHz
lukeocarwright 29:207111ffd6e6 58 #endif
lukeocarwright 14:9cfe0041cc4e 59 #endif
lukeocarwright 29:207111ffd6e6 60 while (1) { menu.mainmenu(lcd,pad); }
lukeocarwright 2:07cef563acdf 61 }
lukeocarwright 2:07cef563acdf 62
lukeocarwright 14:9cfe0041cc4e 63 void noise_isr() {
lukeocarwright 14:9cfe0041cc4e 64 #ifdef SLOW_TIME
lukeocarwright 14:9cfe0041cc4e 65 if (g_isr_flag==0) {
lukeocarwright 18:204cd747b54a 66 //printf("ISR INTTERUPT = 1\n");
lukeocarwright 14:9cfe0041cc4e 67 }
lukeocarwright 14:9cfe0041cc4e 68 #endif
lukeocarwright 14:9cfe0041cc4e 69 g_isr_flag=1;
lukeocarwright 29:207111ffd6e6 70 }