Download this file
#ifndef TIMER_H
#define TIMER_H

#include "leffakone_timer.h"
#include "Scheduler.h"
#include "state_machine.h"

class StateMachine;

class Timer: public TimedTask {

  public:
    Timer(): 
      TimedTask(0),
      enabled(false)
      {};
    bool canRun(uint32_t now);
    inline void enable() { enabled = true; }
    inline void disable() { enabled = false; }
    inline void get_off_in(uint32_t value) { setRunTime(millis() + value * 1000); enable(); }
    inline void set_state_machine(StateMachine * sm) { state_machine = sm; }

  protected:
    bool enabled;
    StateMachine * state_machine;
};

class WakeupTimer: public Timer {
  public:
    WakeupTimer() {};
    void run(uint32_t now);
};

class ResetTimer: public Timer {
  public:
    ResetTimer() {};
    void run(uint32_t now);
};

#endif
// vim:ft=arduino