Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Committer:
jmarkel44
Date:
Mon Oct 24 21:09:31 2016 +0000
Revision:
262:696cd48bb04a
Parent:
217:d5a2ff093319
general high and low failsafe controls working;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmarkel44 12:ea87887ca7ad 1 /******************************************************************************
jmarkel44 12:ea87887ca7ad 2 *
jmarkel44 12:ea87887ca7ad 3 * File: TimerControl.h
jmarkel44 12:ea87887ca7ad 4 * Desciption: ICE Timer Control Class
jmarkel44 12:ea87887ca7ad 5 *
jmarkel44 12:ea87887ca7ad 6 *****************************************************************************/
jmarkel44 12:ea87887ca7ad 7 #ifndef TIMERCONTROL_H
jmarkel44 12:ea87887ca7ad 8 #define TIMERCONTROL_H
jmarkel44 12:ea87887ca7ad 9
jmarkel44 12:ea87887ca7ad 10 #include <string>
jmarkel44 122:4db48b933115 11 #include <stdio.h>
jmarkel44 132:45821e189dd0 12 #include <vector>
jmarkel44 19:9bc8fabeddfa 13
jmarkel44 157:0d79678ed00f 14 typedef enum {
jmarkel44 157:0d79678ed00f 15 TIMER_CONTROL_OK,
jmarkel44 157:0d79678ed00f 16 TIMER_CONTROL_ERROR,
jmarkel44 157:0d79678ed00f 17 TIMER_CONTROL_DESTROY
jmarkel44 157:0d79678ed00f 18 } TimerError_t;
jmarkel44 157:0d79678ed00f 19
jmarkel44 12:ea87887ca7ad 20 class TimerControl
jmarkel44 12:ea87887ca7ad 21 {
jmarkel44 12:ea87887ca7ad 22 private:
jmarkel44 122:4db48b933115 23 std::string controlFile;
jmarkel44 122:4db48b933115 24 std::string id;
jmarkel44 122:4db48b933115 25 std::string output;
jmarkel44 156:44f87c5a83ae 26 unsigned int priority;
jmarkel44 156:44f87c5a83ae 27 unsigned long startTime;
jmarkel44 156:44f87c5a83ae 28 unsigned int duration;
jmarkel44 156:44f87c5a83ae 29 unsigned long actualStartTime;
jmarkel44 157:0d79678ed00f 30
jmarkel44 128:534bf29132f8 31 enum State {
jmarkel44 128:534bf29132f8 32 STATE_OFF,
jmarkel44 128:534bf29132f8 33 STATE_RUNNING,
jmarkel44 128:534bf29132f8 34 STATE_DISABLED
jmarkel44 128:534bf29132f8 35 };
jmarkel44 128:534bf29132f8 36 State currentState;
jmarkel44 128:534bf29132f8 37
jmarkel44 262:696cd48bb04a 38 // start the timer
jmarkel44 262:696cd48bb04a 39 bool timerStart(void);
jmarkel44 262:696cd48bb04a 40
jmarkel44 262:696cd48bb04a 41 // stop the timer
jmarkel44 262:696cd48bb04a 42 bool timerStop(void);
jmarkel44 262:696cd48bb04a 43
jmarkel44 262:696cd48bb04a 44 // start a feed
jmarkel44 262:696cd48bb04a 45 void startFeed(void);
jmarkel44 262:696cd48bb04a 46
jmarkel44 262:696cd48bb04a 47 // stop a feed
jmarkel44 262:696cd48bb04a 48 void stopFeed(void);
jmarkel44 262:696cd48bb04a 49
jmarkel44 12:ea87887ca7ad 50 public:
jmarkel44 19:9bc8fabeddfa 51 TimerControl() {};
jmarkel44 12:ea87887ca7ad 52 ~TimerControl() {
jmarkel44 12:ea87887ca7ad 53 printf("\r%s destructor invoked\n", __func__);
jmarkel44 12:ea87887ca7ad 54 }
jmarkel44 20:653923c2f37a 55 // load a control from the control file
jmarkel44 122:4db48b933115 56 bool load(std::string filename);
jmarkel44 262:696cd48bb04a 57
jmarkel44 217:d5a2ff093319 58 // start the timer control
jmarkel44 217:d5a2ff093319 59 void start(void);
jmarkel44 262:696cd48bb04a 60
jmarkel44 217:d5a2ff093319 61 // update the timer control (state machine)
jmarkel44 217:d5a2ff093319 62 TimerError_t update(void);
jmarkel44 128:534bf29132f8 63
jmarkel44 217:d5a2ff093319 64 // unregister the control with the output task
jmarkel44 217:d5a2ff093319 65 void unregisterControl(void);
jmarkel44 217:d5a2ff093319 66
jmarkel44 262:696cd48bb04a 67 // display the timer control
jmarkel44 122:4db48b933115 68 void display(void);
jmarkel44 128:534bf29132f8 69
jmarkel44 156:44f87c5a83ae 70 std::string getControlFile(void) const {
jmarkel44 12:ea87887ca7ad 71 return controlFile;
jmarkel44 12:ea87887ca7ad 72 }
jmarkel44 262:696cd48bb04a 73
jmarkel44 217:d5a2ff093319 74 std::string getId(void) const {
jmarkel44 217:d5a2ff093319 75 return id;
jmarkel44 217:d5a2ff093319 76 }
jmarkel44 262:696cd48bb04a 77
jmarkel44 156:44f87c5a83ae 78 std::string getOutput(void) const {
jmarkel44 156:44f87c5a83ae 79 return output;
jmarkel44 156:44f87c5a83ae 80 }
jmarkel44 262:696cd48bb04a 81
jmarkel44 217:d5a2ff093319 82 unsigned int getPriority(void) const {
jmarkel44 217:d5a2ff093319 83 return priority;
jmarkel44 156:44f87c5a83ae 84 }
jmarkel44 128:534bf29132f8 85
jmarkel44 217:d5a2ff093319 86 unsigned long getStartTime(void) const {
jmarkel44 217:d5a2ff093319 87 return startTime;
jmarkel44 217:d5a2ff093319 88 }
jmarkel44 262:696cd48bb04a 89
jmarkel44 217:d5a2ff093319 90 unsigned int getDuration(void) const {
jmarkel44 217:d5a2ff093319 91 return duration;
jmarkel44 217:d5a2ff093319 92 }
jmarkel44 128:534bf29132f8 93
jmarkel44 128:534bf29132f8 94 State getCurrentState(void) const {
jmarkel44 128:534bf29132f8 95 return currentState;
jmarkel44 128:534bf29132f8 96 }
jmarkel44 12:ea87887ca7ad 97 };
jmarkel44 12:ea87887ca7ad 98
jmarkel44 12:ea87887ca7ad 99 #endif