#include "Timer.h"
//
CTimer::CTimer(void)
{
    FPeriod = INIT_TIMER_PERIOD_MS;
    FPreset = INIT_TIMER_PERIOD_MS;
}
//
void CTimer::Start(long unsigned period)
{
    FPeriod = period;
    FPreset = millis();
}
//
void CTimer::Stop(void)
{
    FPeriod = INIT_TIMER_PERIOD_MS;
}
//
long unsigned CTimer::GetMillis(void)
{
    return millis() - FPreset;
}
//
bool CTimer::Execute(void)
{
    if (0L == FPeriod) 
    {
        return false;
    }
    if (FPeriod <= millis() - FPreset)
    {
        FPreset = millis();
        return true;
    }
    return false;
}
