12#if defined(OS_USE_OS_APP_CONFIG_H)
13#include <cmsis-plus/os-app-config.h>
21#pragma clang diagnostic ignored "-Wc++98-compat"
136 :
timer{ nullptr, function, args, attr }
168 : object_named_system{ name }
170#if defined(OS_TRACE_RTOS_TIMER)
171 trace::printf (
"%s() @%p %s\n", __func__,
this, this->name ());
183#if !defined(OS_USE_RTOS_PORT_TIMER)
187#if defined(OS_USE_RTOS_PORT_TIMER)
189 port::timer::create (
this, function, args);
211#if defined(OS_TRACE_RTOS_TIMER)
215#if defined(OS_USE_RTOS_PORT_TIMER)
217 port::timer::destroy (
this);
227 timer_node_.unlink ();
245#if defined(OS_TRACE_RTOS_TIMER)
246#pragma GCC diagnostic push
247#if defined(__clang__)
248#elif defined(__GNUC__)
249#pragma GCC diagnostic ignored "-Wuseless-cast"
252 static_cast<unsigned int> (period),
this,
name ());
253#pragma GCC diagnostic pop
266#if defined(OS_USE_RTOS_PORT_TIMER)
268 res = port::timer::start (
this, period);
274 timer_node_.timestamp = clock_->steady_now () + period;
281 timer_node_.unlink ();
283 clock_->steady_list ().link (timer_node_);
309#if defined(OS_TRACE_RTOS_TIMER)
323#if defined(OS_USE_RTOS_PORT_TIMER)
325 res = port::timer::stop (
this);
333 timer_node_.unlink ();
344#if !defined(OS_USE_RTOS_PORT_TIMER)
351 timer::internal_interrupt_service_routine (
void)
357 timer_node_.timestamp += period_;
360 clock_->steady_list ().link (timer_node_);
367#if defined(OS_USE_RTOS_PORT_TIMER)
rtos::clock * clock
Attribute with the address of the clock to be used for timeouts.
const char * name(void) const
Get object name.
Interrupts critical section RAII helper.
type_t tm_type
Timer type attribute.
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.