summaryrefslogtreecommitdiff
path: root/src/components/timer/TimerController.h
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2021-05-21 09:38:38 (GMT)
committerGitea <gitea@fake.local>2021-05-21 09:38:38 (GMT)
commitde69905c0647997091d9e385538c96de30be93e6 (patch)
tree4775001d808da520c93a7552da1bea80e7714a30 /src/components/timer/TimerController.h
parenta80e782f267cd2424d22da23d809c0c6a8ff8761 (diff)
parent7c9513be8a3bf36fda5706cb0fb1bd6232d42ffd (diff)
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/components/timer/TimerController.h')
-rw-r--r--src/components/timer/TimerController.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/components/timer/TimerController.h b/src/components/timer/TimerController.h
new file mode 100644
index 0000000..5a0b293
--- /dev/null
+++ b/src/components/timer/TimerController.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include <cstdint>
+#include "app_timer.h"
+#include "portmacro_cmsis.h"
+
+namespace Pinetime {
+ namespace System {
+ class SystemTask;
+ }
+ namespace Controllers {
+
+ class TimerController {
+ public:
+ TimerController(Pinetime::System::SystemTask& systemTask);
+
+ void Init();
+
+ void StartTimer(uint32_t duration);
+
+ void StopTimer();
+
+ uint32_t GetTimeRemaining();
+
+ bool IsRunning();
+
+ private:
+ System::SystemTask& systemTask;
+
+ static void timerEnd(void* p_context);
+
+ TickType_t endTicks;
+ bool timerRunning = false;
+ };
+ }
+} \ No newline at end of file