SuperTinyKernel™ RTOS 1.06.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk_event_overrider_t Struct Reference

C-level callback table that mirrors stk::IPlatform::IEventOverrider. More...

#include <stk_c.h>

Public Attributes

bool(* on_sleep )(stk_timeout_t sleep_ticks, void *user_data)
 Called by the kernel when it is about to enter a sleep (idle) state.
bool(* on_hard_fault )(void *user_data)
 Called by the kernel when a hard fault occurs (e.g. HRT deadline missed).
void * user_data
 Opaque pointer forwarded unchanged to every callback.

Detailed Description

C-level callback table that mirrors stk::IPlatform::IEventOverrider.

Fill in the function pointers you want to intercept, leave the others NULL (a NULL pointer causes the default platform driver behaviour to execute, identical to returning false from the C++ virtual method). The user_data pointer is forwarded to every callback so you can pass context without a global variable.

Both callbacks follow the same return-value convention as the C++ interface:

  • return true → event fully handled; the platform driver does nothing further.
  • return false → not handled; the platform driver applies its default behaviour.
Note
The struct must remain valid from the stk_kernel_set_event_overrider() call until the kernel is destroyed. Static or global storage is recommended.
Must be installed with stk_kernel_set_event_overrider() before stk_kernel_start().
See also
stk_kernel_set_event_overrider()
Examples
D:/SVN/private/stk/interop/c/include/stk_c.h.

Definition at line 489 of file stk_c.h.

Member Data Documentation

◆ on_hard_fault

bool(* stk_event_overrider_t::on_hard_fault) (void *user_data)

Called by the kernel when a hard fault occurs (e.g. HRT deadline missed).

Parameters
[in]user_dataThe user_data pointer from this struct.
Returns
true if handled; false to let the platform driver handle it (which typically halts the system).
Note
May be NULL — treated as always returning false.
Examples
D:/SVN/private/stk/interop/c/include/stk_c.h.

Definition at line 506 of file stk_c.h.

◆ on_sleep

bool(* stk_event_overrider_t::on_sleep) (stk_timeout_t sleep_ticks, void *user_data)

Called by the kernel when it is about to enter a sleep (idle) state.

Parameters
[in]sleep_ticksNumber of ticks the kernel intends to sleep.
[in]user_dataThe user_data pointer from this struct.
Returns
true if the sleep was handled by the application (kernel skips its own sleep logic); false to let the platform driver handle it.
Note
May be NULL — treated as always returning false.
Examples
D:/SVN/private/stk/interop/c/include/stk_c.h.

Definition at line 498 of file stk_c.h.

◆ user_data

void* stk_event_overrider_t::user_data

Opaque pointer forwarded unchanged to every callback.

Note
May be NULL if not needed.
Examples
D:/SVN/private/stk/interop/c/include/stk_c.h.

Definition at line 511 of file stk_c.h.


The documentation for this struct was generated from the following file: