From 7567d9d34caf5ee394ecc0443f7326ff554687f1 Mon Sep 17 00:00:00 2001 From: Makuna Date: Tue, 26 Jan 2016 15:40:34 -0800 Subject: [PATCH] Support Library manager --- .../BlinkUsingTaskFunction/BlinkUsingTaskFunction.ino | 4 ++++ examples/ButtonInterrupt/ButtonInterrupt.ino | 7 +++++++ examples/ButtonTask/ButtonTask.ino | 3 +++ examples/MessageTask/MessageTask.ino | 4 ++++ library.properties | 9 +++++++++ FunctionTask.h => src/FunctionTask.h | 0 MessageTask.cpp => src/MessageTask.cpp | 0 MessageTask.h => src/MessageTask.h | 0 Task.h => src/Task.h | 0 TaskMacros.h => src/TaskMacros.h | 0 TaskManager.cpp => src/TaskManager.cpp | 0 TaskManager.h => src/TaskManager.h | 0 12 files changed, 27 insertions(+) create mode 100644 library.properties rename FunctionTask.h => src/FunctionTask.h (100%) rename MessageTask.cpp => src/MessageTask.cpp (100%) rename MessageTask.h => src/MessageTask.h (100%) rename Task.h => src/Task.h (100%) rename TaskMacros.h => src/TaskMacros.h (100%) rename TaskManager.cpp => src/TaskManager.cpp (100%) rename TaskManager.h => src/TaskManager.h (100%) diff --git a/examples/BlinkUsingTaskFunction/BlinkUsingTaskFunction.ino b/examples/BlinkUsingTaskFunction/BlinkUsingTaskFunction.ino index 6c456a3..1667b44 100644 --- a/examples/BlinkUsingTaskFunction/BlinkUsingTaskFunction.ino +++ b/examples/BlinkUsingTaskFunction/BlinkUsingTaskFunction.ino @@ -11,6 +11,10 @@ int ledPin = 13; // BUILTIN_LED TaskManager taskManager; +// foreward delcare functions passed to task constructors now required +void OnUpdateTaskLedOn(uint32_t deltaTime); +void OnUpdateTaskLedOff(uint32_t deltaTime); + FunctionTask taskTurnLedOn(OnUpdateTaskLedOn, MsToTaskTime(400)); // turn on the led in 400ms FunctionTask taskTurnLedOff(OnUpdateTaskLedOff, MsToTaskTime(600)); // turn off the led in 600ms diff --git a/examples/ButtonInterrupt/ButtonInterrupt.ino b/examples/ButtonInterrupt/ButtonInterrupt.ino index 299b271..d0906a0 100644 --- a/examples/ButtonInterrupt/ButtonInterrupt.ino +++ b/examples/ButtonInterrupt/ButtonInterrupt.ino @@ -46,6 +46,13 @@ TaskManager taskManager; +// foreward delcare functions passed to task constructors now required +void OnAButtonChanged(ButtonState state); +void OnBButtonChanged(ButtonState state); +void OnUpdateTaskLedOn(uint32_t deltaTime); +void OnUpdateTaskLedOff(uint32_t deltaTime); +void OnAutoSleep(uint32_t deltaTime); + ButtonTask AButtonTask(OnAButtonChanged, AButtonPin); ButtonTask BButtonTask(OnBButtonChanged, BButtonPin); FunctionTask taskTurnLedOn(OnUpdateTaskLedOn, MsToTaskTime(400)); // turn on the led in 400ms diff --git a/examples/ButtonTask/ButtonTask.ino b/examples/ButtonTask/ButtonTask.ino index 1cf30e2..af5a97a 100644 --- a/examples/ButtonTask/ButtonTask.ino +++ b/examples/ButtonTask/ButtonTask.ino @@ -22,7 +22,10 @@ #include "ButtonTask.h" // this implements the button task TaskManager taskManager; +void HandleAButtonChanged(ButtonState state); +void HandleBButtonChanged(ButtonState state); +// foreward delcare functions passed to task constructors now required ButtonTask AButtonTask(HandleAButtonChanged, AButtonPin); ButtonTask BButtonTask(HandleBButtonChanged, BButtonPin); diff --git a/examples/MessageTask/MessageTask.ino b/examples/MessageTask/MessageTask.ino index 9e57ad3..ee54b65 100644 --- a/examples/MessageTask/MessageTask.ino +++ b/examples/MessageTask/MessageTask.ino @@ -25,6 +25,10 @@ TaskManager taskManager; +// foreward delcare functions passed to task constructors now required +void OnHeartBeatOn(uint32_t deltaTime); +void OnHeartBeatOff(uint32_t deltaTime); + MainTask mainTask; ButtonTask buttonATask(&mainTask, AButtonPin); ButtonTask buttonBTask(&mainTask, BButtonPin); diff --git a/library.properties b/library.properties new file mode 100644 index 0000000..baeb4a5 --- /dev/null +++ b/library.properties @@ -0,0 +1,9 @@ +name=Task by Makuna +version=1.0 +author=Michael C. Miller (makuna@live.com) +maintainer=Michael C. Miller (makuna@live.com) +sentence=A library that makes creating complex mulitple task projects easy. +paragraph=This implements a Nonpreemptive multitasking library which is effecient in speed and memory, which is good for small Arduino hardware. While multitasking is an advanced topic, our friends at AdaFruit have a great article on it here (https://learn.adafruit.com/multi-tasking-the-arduino-part-1?view=all), Samples include blinking an LED without using delay(), monitoring and reacting to a button press, and cross task messaging. Tested on esp8266. +category=Timing +url=https://github.com/Makuna/Task +architectures=* \ No newline at end of file diff --git a/FunctionTask.h b/src/FunctionTask.h similarity index 100% rename from FunctionTask.h rename to src/FunctionTask.h diff --git a/MessageTask.cpp b/src/MessageTask.cpp similarity index 100% rename from MessageTask.cpp rename to src/MessageTask.cpp diff --git a/MessageTask.h b/src/MessageTask.h similarity index 100% rename from MessageTask.h rename to src/MessageTask.h diff --git a/Task.h b/src/Task.h similarity index 100% rename from Task.h rename to src/Task.h diff --git a/TaskMacros.h b/src/TaskMacros.h similarity index 100% rename from TaskMacros.h rename to src/TaskMacros.h diff --git a/TaskManager.cpp b/src/TaskManager.cpp similarity index 100% rename from TaskManager.cpp rename to src/TaskManager.cpp diff --git a/TaskManager.h b/src/TaskManager.h similarity index 100% rename from TaskManager.h rename to src/TaskManager.h