Browse Source

* v 2.2.0 all methods made 'inline' to support inclusion of TaskSchedule.h file into other header files

Anatoli Arkhipenko 9 years ago
parent
commit
59bff57af2
4 changed files with 59 additions and 32 deletions
  1. 6 1
      LICENSE.txt
  2. 23 4
      README
  3. 1 1
      library.properties
  4. 29 26
      src/TaskScheduler.h

+ 6 - 1
LICENSE.txt

@@ -9,4 +9,9 @@ Redistribution and use in source and binary forms, with or without modification,
 
 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 23 - 4
README

@@ -1,5 +1,5 @@
 Task Scheduler – cooperative multitasking for Arduino microcontrollers
-Version 2.1.0: 2016-02-01
+Version 2.2.0: 2016-11-17
 
 If you find TaskScheduler useful for your Arduino project, please drop me an email: arkhipenko@hotmail.com
 ----------------------------------------------------------------------------------------------------------
@@ -23,26 +23,42 @@ For detailed functionality overview please refer to TaskScheduler documentation
 
 Check out what TaskScheduler can do:
 ====================================
+  Endeavor - build a space capable craft, with the ability to maneuver both in and out of atmosphere. 
+    (by Radical Space Technologies
+     http://radicalspacetechnologies.com/2015/10/01/endeavor-phase-i/
+
+         "So after some digging I found TaskScheduler an awesome little library developed by Anatoli Arkhipenko, 
+          his github is here and the documentation is here. Its fantastic, so far I’ve been able to replicate 
+          some things I’ve seen in Ardupilot. ..."
+  link: http://radicalspacetechnologies.com/2015/10/25/endeavors-code-definitely-progress/
+
+
+  3 Devo - Quality 3D printing filament, now made accessible and affordable
+     http://3devo.eu/
+
+
   Houston midi clock project - TaskScheduler with microseconds resolution
     (by chaffneue: My first arduino project. It's a multi-master midi controller with a shared clock and 
      auto count in behaviour. Project files on github: https://github.com/chaffneue/houston
 	 youtube: https://www.youtube.com/watch?v=QRof550TtXo)
+
 	  
-  Aurora Chaser Cubesat project, University of Sydney (Yay! TaskScheduler goes to space)
-    (by Jordan Jolly: http://52.35.220.33/blogs/jordan-jolly-cubesat--aero3670--blog)
-	
   Hackabot Nano -  Compact Plug and Play Arduino compatible robotic kit
     (by Funnyvale: http://hackarobot.com/
      also: https://www.kickstarter.com/projects/hackarobot/hackabot-nano-compact-plug-and-play-arduino-robot)
+
      
   Arduino Nano based Hexbug Scarab Robotic Spider 
     (by arkhipenko: http://www.instructables.com/id/Arduino-Nano-based-Hexbug-Scarab-Robotic-Spider/)
+
 	
   Wave your hand to control OWI Robotic Arm... no strings attached
     (by arkhipenko: http://www.instructables.com/id/Wave-your-hand-to-control-OWI-Robotic-Arm-no-strin/)
 	
+
   APIS - Automated Plant Irrigation System
     (by arkhipenko: http://www.instructables.com/id/APIS-Automated-Plant-Irrigation-System/)
+
 	
   Interactive Halloween Pumpkin
     (by arkhipenko: http://www.instructables.com/id/Interactive-Halloween-Pumpkin/)
@@ -50,6 +66,9 @@ Check out what TaskScheduler can do:
 
 Changelog:
 =========
+v2.2.0:
+    2016-11-17 - all methods made 'inline' to support inclusion of TaskSchedule.h file into other header files
+
 v2.1.0:
     2016-02-01 - support for microsecond resolution
     2016-02-02 - added Scheduler baseline start time reset method: startNow()

+ 1 - 1
library.properties

@@ -1,5 +1,5 @@
 name=TaskScheduler
-version=2.1.0
+version=2.2.0
 author=Anatoli Arkhipenko <arkhipenko@hotmail.com>
 maintainer=Anatoli Arkhipenko <arkhipenko@hotmail.com>
 sentence=A light-weight cooperative multitasking library for arduino microcontrollers.

+ 29 - 26
src/TaskScheduler.h

@@ -87,6 +87,9 @@
 // v2.1.0:
 //    2016-02-01 - support for microsecond resolution
 //    2016-02-02 - added Scheduler baseline start time reset method: startNow()
+//
+// v2.2.0:
+//    2016-11-17 - all methods made 'inline' to support inclusion of TaskSchedule.h file into other header files
 
 #include <Arduino.h>
 
@@ -164,15 +167,15 @@ class StatusRequest {
 	public:
 		StatusRequest() {iCount = 0; iStatus = 0; }
 		inline void setWaiting(unsigned int aCount = 1) { iCount = aCount; iStatus = 0; }
-		bool signal(int aStatus = 0);
-		void signalComplete(int aStatus = 0);
+		inline bool signal(int aStatus = 0);
+		inline void signalComplete(int aStatus = 0);
 		inline bool pending() { return (iCount != 0); }
 		inline bool completed() { return (iCount == 0); }
 		inline int getStatus() { return iStatus; }
 		
 	private:
 		unsigned int	iCount;  					// number of statuses to wait for. waiting for more that 65000 events seems unreasonable: unsigned int should be sufficient
-		int			iStatus;  					// status of the last completed request. negative = error;  zero = OK; >positive = OK with a specific status
+		int				iStatus;  					// status of the last completed request. negative = error;  zero = OK; >positive = OK with a specific status
 };
 #endif  // _TASK_STATUS_REQUEST
 
@@ -200,19 +203,19 @@ class Task {
 		Task(void (*aCallback)()=NULL, Scheduler* aScheduler=NULL, bool (*aOnEnable)()=NULL, void (*aOnDisable)()=NULL);
 #endif  // _TASK_STATUS_REQUEST
 
-		void enable();
-		bool enableIfNot();
-		void enableDelayed(unsigned long aDelay=0);
-		void delay(unsigned long aDelay=0);
-		void forceNextIteration(); 
-		void restart();
-		void restartDelayed(unsigned long aDelay=0);
-		bool disable();
+		inline void enable();
+		inline bool enableIfNot();
+		inline void enableDelayed(unsigned long aDelay=0);
+		inline void delay(unsigned long aDelay=0);
+		inline void forceNextIteration(); 
+		inline void restart();
+		inline void restartDelayed(unsigned long aDelay=0);
+		inline bool disable();
 		inline bool isEnabled() { return iStatus.enabled; }
-		void set(unsigned long aInterval, long aIterations, void (*aCallback)(),bool (*aOnEnable)()=NULL, void (*aOnDisable)()=NULL);
-		void setInterval(unsigned long aInterval);
+		inline void set(unsigned long aInterval, long aIterations, void (*aCallback)(),bool (*aOnEnable)()=NULL, void (*aOnDisable)()=NULL);
+		inline void setInterval(unsigned long aInterval);
 		inline unsigned long getInterval() { return iInterval; }
-		void setIterations(long aIterations);
+		inline void setIterations(long aIterations);
 		inline long getIterations() { return iIterations; }
 		inline unsigned long getRunCounter() { return iRunCounter; }
 		inline void setCallback(void (*aCallback)()) { iCallback = aCallback; }
@@ -225,8 +228,8 @@ class Task {
 		inline bool isFirstIteration() { return (iRunCounter <= 1); } 
 		inline bool isLastIteration() { return (iIterations == 0); }
 #ifdef _TASK_STATUS_REQUEST
-		void waitFor(StatusRequest* aStatusRequest, unsigned long aInterval = 0, long aIterations = 1);
-		void waitForDelayed(StatusRequest* aStatusRequest, unsigned long aInterval = 0, long aIterations = 1);
+		inline void waitFor(StatusRequest* aStatusRequest, unsigned long aInterval = 0, long aIterations = 1);
+		inline void waitForDelayed(StatusRequest* aStatusRequest, unsigned long aInterval = 0, long aIterations = 1);
 		inline StatusRequest* getStatusRequest() {return iStatusRequest; }
 #endif  // _TASK_STATUS_REQUEST
 #ifdef _TASK_WDT_IDS
@@ -241,7 +244,7 @@ class Task {
 #endif  // _TASK_LTS_POINTER
 	
     private:
-		void reset();
+		inline void reset();
 
 		volatile __task_status	iStatus;
 		volatile unsigned long	iInterval;			// execution interval in milliseconds (or microseconds). 0 - immediate
@@ -280,16 +283,16 @@ class Scheduler {
 	friend class Task;
 	public:
 		Scheduler();
-		void init();
-		void addTask(Task& aTask);
-		void deleteTask(Task& aTask);
-		void disableAll(bool aRecursive = true);
-		void enableAll(bool aRecursive = true);
-		bool execute();			// Returns true if at none of the tasks' callback methods was invoked (true if idle run)
-		void startNow(bool aRecursive = true); 			// reset ALL active tasks to immediate execution NOW.
+		inline void init();
+		inline void addTask(Task& aTask);
+		inline void deleteTask(Task& aTask);
+		inline void disableAll(bool aRecursive = true);
+		inline void enableAll(bool aRecursive = true);
+		inline bool execute();			// Returns true if at none of the tasks' callback methods was invoked (true if idle run)
+		inline void startNow(bool aRecursive = true); 			// reset ALL active tasks to immediate execution NOW.
 		inline Task& currentTask() {return *iCurrent; }
 #ifdef _TASK_SLEEP_ON_IDLE_RUN
-		void allowSleep(bool aState = true);
+		inline void allowSleep(bool aState = true);
 #endif  // _TASK_SLEEP_ON_IDLE_RUN
 #ifdef _TASK_LTS_POINTER
 		inline void* currentLts() {return iCurrent->iLTS; }
@@ -298,7 +301,7 @@ class Scheduler {
 		inline bool isOverrun() { return (iCurrent->iOverrun < 0); }
 #endif  // _TASK_TIMECRITICAL
 #ifdef _TASK_PRIORITY
-		void setHighPriorityScheduler(Scheduler* aScheduler);
+		inline void setHighPriorityScheduler(Scheduler* aScheduler);
 		static Scheduler& currentScheduler() { return *(iCurrentScheduler); };
 #endif  // _TASK_PRIORITY