3
3
using namespace Pinetime ::Controllers;
4
4
5
5
Timer::Timer (void * const timerData, TimerCallbackFunction_t timerCallbackFunction) {
6
- timerHandle = xTimerCreate (" Timer" , 1 , pdFALSE, timerData, timerCallbackFunction);
6
+ timer = xTimerCreate (" Timer" , 1 , pdFALSE, timerData, timerCallbackFunction);
7
7
}
8
8
9
9
void Timer::StartTimer (std::chrono::milliseconds duration) {
@@ -19,25 +19,25 @@ void Timer::StartTimer(std::chrono::milliseconds duration) {
19
19
leftoverSeconds = 60 ;
20
20
timerOverflowIntervals--;
21
21
}
22
- xTimerChangePeriod (timerHandle , pdMS_TO_TICKS ((leftoverMinutes * 60 * 1000 ) + (leftoverSeconds * 1000 )), 0 );
22
+ xTimerChangePeriod (timer , pdMS_TO_TICKS ((leftoverMinutes * 60 * 1000 ) + (leftoverSeconds * 1000 )), 0 );
23
23
} else {
24
- xTimerChangePeriod (timerHandle , pdMS_TO_TICKS (duration.count ()), 0 );
24
+ xTimerChangePeriod (timer , pdMS_TO_TICKS (duration.count ()), 0 );
25
25
}
26
- xTimerStart (timerHandle , 0 );
26
+ xTimerStart (timer , 0 );
27
27
}
28
28
29
29
std::chrono::milliseconds Timer::GetTimeRemaining () {
30
30
if (IsRunning ()) {
31
- TickType_t remainingTime = xTimerGetExpiryTime (timerHandle ) - xTaskGetTickCount ();
31
+ TickType_t remainingTime = xTimerGetExpiryTime (timer ) - xTaskGetTickCount ();
32
32
return std::chrono::milliseconds ((remainingTime * 1000 / configTICK_RATE_HZ) + (timerOverflowIntervals * maxTimerMS));
33
33
}
34
34
return std::chrono::milliseconds (0 );
35
35
}
36
36
37
37
void Timer::StopTimer () {
38
- xTimerStop (timerHandle , 0 );
38
+ xTimerStop (timer , 0 );
39
39
}
40
40
41
41
bool Timer::IsRunning () {
42
- return (xTimerIsTimerActive (timerHandle ) == pdTRUE);
42
+ return (xTimerIsTimerActive (timer ) == pdTRUE);
43
43
}
0 commit comments