Nico De Witte / simple_task_scheduler

tasks/periodic_task.cpp

Committer:
dwini
Date:
2016-07-11
Revision:
1:4eccf61f4ef7
Parent:
periodic_task.cpp@ 0:ba0870ec8714
Child:
3:bd96023168df

File content as of revision 1:4eccf61f4ef7:

#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;
  }
};