summaryrefslogtreecommitdiff
path: root/src/components/timer/TimerController.h
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-05-12 00:19:59 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-05-12 00:19:59 (GMT)
commit72d0f103a8bc1048ff9729aee65070475977b5a3 (patch)
tree6a806507701dcbea7eb30fa0351de9f3e59d7f56 /src/components/timer/TimerController.h
parent1ff0a48bbb66f8099c1451fa02983655003def8e (diff)
parentaca605d4fb4040cc80c1acf101023aa86e7694ba (diff)
Merge branch 'alarm-reliability-and-switch-to-freertos-timers' into analog24
Diffstat (limited to 'src/components/timer/TimerController.h')
-rw-r--r--src/components/timer/TimerController.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/components/timer/TimerController.h b/src/components/timer/TimerController.h
index fa7bc90..24d7150 100644
--- a/src/components/timer/TimerController.h
+++ b/src/components/timer/TimerController.h
@@ -1,5 +1,7 @@
#pragma once
+#include <FreeRTOS.h>
+#include <timers.h>
#include <cstdint>
#include "app_timer.h"
#include "portmacro_cmsis.h"
@@ -9,27 +11,27 @@ namespace Pinetime {
class SystemTask;
}
namespace Controllers {
-
+
class TimerController {
public:
TimerController() = default;
-
- void Init();
-
+
void StartTimer(uint32_t duration);
-
void StopTimer();
-
+
uint32_t GetTimeRemaining();
-
+
bool IsRunning();
void OnTimerEnd();
- void Register(System::SystemTask* systemTask);
+ 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;
};