2021-05-20 20:43:54 +02: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 15:56:03 +02:00
|
|
|
TimerController() = default;
|
2021-05-20 20:43:54 +02:00
|
|
|
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
void StartTimer(uint32_t duration);
|
|
|
|
|
|
|
|
void StopTimer();
|
|
|
|
|
|
|
|
uint32_t GetTimeRemaining();
|
|
|
|
|
|
|
|
bool IsRunning();
|
2021-06-06 15:56:03 +02:00
|
|
|
|
|
|
|
void OnTimerEnd();
|
|
|
|
|
|
|
|
void Register(System::SystemTask* systemTask);
|
|
|
|
|
2021-05-20 20:43:54 +02:00
|
|
|
private:
|
2021-06-06 15:56:03 +02:00
|
|
|
System::SystemTask* systemTask = nullptr;
|
2021-05-20 20:43:54 +02:00
|
|
|
TickType_t endTicks;
|
|
|
|
bool timerRunning = false;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|