Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
src/OutputTask/OutputTask.h@74:03ccf04998b5, 2016-09-19 (annotated)
- Committer:
- jmarkel44
- Date:
- Mon Sep 19 12:54:55 2016 +0000
- Revision:
- 74:03ccf04998b5
- Parent:
- 72:3754b352f156
- Child:
- 77:43e0a3d9e536
load persistent controls (first spin)
Who changed what in which revision?
User | Revision | Line number | New 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 | 74:03ccf04998b5 | 19 | * Control class |
jmarkel44 | 74:03ccf04998b5 | 20 | ****************************************************************************/ |
jmarkel44 | 74:03ccf04998b5 | 21 | class Control |
jmarkel44 | 74:03ccf04998b5 | 22 | { |
jmarkel44 | 74:03ccf04998b5 | 23 | private: |
jmarkel44 | 74:03ccf04998b5 | 24 | std::string id; |
jmarkel44 | 74:03ccf04998b5 | 25 | unsigned int priority; |
jmarkel44 | 74:03ccf04998b5 | 26 | ControlState state; |
jmarkel44 | 74:03ccf04998b5 | 27 | public: |
jmarkel44 | 74:03ccf04998b5 | 28 | Control(std::string id, unsigned int priority, ControlState state) : |
jmarkel44 | 74:03ccf04998b5 | 29 | id(id), priority(priority), state(state) {} |
jmarkel44 | 74:03ccf04998b5 | 30 | void display() { |
jmarkel44 | 74:03ccf04998b5 | 31 | printf("[%s | %s | %u]", |
jmarkel44 | 74:03ccf04998b5 | 32 | id.c_str(), (state == CONTROL_ON) ? "ON" : "OFF", priority); |
jmarkel44 | 74:03ccf04998b5 | 33 | } |
jmarkel44 | 74:03ccf04998b5 | 34 | //void setId(string id) id(id) { } |
jmarkel44 | 74:03ccf04998b5 | 35 | std::string getId() { |
jmarkel44 | 74:03ccf04998b5 | 36 | return id; |
jmarkel44 | 74:03ccf04998b5 | 37 | } |
jmarkel44 | 74:03ccf04998b5 | 38 | void setState(ControlState _state) { |
jmarkel44 | 74:03ccf04998b5 | 39 | state = _state; |
jmarkel44 | 74:03ccf04998b5 | 40 | } |
jmarkel44 | 74:03ccf04998b5 | 41 | }; |
jmarkel44 | 48:1c7861d80d16 | 42 | #endif |