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.
Diff: tasks/periodic_task.cpp
- 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;
+ }
+};