diff options
author | Riku Isokoski <riksu9000@gmail.com> | 2021-07-17 11:59:19 +0300 |
---|---|---|
committer | Riku Isokoski <riksu9000@gmail.com> | 2022-04-25 15:52:39 +0300 |
commit | b7b1af1c4c3c21f62bf9627d39a37924be541c16 (patch) | |
tree | b52cc00572142a0a868da0e4a239e392b22cdf13 /src/components/timer/TimerController.h | |
parent | 2e42b9000904fe56e2f8cff238a4d911f7648520 (diff) |
Replace app_timer with FreeRTOS timers
Diffstat (limited to 'src/components/timer/TimerController.h')
-rw-r--r-- | src/components/timer/TimerController.h | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/components/timer/TimerController.h b/src/components/timer/TimerController.h index fa7bc90d..93d8afc6 100644 --- a/src/components/timer/TimerController.h +++ b/src/components/timer/TimerController.h @@ -1,37 +1,33 @@ #pragma once -#include <cstdint> -#include "app_timer.h" -#include "portmacro_cmsis.h" +#include <FreeRTOS.h> +#include <timers.h> namespace Pinetime { namespace System { class SystemTask; } namespace Controllers { - + class TimerController { public: TimerController() = default; - - void Init(); - + + void Init(System::SystemTask* systemTask); + void StartTimer(uint32_t duration); - + void StopTimer(); - + uint32_t GetTimeRemaining(); - + bool IsRunning(); void OnTimerEnd(); - void Register(System::SystemTask* systemTask); - private: System::SystemTask* systemTask = nullptr; - TickType_t endTicks; - bool timerRunning = false; + TimerHandle_t timer; }; } -}
\ No newline at end of file +} |