-
-
Notifications
You must be signed in to change notification settings - Fork 959
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
src/components/timer/TimerController.cpp → src/components/timer/Timer.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
#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); | ||
} | ||
return std::chrono::milliseconds(0); | ||
} | ||
|
||
void TimerController::StopTimer() { | ||
void Timer::StopTimer() { | ||
xTimerStop(timer, 0); | ||
} | ||
|
||
bool TimerController::IsRunning() { | ||
bool Timer::IsRunning() { | ||
return (xTimerIsTimerActive(timer) == pdTRUE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters