mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-10 01:55:59 +00:00
fixes + timer isRunning
This commit is contained in:
parent
580524c6e6
commit
a38f678d41
@ -25,6 +25,7 @@ namespace sta
|
||||
|
||||
void start(uint32_t millis) override;
|
||||
void stop() override;
|
||||
bool isRunning() override;
|
||||
|
||||
private:
|
||||
osTimerId_t timer_id_; /**< CMSIS RTOS2 Timer */
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user