diff options
| author | Riku Isokoski <riksu9000@gmail.com> | 2023-02-27 15:40:43 +0200 |
|---|---|---|
| committer | Riku Isokoski <riksu9000@gmail.com> | 2023-04-16 14:33:23 +0000 |
| commit | 661ffbeb1eea68ec0cd63b4db537515f1d1772c8 (patch) | |
| tree | 415631431e5eba55b0d07ed1184359bdad07faa4 /src/components/timer/TimerController.cpp | |
| parent | 4d93ae6d27a94fe2a3c03b8f09bff2e23da30e12 (diff) | |
TimerController: Make TimerController reusable
TimerController instance was moved to DisplayApp.
Diffstat (limited to 'src/components/timer/TimerController.cpp')
| -rw-r--r-- | src/components/timer/TimerController.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/components/timer/TimerController.cpp b/src/components/timer/TimerController.cpp index 5e7f1eed..e3aa07af 100644 --- a/src/components/timer/TimerController.cpp +++ b/src/components/timer/TimerController.cpp @@ -1,16 +1,9 @@ #include "components/timer/TimerController.h" -#include "systemtask/SystemTask.h" using namespace Pinetime::Controllers; -void TimerCallback(TimerHandle_t xTimer) { - auto* controller = static_cast<TimerController*>(pvTimerGetTimerID(xTimer)); - controller->OnTimerEnd(); -} - -void TimerController::Init(Pinetime::System::SystemTask* systemTask) { - this->systemTask = systemTask; - timer = xTimerCreate("Timer", 1, pdFALSE, this, TimerCallback); +TimerController::TimerController(void* const timerData, TimerCallbackFunction_t timerCallbackFunction) { + timer = xTimerCreate("Timer", 1, pdFALSE, timerData, timerCallbackFunction); } void TimerController::StartTimer(std::chrono::milliseconds duration) { @@ -33,7 +26,3 @@ void TimerController::StopTimer() { bool TimerController::IsRunning() { return (xTimerIsTimerActive(timer) == pdTRUE); } - -void TimerController::OnTimerEnd() { - systemTask->PushMessage(System::Messages::OnTimerDone); -} |
