diff options
| author | Riku Isokoski <riksu9000@gmail.com> | 2023-04-11 12:18:49 +0300 |
|---|---|---|
| committer | Riku Isokoski <riksu9000@gmail.com> | 2023-04-16 14:33:23 +0000 |
| commit | 40f7e1c7be6882e01058b5ccf64d5005c6105346 (patch) | |
| tree | 7117de9dc371404da75efd10813d724b5e0205a3 /src/components | |
| parent | 661ffbeb1eea68ec0cd63b4db537515f1d1772c8 (diff) | |
TimerController: Rename to Timer
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/timer/Timer.cpp (renamed from src/components/timer/TimerController.cpp) | 12 | ||||
| -rw-r--r-- | src/components/timer/Timer.h (renamed from src/components/timer/TimerController.h) | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/components/timer/TimerController.cpp b/src/components/timer/Timer.cpp index e3aa07af..279178cd 100644 --- a/src/components/timer/TimerController.cpp +++ b/src/components/timer/Timer.cpp @@ -1,17 +1,17 @@ -#include "components/timer/TimerController.h" +#include "components/timer/Timer.h" using namespace Pinetime::Controllers; -TimerController::TimerController(void* const timerData, TimerCallbackFunction_t timerCallbackFunction) { +Timer::Timer(void* const timerData, TimerCallbackFunction_t timerCallbackFunction) { timer = xTimerCreate("Timer", 1, pdFALSE, timerData, timerCallbackFunction); } -void TimerController::StartTimer(std::chrono::milliseconds duration) { +void Timer::StartTimer(std::chrono::milliseconds duration) { xTimerChangePeriod(timer, pdMS_TO_TICKS(duration.count()), 0); xTimerStart(timer, 0); } -std::chrono::milliseconds TimerController::GetTimeRemaining() { +std::chrono::milliseconds Timer::GetTimeRemaining() { if (IsRunning()) { TickType_t remainingTime = xTimerGetExpiryTime(timer) - xTaskGetTickCount(); return std::chrono::milliseconds(remainingTime * 1000 / configTICK_RATE_HZ); @@ -19,10 +19,10 @@ std::chrono::milliseconds TimerController::GetTimeRemaining() { return std::chrono::milliseconds(0); } -void TimerController::StopTimer() { +void Timer::StopTimer() { xTimerStop(timer, 0); } -bool TimerController::IsRunning() { +bool Timer::IsRunning() { return (xTimerIsTimerActive(timer) == pdTRUE); } diff --git a/src/components/timer/TimerController.h b/src/components/timer/Timer.h index 1d2a51df..2469666f 100644 --- a/src/components/timer/TimerController.h +++ b/src/components/timer/Timer.h @@ -7,9 +7,9 @@ namespace Pinetime { namespace Controllers { - class TimerController { + class Timer { public: - TimerController(void* timerData, TimerCallbackFunction_t timerCallbackFunction); + Timer(void* timerData, TimerCallbackFunction_t timerCallbackFunction); void StartTimer(std::chrono::milliseconds duration); |
