33#pragma clang diagnostic ignored "-Wc++98-compat"
152 {
nullptr, function, args, attr }
188#if defined(OS_TRACE_RTOS_TIMER)
189 trace::printf (
"%s() @%p %s\n", __func__,
this, this->name ());
197 type_ = attr.tm_type;
201#if !defined(OS_USE_RTOS_PORT_TIMER)
202 clock_ = attr.clock !=
nullptr ? attr.clock : &
sysclock;
205#if defined(OS_USE_RTOS_PORT_TIMER)
207 port::timer::create (
this, function, args);
214 state_ = state::initialized;
229#if defined(OS_TRACE_RTOS_TIMER)
233#if defined(OS_USE_RTOS_PORT_TIMER)
235 port::timer::destroy (
this);
245 timer_node_.unlink ();
263#if defined(OS_TRACE_RTOS_TIMER)
265 static_cast<unsigned int> (period),
this,
name ());
278#if defined(OS_USE_RTOS_PORT_TIMER)
280 res = port::timer::start (
this, period);
286 timer_node_.timestamp = clock_->steady_now () + period;
293 timer_node_.unlink ();
295 clock_->steady_list ().link (timer_node_);
321#if defined(OS_TRACE_RTOS_TIMER)
335#if defined(OS_USE_RTOS_PORT_TIMER)
337 res = port::timer::stop (
this);
345 timer_node_.unlink ();
356#if !defined(OS_USE_RTOS_PORT_TIMER)
363 timer::internal_interrupt_service_routine (
void)
369 timer_node_.timestamp += period_;
372 clock_->steady_list ().link (timer_node_);
379#if defined(OS_USE_RTOS_PORT_TIMER)
const char * name(void) const
Get object name.
Interrupts critical section RAII helper.
User single-shot or periodic timer.
~timer()
Destruct the timer object instance.
timer(func_t function, func_args_t args, const attributes &attr=once_initializer)
Construct a timer object instance.
static const attributes once_initializer
Default one shot timer initialiser.
result_t stop(void)
Stop the timer.
result_t start(clock::duration_t period)
Start or restart the timer.
int puts(const char *s)
Write the string and a line terminator to the trace device.
int printf(const char *format,...)
Write a formatted string to the trace device.
port::clock::duration_t duration_t
Type of variables holding clock durations.
clock_systick sysclock
The system clock object instance.
void * func_args_t
Timer call back function arguments.
void(*)(func_args_t args) func_t
Entry point of a timer call back function.
static const attributes_periodic periodic_initializer
Default periodic timer initialiser.
bool in_handler_mode(void)
Check if the CPU is in handler mode.
@ ok
Function completed; no errors or events occurred.
uint32_t result_t
Type of values returned by RTOS functions.
#define os_assert_throw(__e, __er)
Assert or throw a system error exception.
#define os_assert_err(__e, __er)
Assert or return an error.
Single file µOS++ RTOS definitions.
@ periodic
Run periodically.