2021-05-20 14:43:54 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include "app_timer.h"
|
|
|
|
#include "portmacro_cmsis.h"
|
|
|
|
|
|
|
|
namespace Pinetime {
|
|
|
|
namespace System {
|
|
|
|
class SystemTask;
|
|
|
|
}
|
|
|
|
namespace Controllers {
|
|
|
|
|
|
|
|
class TimerController {
|
|
|
|
public:
|
2021-06-06 09:56:03 -04:00
|
|
|
TimerController() = default;
|
2021-05-20 14:43:54 -04:00
|
|
|
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
void StartTimer(uint32_t duration);
|
|
|
|
|
|
|
|
void StopTimer();
|
|
|
|
|
|
|
|
uint32_t GetTimeRemaining();
|
|
|
|
|
|
|
|
bool IsRunning();
|
2021-06-06 09:56:03 -04:00
|
|
|
|
|
|
|
void OnTimerEnd();
|
|
|
|
|
|
|
|
void Register(System::SystemTask* systemTask);
|
|
|
|
|
2021-05-20 14:43:54 -04:00
|
|
|
private:
|
2021-06-06 09:56:03 -04:00
|
|
|
System::SystemTask* systemTask = nullptr;
|
2021-05-20 14:43:54 -04:00
|
|
|
TickType_t endTicks;
|
|
|
|
bool timerRunning = false;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|