Added fixes to timer implementation

This commit is contained in:
dario
2023-09-27 00:06:08 +02:00
parent 0f02168b25
commit 2948c9203e
2 changed files with 41 additions and 8 deletions

View File

@@ -57,12 +57,13 @@ namespace sta
*/
void stop() override;
/**
* @returns True of the timmer is currently running.
*/
bool isRunning();
private:
static void timeoutHandler(void* arg)
{
RtosTimer* timer = static_cast<RtosTimer*>(arg);
timer->callback_(timer->callbackArg_);
}
static void timeoutHandler(void* arg);
private:
osTimerId_t timer_id_; /**< CMSIS RTOS2 Timer */
@@ -70,6 +71,7 @@ namespace sta
std::function<void(void*)> callback_; /**< The callback to call on timeout. */
void* callbackArg_; /**< The argument to pass to the callback. */
bool running_; /**< The current state of the timer. Running or not? */
};
} // namespace sta