diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-20 17:45:20 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-20 17:45:20 (GMT) |
| commit | 822ec38fde294dfc2a19fd83fe463fc0d7b3ee2d (patch) | |
| tree | 43e006a2890832c3778a4dbcc0920483ce63ed17 /src/components/timer/TimerController.h | |
| parent | be01602fcb6dc9cd91df702658c0b52da74023a9 (diff) | |
| parent | aca605d4fb4040cc80c1acf101023aa86e7694ba (diff) | |
Merge branch 'alarm-reliability-and-switch-to-freertos-timers' into rev22-develop
Diffstat (limited to 'src/components/timer/TimerController.h')
| -rw-r--r-- | src/components/timer/TimerController.h | 18 |
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; }; |
