Reorganized directory structure - directory 'internal' pulled up one level. No logical changes.

This commit is contained in:
Pavel Kirienko
2014-03-14 15:01:20 +04:00
parent ab34c94ba2
commit 15cbf96378
90 changed files with 165 additions and 166 deletions
+46
View File
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#include <cassert>
#include <uavcan/node/timer.hpp>
namespace uavcan
{
void Timer::handleDeadline(MonotonicTime current_timestamp)
{
assert(!isRunning());
const MonotonicTime scheduled_time = getDeadline();
if (period_ < MonotonicDuration::getInfinite())
startWithDeadline(scheduled_time + period_);
// Application can re-register the timer with different params, it's OK
handleTimerEvent(TimerEvent(scheduled_time, current_timestamp));
}
void Timer::startOneShotWithDeadline(MonotonicTime deadline)
{
stop();
period_ = MonotonicDuration::getInfinite();
DeadlineHandler::startWithDeadline(deadline);
}
void Timer::startOneShotWithDelay(MonotonicDuration delay)
{
stop();
period_ = MonotonicDuration::getInfinite();
DeadlineHandler::startWithDelay(delay);
}
void Timer::startPeriodic(MonotonicDuration period)
{
assert(period < MonotonicDuration::getInfinite());
stop();
period_ = period;
DeadlineHandler::startWithDelay(period);
}
}