summaryrefslogtreecommitdiff
path: root/src/components/timer/TimerController.h
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-04-17 11:10:44 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-04-17 13:12:52 (GMT)
commit50b5b2ccb716a4a5c5b409962424a2441c9435e7 (patch)
tree81b7ec7950a595cbefab6b4954171bf4b6d498bf /src/components/timer/TimerController.h
parent94db51bba103c6b70475209c05a10911f4a005c7 (diff)
Switch MotorController and TimerController to FreeRTOS timers
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;
};