mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-08-06 11:07:34 +00:00
fixes + timer isRunning
This commit is contained in:
@@ -6,12 +6,8 @@ namespace sta {
|
||||
RtosTimer::RtosTimer(){}
|
||||
|
||||
RtosTimer::RtosTimer(void (*callback)(void *arg), void *arg) {
|
||||
timer_attr_.name = "Timer";
|
||||
timer_attr_.attr_bits = osTimerOnce;
|
||||
timer_attr_.cb_size = sizeof(osTimerAttr_t);
|
||||
|
||||
timer_id_ = osTimerNew(callback, osTimerOnce, arg, &timer_attr_);
|
||||
STA_ASSERT_MSG(timer_id_ != 0, "Failed to initialize timer");
|
||||
timer_id_ = osTimerNew(callback, osTimerOnce, arg, NULL);
|
||||
STA_ASSERT_MSG(timer_id_ != NULL, "Failed to initialize timer");
|
||||
}
|
||||
|
||||
RtosTimer::~RtosTimer() {
|
||||
@@ -29,4 +25,8 @@ namespace sta {
|
||||
|
||||
if (status != osOK) STA_DEBUG_PRINTLN("Timer stop failed");
|
||||
}
|
||||
|
||||
bool RtosTimer::isRunning() {
|
||||
return osTimerIsRunning(timer_id_);
|
||||
}
|
||||
} // namespace sta
|
||||
|
Reference in New Issue
Block a user