C API timer definitions. More...
Classes | |
| struct | os_timer_attr_s |
| Timer attributes. More... | |
| struct | os_timer_s |
| Timer object storage. More... | |
Typedefs | |
| typedef struct os_timer_attr_s | os_timer_attr_t |
| Timer attributes. | |
| typedef void * | os_timer_func_args_t |
| Type of timer function arguments. | |
| typedef void(* | os_timer_func_t) (os_timer_func_args_t args) |
| Type of timer function. | |
| typedef uint8_t | os_timer_state_t |
| Type of variables holding timer states. | |
| typedef struct os_timer_s | os_timer_t |
| Timer object storage. | |
| typedef uint8_t | os_timer_type_t |
| Type of variables holding timer types. | |
Enumerations | |
| enum | { os_timer_once = 0 , os_timer_periodic = 1 } |
| An enumeration with the timer types. More... | |
Timer Attribute Functions | |
| void | os_timer_attr_init (os_timer_attr_t *attr) |
| Initialise the single shot timer attributes. | |
| void | os_timer_attr_periodic_init (os_timer_attr_t *attr) |
| Initialise the periodic timer attributes. | |
| const os_timer_attr_t * | os_timer_attr_get_periodic (void) |
| Get a periodic timer attributes object instance. | |
Timer Creation Functions | |
| void | os_timer_construct (os_timer_t *timer, const char *name, os_timer_func_t function, os_timer_func_args_t args, const os_timer_attr_t *attr) |
| Construct a statically allocated timer object instance. | |
| void | os_timer_destruct (os_timer_t *timer) |
| Destruct the statically allocated timer object instance. | |
| os_timer_t * | os_timer_new (const char *name, os_timer_func_t function, os_timer_func_args_t args, const os_timer_attr_t *attr) |
| Allocate a timer object instance and construct it. | |
| void | os_timer_delete (os_timer_t *timer) |
| Destruct the timer object instance and deallocate it. | |
Timer Functions | |
| const char * | os_timer_get_name (os_timer_t *timer) |
| Get the timer name. | |
| os_result_t | os_timer_start (os_timer_t *timer, os_clock_duration_t period) |
| Start or restart the timer. | |
| os_result_t | os_timer_stop (os_timer_t *timer) |
| Stop the timer. | |
Compatibility Macros | |
| #define | os_timer_create os_timer_construct |
| #define | os_timer_destroy os_timer_destruct |
C API timer definitions.
| #define os_timer_create os_timer_construct |
Definition at line 1158 of file os-c-api.h.
| #define os_timer_destroy os_timer_destruct |
Definition at line 1159 of file os-c-api.h.
| typedef struct os_timer_attr_s os_timer_attr_t |
Timer attributes.
Initialise this structure with os_timer_attr_init() and then set any of the individual members directly.
| typedef void* os_timer_func_args_t |
Type of timer function arguments.
Useful to cast other similar types to silence possible compiler warnings.
Definition at line 709 of file os-c-decls.h.
| typedef void(* os_timer_func_t) (os_timer_func_args_t args) |
Type of timer function.
Useful to cast other similar types to silence possible compiler warnings.
Definition at line 720 of file os-c-decls.h.
| typedef uint8_t os_timer_state_t |
Type of variables holding timer states.
Definition at line 735 of file os-c-decls.h.
| typedef struct os_timer_s os_timer_t |
Timer object storage.
This C structure has the same size as the C++ os::rtos::timer object and must be initialised with os_timer_create().
Later on a pointer to it can be used both in C and C++ to refer to the timer object instance.
The members of this structure are hidden and should not be used directly, but only through specific functions.
| typedef uint8_t os_timer_type_t |
Type of variables holding timer types.
Definition at line 728 of file os-c-decls.h.
| anonymous enum |
An enumeration with the timer types.
| Enumerator | |
|---|---|
| os_timer_once | |
| os_timer_periodic | |
Definition at line 694 of file os-c-decls.h.
| const os_timer_attr_t * os_timer_attr_get_periodic | ( | void | ) |
Get a periodic timer attributes object instance.
Definition at line 1308 of file os-c-wrapper.cpp.
| void os_timer_attr_init | ( | os_timer_attr_t * | attr | ) |
Initialise the single shot timer attributes.
| [in] | attr | Pointer to timer attributes object instance. |
Definition at line 1282 of file os-c-wrapper.cpp.
| void os_timer_attr_periodic_init | ( | os_timer_attr_t * | attr | ) |
Initialise the periodic timer attributes.
| [in] | attr | Pointer to timer attributes object instance. |
Definition at line 1295 of file os-c-wrapper.cpp.
| void os_timer_construct | ( | os_timer_t * | timer, |
| const char * | name, | ||
| os_timer_func_t | function, | ||
| os_timer_func_args_t | args, | ||
| const os_timer_attr_t * | attr | ||
| ) |
Construct a statically allocated timer object instance.
| [in] | timer | Pointer to timer object instance storage. |
| [in] | name | Pointer to name (may be NULL). |
| [in] | function | Pointer to timer function. |
| [in] | args | Pointer to timer function arguments (may be NULL). |
| [in] | attr | Pointer to attributes (may be NULL). |
os_timer_destruct().Definition at line 1322 of file os-c-wrapper.cpp.
| void os_timer_delete | ( | os_timer_t * | timer | ) |
Destruct the timer object instance and deallocate it.
| [in] | timer | Pointer to dynamically allocated timer object instance. |
Destruct the timer and deallocate the dynamically allocated space using the RTOS system allocator.
delete ptr_timer. os_timer_new().Definition at line 1391 of file os-c-wrapper.cpp.
| void os_timer_destruct | ( | os_timer_t * | timer | ) |
Destruct the statically allocated timer object instance.
| [in] | timer | Pointer to timer object instance. |
os_timer_construct().Definition at line 1345 of file os-c-wrapper.cpp.
| const char * os_timer_get_name | ( | os_timer_t * | timer | ) |
Get the timer name.
| [in] | timer | Pointer to timer object instance. |
Definition at line 1404 of file os-c-wrapper.cpp.
| os_timer_t * os_timer_new | ( | const char * | name, |
| os_timer_func_t | function, | ||
| os_timer_func_args_t | args, | ||
| const os_timer_attr_t * | attr | ||
| ) |
Allocate a timer object instance and construct it.
| [in] | name | Pointer to name (may be NULL). |
| [in] | function | Pointer to timer function. |
| [in] | args | Pointer to timer function arguments (may be NULL). |
| [in] | attr | Pointer to attributes (may be NULL). |
Dynamically allocate the timer object instance using the RTOS system allocator and construct it.
new timer(...). os_timer_delete().Definition at line 1365 of file os-c-wrapper.cpp.
| os_result_t os_timer_start | ( | os_timer_t * | timer, |
| os_clock_duration_t | period | ||
| ) |
Start or restart the timer.
| [in] | timer | Pointer to timer object instance. |
| [in] | period | Timer period, in clock units (ticks or seconds). |
| os_ok | The timer has been started or restarted. |
| ENOTRECOVERABLE | Timer could not be started. |
| EPERM | Cannot be invoked from an Interrupt Service Routines. |
Definition at line 1417 of file os-c-wrapper.cpp.
| os_result_t os_timer_stop | ( | os_timer_t * | timer | ) |
Stop the timer.
| [in] | timer | Pointer to timer object instance. |
| os_ok | The timer has been stopped. |
| EPERM | Cannot be invoked from an Interrupt Service Routines. |
| EAGAIN | The timer is not yet started. |
| ENOTRECOVERABLE | Timer could not be stopped. |
Definition at line 1430 of file os-c-wrapper.cpp.