You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
911 B
34 lines
911 B
#pragma once
|
|
#include "ErrorHandling/error_codes.h"
|
|
#include "ITimerChannel.h"
|
|
#include "baseTimer.h"
|
|
#include "types.h"
|
|
|
|
namespace TeensyTimerTool
|
|
{
|
|
//class [[deprecated("Use PeriodicTimer or OneShotTimer instead")]] Timer : public BaseTimer
|
|
class Timer : public BaseTimer
|
|
{
|
|
public:
|
|
Timer(TimerGenerator* gen = nullptr);
|
|
|
|
inline errorCode beginPeriodic(callback_t cb, uint32_t period)
|
|
{
|
|
isPeriodic = true;
|
|
return BaseTimer::begin(cb, period, true);
|
|
}
|
|
inline errorCode beginOneShot(callback_t cb)
|
|
{
|
|
isPeriodic = false;
|
|
return BaseTimer::begin(cb, 0, false);
|
|
}
|
|
inline void trigger(uint32_t delay);
|
|
};
|
|
|
|
// IMPLEMENTATION =======================================================
|
|
|
|
void Timer::trigger(const uint32_t delay)
|
|
{
|
|
timerChannel->trigger(delay);
|
|
}
|
|
}
|
|
|