µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches

C++ API timers definitions. More...

Classes

class  os::rtos::timer::attributes
 Timer attributes. More...
 
class  os::rtos::timer::attributes_periodic
 Periodic timer attributes. More...
 
struct  os::rtos::timer::run
 Timer run types. More...
 
struct  os::rtos::timer::state
 Timer states. More...
 
class  os::rtos::timer
 User single-shot or periodic timer. More...
 

Typedefs

using os::rtos::timer::func_args_t = void *
 Timer call back function arguments.
 
using os::rtos::timer::func_t = void(*)(func_args_t args)
 Entry point of a timer call back function.
 
using os::rtos::timer::state_t = uint8_t
 Type of of variables holding timer states.
 
using os::rtos::timer::type_t = uint8_t
 Type of of variables holding timer run types.
 

Variables

static const attributes_periodic os::rtos::timer::periodic_initializer
 Default periodic timer initialiser.
 

Detailed Description

C++ API timers definitions.

Examples
void
tmfunc (void* args
{
printf ("%s\n", __func__);
}
int
os_main (int argc, char* argv[])
{
{
// Single-shot timer.
timer tm1
{ tmfunc, nullptr };
sysclock.sleep_for (1); // Sync
tm1.start (1);
tm1.stop ();
}
{
// Named single-shot timer.
timer tm2
{ "tm2", tmfunc, nullptr };
sysclock.sleep_for (1); // Sync
tm2.start (1);
tm2.stop ();
}
{
// Named periodic timer.
timer tm3
{ "tm3", tmfunc, nullptr, timer::periodic_initializer };
sysclock.sleep_for (1); // Sync
tm3.start (1);
tm3.stop ();
}
}
result_t sleep_for(duration_t duration)
Sleep for a relative duration.
int os_main(int argc, char *argv[])
Application entry point, running on the main thread context.
clock_systick sysclock
The system clock object instance.

Typedef Documentation

◆ func_args_t

Timer call back function arguments.

Definition at line 64 of file os-timer.h.

◆ func_t

using os::rtos::timer::func_t = void (*) (func_args_t args)

Entry point of a timer call back function.

Definition at line 70 of file os-timer.h.

◆ state_t

using os::rtos::timer::state_t = uint8_t

Type of of variables holding timer states.

Definition at line 103 of file os-timer.h.

◆ type_t

using os::rtos::timer::type_t = uint8_t

Type of of variables holding timer run types.

Definition at line 76 of file os-timer.h.

Variable Documentation

◆ periodic_initializer

const timer::attributes_periodic os::rtos::timer::periodic_initializer
static

Default periodic timer initialiser.

This variable can be used to create a periodic timer.

Definition at line 255 of file os-timer.h.