blob: cdd78ec19c17131a0640f06e52854d316b45162a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#pragma once
#include <FreeRTOS.h>
#include <timers.h>
#include <cstdint>
#include "app_timer.h"
#include "portmacro_cmsis.h"
namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class TimerController {
public:
TimerController() = default;
void StartTimer(uint32_t duration);
void StopTimer();
void StopAlerting();
int32_t GetSecondsRemaining();
bool IsOvertime() {
return overtime;
}
bool IsRunning() {
return timerRunning;
}
void OnTimerEnd();
protected:
friend class Pinetime::System::SystemTask;
void Init(System::SystemTask* systemTask);
private:
System::SystemTask* systemTask = nullptr;
TimerHandle_t timerAppTimer;
TickType_t endTicks;
bool timerRunning = false;
bool overtime = false;
};
}
}
|