aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/timer/Timer.h
diff options
context:
space:
mode:
authormark9064 <30447455+mark9064@users.noreply.github.com>2025-11-09 18:17:51 +0000
committerGitHub <noreply@github.com>2025-11-09 19:17:51 +0100
commit99ae2f368bd3f9ca5521d2d04a426addbb00b04b (patch)
tree8218788ee2ba3a60d9512c3c6e420ac980d5a4ad /src/components/timer/Timer.h
parent716deff7d0456cdd9eb1d152d3b29f1f39c7a231 (diff)
Refactor Timer component to provide expiry information (#2365)
Diffstat (limited to 'src/components/timer/Timer.h')
-rw-r--r--src/components/timer/Timer.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/components/timer/Timer.h b/src/components/timer/Timer.h
index 2469666f..a99f6c4d 100644
--- a/src/components/timer/Timer.h
+++ b/src/components/timer/Timer.h
@@ -4,23 +4,31 @@
#include <timers.h>
#include <chrono>
+#include <optional>
namespace Pinetime {
namespace Controllers {
class Timer {
public:
+ struct TimerStatus {
+ std::chrono::milliseconds distanceToExpiry;
+ bool expired;
+ };
+
Timer(void* timerData, TimerCallbackFunction_t timerCallbackFunction);
void StartTimer(std::chrono::milliseconds duration);
void StopTimer();
- std::chrono::milliseconds GetTimeRemaining();
+ std::optional<TimerStatus> GetTimerState();
bool IsRunning();
private:
TimerHandle_t timer;
+ TickType_t expiry;
+ bool triggered = false;
};
}
}