Example software for a Cyclic Executive

Dependencies:   MCP23017 SDFileSystem WattBob_TextLCD mbed

Committer:
sk398
Date:
Wed Feb 17 10:22:50 2016 +0000
Revision:
3:c611b9bb5770
Parent:
2:22ebabd78084
Child:
4:b85bc0d810e1
All 4 input processes constructed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sk398 2:22ebabd78084 1 /* ###############################################################################
sk398 2:22ebabd78084 2 #
sk398 2:22ebabd78084 3 #
sk398 2:22ebabd78084 4 #
sk398 2:22ebabd78084 5 #
sk398 2:22ebabd78084 6 #
sk398 2:22ebabd78084 7 #
sk398 2:22ebabd78084 8 #
sk398 2:22ebabd78084 9 #
sk398 2:22ebabd78084 10 #
sk398 2:22ebabd78084 11 #
sk398 2:22ebabd78084 12 #
sk398 2:22ebabd78084 13 #
sk398 2:22ebabd78084 14 #
sk398 2:22ebabd78084 15 #
sk398 2:22ebabd78084 16 #
sk398 2:22ebabd78084 17 ############################################################################### */
sk398 2:22ebabd78084 18
sk398 1:221d677fe0d3 19 #ifndef _TASKS_H_
sk398 1:221d677fe0d3 20 #define _TASKS_H_
sk398 1:221d677fe0d3 21
sk398 2:22ebabd78084 22 // Global definitions
sk398 1:221d677fe0d3 23 #define HIGH 1
sk398 1:221d677fe0d3 24 #define LOW 0
sk398 1:221d677fe0d3 25
sk398 3:c611b9bb5770 26 #define TRUE 1
sk398 3:c611b9bb5770 27 #define FALSE 0
sk398 3:c611b9bb5770 28
sk398 2:22ebabd78084 29 // Task 1 definitions
sk398 1:221d677fe0d3 30 #define WATCHDOG_PULSE_WIDTH 15
sk398 1:221d677fe0d3 31
sk398 2:22ebabd78084 32 // Task 2 definitions
sk398 2:22ebabd78084 33
sk398 2:22ebabd78084 34 // Task 3 definitions
sk398 2:22ebabd78084 35
sk398 2:22ebabd78084 36 // Task 4 definitions
sk398 3:c611b9bb5770 37 #define NUM_ANALOG_SAMPLES 4
sk398 2:22ebabd78084 38
sk398 2:22ebabd78084 39 // Task 5 definitions
sk398 2:22ebabd78084 40
sk398 2:22ebabd78084 41 // Task 6 definitions
sk398 2:22ebabd78084 42
sk398 2:22ebabd78084 43
sk398 2:22ebabd78084 44 /* ####################### Class definitions and prototypes ####################### */
sk398 1:221d677fe0d3 45
sk398 1:221d677fe0d3 46 /* ==================================== Task 1 ==================================== */
sk398 2:22ebabd78084 47 // Measure freuqnecy
sk398 1:221d677fe0d3 48 class Task1
sk398 1:221d677fe0d3 49 {
sk398 1:221d677fe0d3 50 public:
sk398 1:221d677fe0d3 51 Task1(PinName squareWaveInPin);
sk398 1:221d677fe0d3 52 int MeasureFreq();
sk398 1:221d677fe0d3 53
sk398 1:221d677fe0d3 54 private:
sk398 1:221d677fe0d3 55 DigitalIn *_squareWaveIn;
sk398 1:221d677fe0d3 56
sk398 1:221d677fe0d3 57 };
sk398 1:221d677fe0d3 58
sk398 1:221d677fe0d3 59
sk398 1:221d677fe0d3 60 /* ==================================== Task 2 ==================================== */
sk398 2:22ebabd78084 61 // Digital Input
sk398 1:221d677fe0d3 62 class Task2
sk398 1:221d677fe0d3 63 {
sk398 1:221d677fe0d3 64 public:
sk398 1:221d677fe0d3 65 Task2(PinName digitalInCheckPin);
sk398 3:c611b9bb5770 66 bool digitalInState();
sk398 3:c611b9bb5770 67
sk398 1:221d677fe0d3 68 private:
sk398 1:221d677fe0d3 69 DigitalIn *_digitalInCheck;
sk398 1:221d677fe0d3 70
sk398 1:221d677fe0d3 71 };
sk398 1:221d677fe0d3 72
sk398 1:221d677fe0d3 73
sk398 1:221d677fe0d3 74 /* ==================================== Task 3 ==================================== */
sk398 2:22ebabd78084 75 // Output watchdog pulse
sk398 1:221d677fe0d3 76 class Task3
sk398 1:221d677fe0d3 77 {
sk398 1:221d677fe0d3 78 public:
sk398 1:221d677fe0d3 79 Task3(PinName WatchdogPin);
sk398 1:221d677fe0d3 80 void OutputWatchdogPulse();
sk398 1:221d677fe0d3 81
sk398 1:221d677fe0d3 82 private:
sk398 1:221d677fe0d3 83 DigitalOut *_Watchdog;
sk398 1:221d677fe0d3 84 };
sk398 1:221d677fe0d3 85
sk398 1:221d677fe0d3 86
sk398 2:22ebabd78084 87 /* ==================================== Task 4 ==================================== */
sk398 2:22ebabd78084 88 // Read 2 analog inputs
sk398 2:22ebabd78084 89 class Task4
sk398 2:22ebabd78084 90 {
sk398 2:22ebabd78084 91 public:
sk398 3:c611b9bb5770 92 Task4(PinName Analog1Pin,PinName Analog2Pin);
sk398 3:c611b9bb5770 93 float *returnAnalogReadings();
sk398 2:22ebabd78084 94
sk398 2:22ebabd78084 95 private:
sk398 3:c611b9bb5770 96 AnalogIn *_AnalogIn1;
sk398 3:c611b9bb5770 97 AnalogIn *_AnalogIn2;
sk398 2:22ebabd78084 98 };
sk398 2:22ebabd78084 99
sk398 3:c611b9bb5770 100 //
sk398 3:c611b9bb5770 101 ///* ==================================== Task 5 ==================================== */
sk398 3:c611b9bb5770 102 //// Display outputs to LCD
sk398 3:c611b9bb5770 103 //class Task5
sk398 3:c611b9bb5770 104 //{
sk398 3:c611b9bb5770 105 //public:
sk398 3:c611b9bb5770 106 // Task5();
sk398 3:c611b9bb5770 107 //
sk398 3:c611b9bb5770 108 //private:
sk398 3:c611b9bb5770 109 //
sk398 3:c611b9bb5770 110 //
sk398 3:c611b9bb5770 111 //};
sk398 3:c611b9bb5770 112 //
sk398 3:c611b9bb5770 113 ///* ==================================== Task 6 ==================================== */
sk398 3:c611b9bb5770 114 //// Logical checks
sk398 3:c611b9bb5770 115 //class Task6
sk398 3:c611b9bb5770 116 //{
sk398 3:c611b9bb5770 117 //public:
sk398 3:c611b9bb5770 118 // Task5();
sk398 3:c611b9bb5770 119 //
sk398 3:c611b9bb5770 120 //private:
sk398 3:c611b9bb5770 121 //
sk398 3:c611b9bb5770 122 //
sk398 3:c611b9bb5770 123 //};
sk398 3:c611b9bb5770 124 //
sk398 3:c611b9bb5770 125 ///* ==================================== Task 7 ==================================== */
sk398 3:c611b9bb5770 126 //// Save data to SD Card
sk398 3:c611b9bb5770 127 //class Task7
sk398 3:c611b9bb5770 128 //{
sk398 3:c611b9bb5770 129 //public:
sk398 3:c611b9bb5770 130 // Task7();
sk398 3:c611b9bb5770 131 //
sk398 3:c611b9bb5770 132 //private:
sk398 3:c611b9bb5770 133 //
sk398 3:c611b9bb5770 134 //
sk398 3:c611b9bb5770 135 //};
sk398 1:221d677fe0d3 136
sk398 1:221d677fe0d3 137 #endif