Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Committer:
jmarkel44
Date:
Mon Sep 19 21:03:14 2016 +0000
Revision:
77:43e0a3d9e536
Parent:
74:03ccf04998b5
Child:
115:1558e01d04c6
output task priority vectors;

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