diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-06-11 04:07:26 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-06-11 04:07:26 (GMT) |
| commit | 4f117765d8610d62c32f07f5e967aad3031c88e4 (patch) | |
| tree | 20833456e4f57f8c8317cb104174da7c08238583 /src/components/timer/TimerController.h | |
| parent | b0aadd14e6867b80f7357d4e162180aa9d9ba075 (diff) | |
Revert "Revert "Integrate hatmajster's timer code""
This reverts commit b0aadd14e6867b80f7357d4e162180aa9d9ba075.
Diffstat (limited to 'src/components/timer/TimerController.h')
| -rw-r--r-- | src/components/timer/TimerController.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/components/timer/TimerController.h b/src/components/timer/TimerController.h index 93d8afc..c3bdc2a 100644 --- a/src/components/timer/TimerController.h +++ b/src/components/timer/TimerController.h @@ -2,6 +2,7 @@ #include <FreeRTOS.h> #include <timers.h> +#include <cstdint> namespace Pinetime { namespace System { @@ -13,21 +14,28 @@ namespace Pinetime { public: TimerController() = default; - void Init(System::SystemTask* systemTask); - void StartTimer(uint32_t duration); - void StopTimer(); - - uint32_t GetTimeRemaining(); - - bool IsRunning(); + void StopAlerting(); + int32_t GetSecondsRemaining(); + inline bool IsOvertime() { + return overtime; + } + inline bool IsRunning() { + return timerRunning; + } void OnTimerEnd(); + protected: + friend class Pinetime::System::SystemTask; + void Init(System::SystemTask* systemTask); + private: System::SystemTask* systemTask = nullptr; TimerHandle_t timer; + bool timerRunning = false; + bool overtime = false; }; } -} +}
\ No newline at end of file |
