summaryrefslogtreecommitdiff
path: root/src/components/timer/TimerController.h
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-06-06 15:56:03 +0200
committerJean-François Milants <jf@codingfield.com>2021-06-06 15:56:03 +0200
commit7f9cc51b050e1034b573e37484f7afe29c370d81 (patch)
treede5228132fb72e89bb5d999b74b40f4248d41022 /src/components/timer/TimerController.h
parent79f0fcb07aa80eb70385223272e29f2ba5657bc8 (diff)
Initialize SystemTask, DisplayApp and HeartRateTask as global static variable instead of variables on the heap. We don't need them on the heap as we know their size at build time, it'll reduce memory fragmentation and it'll make memory analysis easier.
Diffstat (limited to 'src/components/timer/TimerController.h')
-rw-r--r--src/components/timer/TimerController.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/components/timer/TimerController.h b/src/components/timer/TimerController.h
index 5a0b293e..fa7bc90d 100644
--- a/src/components/timer/TimerController.h
+++ b/src/components/timer/TimerController.h
@@ -12,7 +12,7 @@ namespace Pinetime {
class TimerController {
public:
- TimerController(Pinetime::System::SystemTask& systemTask);
+ TimerController() = default;
void Init();
@@ -23,12 +23,13 @@ namespace Pinetime {
uint32_t GetTimeRemaining();
bool IsRunning();
-
+
+ void OnTimerEnd();
+
+ void Register(System::SystemTask* systemTask);
+
private:
- System::SystemTask& systemTask;
-
- static void timerEnd(void* p_context);
-
+ System::SystemTask* systemTask = nullptr;
TickType_t endTicks;
bool timerRunning = false;
};