mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-12 02:36:00 +00:00
Merge pull request 'timer-fix' (#7) from timer-fix into main
Reviewed-on: https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils/pulls/7
This commit is contained in:
commit
621e6e3666
@ -19,6 +19,7 @@ namespace sta
|
|||||||
class RtosTimer : public Timer
|
class RtosTimer : public Timer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
RtosTimer();
|
||||||
RtosTimer(void (*callback)(void *arg), void *arg);
|
RtosTimer(void (*callback)(void *arg), void *arg);
|
||||||
~RtosTimer();
|
~RtosTimer();
|
||||||
|
|
||||||
@ -31,4 +32,4 @@ namespace sta
|
|||||||
};
|
};
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
||||||
#endif // STA_RTOS_TIMER_HPP
|
#endif // STA_RTOS_TIMER_HPP
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
#include <sta/rtos/timer.hpp>
|
#include <sta/rtos/timer.hpp>
|
||||||
#include <sta/debug/debug.hpp>
|
#include <sta/debug/debug.hpp>
|
||||||
|
#include <sta/debug/assert.hpp>
|
||||||
|
|
||||||
namespace sta {
|
namespace sta {
|
||||||
|
RtosTimer::RtosTimer(){}
|
||||||
|
|
||||||
RtosTimer::RtosTimer(void (*callback)(void *arg), void *arg) {
|
RtosTimer::RtosTimer(void (*callback)(void *arg), void *arg) {
|
||||||
timer_attr_.name = "Timer";
|
timer_attr_.name = "Timer";
|
||||||
timer_attr_.attr_bits = osTimerOnce;
|
timer_attr_.attr_bits = osTimerOnce;
|
||||||
timer_attr_.cb_size = sizeof(osTimerAttr_t);
|
timer_attr_.cb_size = sizeof(osTimerAttr_t);
|
||||||
|
|
||||||
timer_id_ = osTimerNew(callback, osTimerOnce, arg, &timer_attr_);
|
timer_id_ = osTimerNew(callback, osTimerOnce, arg, &timer_attr_);
|
||||||
|
STA_ASSERT_MSG(timer_id_ != 0, "Failed to initialize timer");
|
||||||
}
|
}
|
||||||
|
|
||||||
RtosTimer::~RtosTimer() {
|
RtosTimer::~RtosTimer() {
|
||||||
@ -25,4 +29,4 @@ namespace sta {
|
|||||||
|
|
||||||
if (status != osOK) STA_DEBUG_PRINTLN("Timer stop failed");
|
if (status != osOK) STA_DEBUG_PRINTLN("Timer stop failed");
|
||||||
}
|
}
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
Loading…
x
Reference in New Issue
Block a user