Test session

Dependencies:   FatFileSystem MCP23017 WattBob_TextLCD mbed

Fork of Assignment_2_herpe by Xavier Herpe

Committer:
xouf2114
Date:
Tue Mar 14 14:46:43 2017 +0000
Revision:
4:48761259552a
Test of Assignment 2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
xouf2114 4:48761259552a 1 /**
xouf2114 4:48761259552a 2 * Main class for the project.
xouf2114 4:48761259552a 3 * The main class instantiates all the tasks and schedules them
xouf2114 4:48761259552a 4 * correctly using the TaskManager object.
xouf2114 4:48761259552a 5 *
xouf2114 4:48761259552a 6 * As writing to the SDCard occasionally hits +50ms in timing, there was several issue
xouf2114 4:48761259552a 7 * with the schedule purposed in the original assignment. As a result the timings have changed.
xouf2114 4:48761259552a 8 *
xouf2114 4:48761259552a 9 * Action 2 (reading digital values) have been discarded. The values are only used
xouf2114 4:48761259552a 10 * in the Action 5, as a result we might as well read them "Just In Time".
xouf2114 4:48761259552a 11 * However if desired it could have been scheduled starting at 600ms with a freqency of 600ms
xouf2114 4:48761259552a 12 *
xouf2114 4:48761259552a 13 * The schedule is as follows:
xouf2114 4:48761259552a 14 * Action 1 (frequency) 1200ms
xouf2114 4:48761259552a 15 * Action 2 (get digital input) disabled, see above
xouf2114 4:48761259552a 16 * Action 3 (read analog in) 600ms
xouf2114 4:48761259552a 17 * Action 4 (Print to LCD) 1200ms
xouf2114 4:48761259552a 18 * Action 5 (checks) 600ms
xouf2114 4:48761259552a 19 * Action 5.1 (binary counting) 1800ms
xouf2114 4:48761259552a 20 * Action 6 (SDCard) 4800ms
xouf2114 4:48761259552a 21 *
xouf2114 4:48761259552a 22 * Author: Jacob Baungard Hansen
xouf2114 4:48761259552a 23 */
xouf2114 4:48761259552a 24
xouf2114 4:48761259552a 25 #include "task.h"
xouf2114 4:48761259552a 26 #include "lcd_helper.h"
xouf2114 4:48761259552a 27 #include "demo_task.h"
xouf2114 4:48761259552a 28 #include "task_manager.h"
xouf2114 4:48761259552a 29 #include "state.h"
xouf2114 4:48761259552a 30 #include "lcd_task.h"
xouf2114 4:48761259552a 31 #include "update_analog_task.h"
xouf2114 4:48761259552a 32 #include "check_task.h"
xouf2114 4:48761259552a 33 #include "freq_task.h"
xouf2114 4:48761259552a 34 #include "SDFileSystem.h"
xouf2114 4:48761259552a 35 #include "sdcard_task.h"
xouf2114 4:48761259552a 36
xouf2114 4:48761259552a 37 int main() {
xouf2114 4:48761259552a 38
xouf2114 4:48761259552a 39 LCDHelper * lcd_helper = new LCDHelper();
xouf2114 4:48761259552a 40
xouf2114 4:48761259552a 41 State * state = new State();
xouf2114 4:48761259552a 42
xouf2114 4:48761259552a 43 TaskManager * tm = new TaskManager(100, lcd_helper);
xouf2114 4:48761259552a 44
xouf2114 4:48761259552a 45 UpdateAnalogTask * analog_task = new UpdateAnalogTask(100, 600, state);
xouf2114 4:48761259552a 46 CheckTask * check_task = new CheckTask(200, 600, state, tm);
xouf2114 4:48761259552a 47 FrequencyTask * freq_task = new FrequencyTask(300, 1200, state);
xouf2114 4:48761259552a 48 LCDTask * lcd_task = new LCDTask(400, 2400, lcd_helper, state);
xouf2114 4:48761259552a 49 SDCardTask * sd_task = new SDCardTask(4800, 4800, state);
xouf2114 4:48761259552a 50
xouf2114 4:48761259552a 51 tm->add_task(check_task);
xouf2114 4:48761259552a 52 tm->add_task(analog_task);
xouf2114 4:48761259552a 53 tm->add_task(lcd_task);
xouf2114 4:48761259552a 54 tm->add_task(freq_task);
xouf2114 4:48761259552a 55 tm->add_task(sd_task);
xouf2114 4:48761259552a 56
xouf2114 4:48761259552a 57 tm->start();
xouf2114 4:48761259552a 58
xouf2114 4:48761259552a 59 delete lcd_helper;
xouf2114 4:48761259552a 60 delete lcd_task;
xouf2114 4:48761259552a 61 delete analog_task;
xouf2114 4:48761259552a 62 delete freq_task;
xouf2114 4:48761259552a 63 delete sd_task;
xouf2114 4:48761259552a 64 delete tm;
xouf2114 4:48761259552a 65
xouf2114 4:48761259552a 66 }