Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Committer:
jmarkel44
Date:
Tue Oct 04 20:50:33 2016 +0000
Revision:
183:44f7fea6b208
Parent:
115:1558e01d04c6
Child:
185:5ac6ab1ed875
cleanup

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmarkel44 48:1c7861d80d16 1 #ifndef OUTPUTTASK_H
jmarkel44 48:1c7861d80d16 2 #define OUTPUTTASK_H
jmarkel44 48:1c7861d80d16 3
jmarkel44 74:03ccf04998b5 4 #include <string>
jmarkel44 74:03ccf04998b5 5 #include <stdio.h>
jmarkel44 115:1558e01d04c6 6 #include "global.h"
jmarkel44 74:03ccf04998b5 7
jmarkel44 48:1c7861d80d16 8 void OutputTask(void const *args);
jmarkel44 66:db1425574b58 9 void DisplayOutputs(void);
jmarkel44 48:1c7861d80d16 10
jmarkel44 67:49f266601d83 11 #define OUTPUT_STR "output"
jmarkel44 67:49f266601d83 12
jmarkel44 72:3754b352f156 13 typedef enum {
jmarkel44 72:3754b352f156 14 CONTROL_OFF = 0,
jmarkel44 72:3754b352f156 15 CONTROL_ON = 1
jmarkel44 72:3754b352f156 16 } ControlState;
jmarkel44 72:3754b352f156 17
jmarkel44 74:03ccf04998b5 18
jmarkel44 74:03ccf04998b5 19 /*****************************************************************************
jmarkel44 77:43e0a3d9e536 20 * Control class
jmarkel44 77:43e0a3d9e536 21 * Contains the most pertinent control information to stack onto the output
jmarkel44 77:43e0a3d9e536 22 * entry
jmarkel44 74:03ccf04998b5 23 ****************************************************************************/
jmarkel44 74:03ccf04998b5 24 class Control
jmarkel44 74:03ccf04998b5 25 {
jmarkel44 74:03ccf04998b5 26 private:
jmarkel44 115:1558e01d04c6 27 std::string id; // control identifier
jmarkel44 115:1558e01d04c6 28 Control_t controlType; // control type
jmarkel44 115:1558e01d04c6 29 std::string input; // input
jmarkel44 77:43e0a3d9e536 30 unsigned int priority; // control priority
jmarkel44 77:43e0a3d9e536 31 ControlState state; // state (ON or OFF)
jmarkel44 77:43e0a3d9e536 32
jmarkel44 74:03ccf04998b5 33 public:
jmarkel44 77:43e0a3d9e536 34 // ctor
jmarkel44 115:1558e01d04c6 35 Control(std::string id, Control_t controlType, std::string input, unsigned int priority, ControlState state) :
jmarkel44 115:1558e01d04c6 36 id(id), controlType(controlType), input(input), priority(priority), state(state) {}
jmarkel44 77:43e0a3d9e536 37 // dtor
jmarkel44 77:43e0a3d9e536 38 ~Control() {}
jmarkel44 77:43e0a3d9e536 39
jmarkel44 77:43e0a3d9e536 40 // displays a control's pertinents
jmarkel44 74:03ccf04998b5 41 void display() {
jmarkel44 183:44f7fea6b208 42 printf("[%-24s | %3s | %u]",
jmarkel44 74:03ccf04998b5 43 id.c_str(), (state == CONTROL_ON) ? "ON" : "OFF", priority);
jmarkel44 74:03ccf04998b5 44 }
jmarkel44 77:43e0a3d9e536 45
jmarkel44 77:43e0a3d9e536 46 std::string getId() const {
jmarkel44 74:03ccf04998b5 47 return id;
jmarkel44 74:03ccf04998b5 48 }
jmarkel44 115:1558e01d04c6 49
jmarkel44 115:1558e01d04c6 50 Control_t getControlType(void) const {
jmarkel44 115:1558e01d04c6 51 return controlType;
jmarkel44 115:1558e01d04c6 52 }
jmarkel44 115:1558e01d04c6 53
jmarkel44 115:1558e01d04c6 54 std::string getInput(void) const {
jmarkel44 115:1558e01d04c6 55 return input;
jmarkel44 115:1558e01d04c6 56 }
jmarkel44 77:43e0a3d9e536 57
jmarkel44 77:43e0a3d9e536 58 unsigned int getPriority() const {
jmarkel44 77:43e0a3d9e536 59 return priority;
jmarkel44 77:43e0a3d9e536 60 }
jmarkel44 77:43e0a3d9e536 61
jmarkel44 77:43e0a3d9e536 62 ControlState getState(void) const {
jmarkel44 77:43e0a3d9e536 63 return state;
jmarkel44 77:43e0a3d9e536 64 }
jmarkel44 77:43e0a3d9e536 65
jmarkel44 74:03ccf04998b5 66 void setState(ControlState _state) {
jmarkel44 74:03ccf04998b5 67 state = _state;
jmarkel44 74:03ccf04998b5 68 }
jmarkel44 74:03ccf04998b5 69 };
jmarkel44 77:43e0a3d9e536 70
jmarkel44 77:43e0a3d9e536 71
jmarkel44 48:1c7861d80d16 72 #endif