Nico De Witte / simple_task_scheduler
Revision:
1:4eccf61f4ef7
Parent:
0:ba0870ec8714
Child:
3:bd96023168df
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tasks/periodic_task.cpp	Mon Jul 11 15:03:21 2016 +0000
@@ -0,0 +1,18 @@
+#include "periodic_task.h"
+
+namespace SimpleTaskScheduler {
+
+    void PeriodicTask::run(void) {
+    if (state == SHOULD_RUN) {
+      state = RUNNING;
+      this->callback.call();
+      state = WAITING;
+    }
+  }
+
+  void PeriodicTask::tick(void) {
+    // Following can mess with your day if your task is long and periodic periodic
+    //period is small.
+    state = SHOULD_RUN;
+  }
+};