Simple task manager which uses a Ticker

Task.cpp

Committer:
Phlaphead
Date:
2011-01-14
Revision:
2:3cb7f5770feb
Parent:
1:e95b703c6ad7

File content as of revision 2:3cb7f5770feb:


#include "Task.h"

Task::Task()
{
    interval = DEFAULT_INTERVAL;
}

Task::Task(int _interval)
{
    interval = _interval;
}

void Task::start()
{
    ticker.attach_us(this, &Task::preTick, interval);
    running = true;
}


void Task::preTick()
{
    this->tick();
}

void Task::stop()
{
    ticker.detach();
    running = false;
}