![]() |
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Pure C interface for stk::time::PeriodicTrigger. More...
Classes | |
| struct | stk_periodic_trigger_mem_t |
| Opaque memory container for a stk_periodic_trigger_t instance. More... | |
Macros | |
| #define | STK_PERIODIC_TRIGGER_IMPL_SIZE (16U) |
| A memory size (multiples of stk_word_t) required for PeriodicTrigger instance. | |
Typedefs | |
| typedef struct stk_periodic_trigger_mem_t | stk_periodic_trigger_mem_t |
| Opaque memory container for a stk_periodic_trigger_t instance. | |
| typedef struct stk_periodic_trigger_t | stk_periodic_trigger_t |
| Opaque handle to a stk::time::PeriodicTrigger instance. | |
Functions | |
| stk_periodic_trigger_t * | stk_periodic_trigger_create (stk_periodic_trigger_mem_t *const membuf, uint32_t membuf_size, uint32_t period_ticks, bool started) |
| Construct PeriodicTrigger instance in the supplied memory buffer. | |
| void | stk_periodic_trigger_destroy (stk_periodic_trigger_t *const trig) |
| Destroy instance (calls the C++ destructor in-place). | |
| bool | stk_periodic_trigger_poll (stk_periodic_trigger_t *trig) |
| Check whether the scheduled trigger time has been reached. | |
| void | stk_periodic_trigger_set_period (stk_periodic_trigger_t *trig, uint32_t period_ticks) |
| Change the trigger period while preserving phase. | |
| void | stk_periodic_trigger_restart (stk_periodic_trigger_t *trig) |
| Reset and start the trigger from the current tick count. | |
| uint32_t | stk_periodic_trigger_get_period (const stk_periodic_trigger_t *trig) |
| Get currently configured trigger period. | |
Pure C interface for stk::time::PeriodicTrigger.
Typical usage:
| #define STK_PERIODIC_TRIGGER_IMPL_SIZE (16U) |
A memory size (multiples of stk_word_t) required for PeriodicTrigger instance.
Definition at line 293 of file stk_c_time.h.
| typedef struct stk_periodic_trigger_mem_t stk_periodic_trigger_mem_t |
Opaque memory container for a stk_periodic_trigger_t instance.
static or on the stack (not on the heap). | typedef struct stk_periodic_trigger_t stk_periodic_trigger_t |
Opaque handle to a stk::time::PeriodicTrigger instance.
Definition at line 304 of file stk_c_time.h.
| stk_periodic_trigger_t * stk_periodic_trigger_create | ( | stk_periodic_trigger_mem_t *const | membuf, |
| uint32_t | membuf_size, | ||
| uint32_t | period_ticks, | ||
| bool | started ) |
Construct PeriodicTrigger instance in the supplied memory buffer.
| [in] | membuf | Pointer to the caller-supplied memory container. |
| [in] | membuf_size | Size of the container in bytes (must be >= sizeof(stk_periodic_trigger_mem_t)). |
| [in] | period_ticks | Trigger period in ticks. Must be > 0. |
| [in] | started | true to create the instance in a started state (first firing occurs no earlier than period ticks after construction); false to create it in a stopped state (call stk_periodic_trigger_restart() before polling). |
NULL if membuf is NULL or memory_size is too small. Definition at line 364 of file stk_c_time.cpp.
References stk_periodic_trigger_mem_t::data, STK_ASSERT, and STK_STATIC_ASSERT_N.
| void stk_periodic_trigger_destroy | ( | stk_periodic_trigger_t *const | trig | ) |
Destroy instance (calls the C++ destructor in-place).
| [in] | trig | Trigger handle. May be NULL (no-op). |
Definition at line 383 of file stk_c_time.cpp.
| uint32_t stk_periodic_trigger_get_period | ( | const stk_periodic_trigger_t * | trig | ) |
Get currently configured trigger period.
| [in] | trig | Trigger handle. |
Definition at line 412 of file stk_c_time.cpp.
References stk::time::PeriodicTrigger::GetPeriod(), stk_periodic_trigger_t::handle, and STK_ASSERT.
| bool stk_periodic_trigger_poll | ( | stk_periodic_trigger_t * | trig | ) |
Check whether the scheduled trigger time has been reached.
| [in] | trig | Trigger handle (must be started). |
true once when the current tick count reaches or exceeds the scheduled trigger time, false otherwise. true is returned per call. If multiple full periods have elapsed since the previous call, subsequent calls will continue advancing one period at a time until the schedule catches up. Definition at line 391 of file stk_c_time.cpp.
References stk_periodic_trigger_t::handle, stk::time::PeriodicTrigger::Poll(), and STK_ASSERT.
| void stk_periodic_trigger_restart | ( | stk_periodic_trigger_t * | trig | ) |
Reset and start the trigger from the current tick count.
| [in] | trig | Trigger handle. |
Definition at line 405 of file stk_c_time.cpp.
References stk_periodic_trigger_t::handle, stk::time::PeriodicTrigger::Restart(), and STK_ASSERT.
| void stk_periodic_trigger_set_period | ( | stk_periodic_trigger_t * | trig, |
| uint32_t | period_ticks ) |
Change the trigger period while preserving phase.
| [in] | trig | Trigger handle. |
| [in] | period_ticks | New trigger period in ticks. Must be > 0. |
Definition at line 398 of file stk_c_time.cpp.
References stk_periodic_trigger_t::handle, stk::time::PeriodicTrigger::SetPeriod(), and STK_ASSERT.