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
EventOverrider Class Referencefinal
Inheritance diagram for EventOverrider:
Collaboration diagram for EventOverrider:

Public Member Functions

 EventOverrider ()
 ~EventOverrider ()=default
 Destructor.
void SetCallback (stk_event_overrider_t *c)
 Bind or unbind a C-level overrider struct.
bool IsActive () const
 Returns true when a C-level struct is currently bound.
bool OnSleep (Timeout sleep_ticks) override
 Called by the Kernel when it is entering a sleep mode.
bool OnHardFault () override
 Called by Kernel when hard fault happens.

Private Attributes

stk_event_overrider_tm_cb

Detailed Description

Definition at line 160 of file stk_c.cpp.

Constructor & Destructor Documentation

◆ EventOverrider()

EventOverrider::EventOverrider ( )
inline

Definition at line 163 of file stk_c.cpp.

163 : m_cb(nullptr)
164 {}
stk_event_overrider_t * m_cb
Definition stk_c.cpp:206

References m_cb.

◆ ~EventOverrider()

EventOverrider::~EventOverrider ( )
default

Destructor.

Note
MISRA deviation: [STK-DEV-005] Rule 10-3-2.

References STK_VIRT_DTOR.

Member Function Documentation

◆ IsActive()

bool EventOverrider::IsActive ( ) const
inline

Returns true when a C-level struct is currently bound.

Definition at line 179 of file stk_c.cpp.

179{ return (m_cb != nullptr); }

References m_cb.

◆ OnHardFault()

bool EventOverrider::OnHardFault ( )
inlineoverridevirtual

Called by Kernel when hard fault happens.

Note
Normally called by Kernel when one of the scheduled tasks missed its deadline (see stk::KERNEL_HRT, IPlatform::HardFault).
Returns
True if event is handled otherwise False to let driver handle it.

Reimplemented from stk::IPlatform::IEventOverrider.

Definition at line 193 of file stk_c.cpp.

194 {
195 bool is_handled = false;
196
197 if ((m_cb != nullptr) && (m_cb->on_hard_fault != nullptr))
198 {
199 is_handled = m_cb->on_hard_fault(m_cb->user_data);
200 }
201
202 return is_handled;
203 }

References m_cb.

◆ OnSleep()

bool EventOverrider::OnSleep ( Timeout sleep_ticks)
inlineoverridevirtual

Called by the Kernel when it is entering a sleep mode.

Returns
True if event is handled otherwise False to let driver handle it.

Reimplemented from stk::IPlatform::IEventOverrider.

Definition at line 182 of file stk_c.cpp.

183 {
184 bool is_handled = false;
185
186 if ((m_cb != nullptr) && (m_cb->on_sleep != nullptr))
187 {
188 is_handled = m_cb->on_sleep(static_cast<stk_timeout_t>(sleep_ticks), m_cb->user_data);
189 }
190
191 return is_handled;
192 }
int32_t stk_timeout_t
Timeout value.
Definition stk_c.h:113

References m_cb.

◆ SetCallback()

void EventOverrider::SetCallback ( stk_event_overrider_t * c)
inline

Bind or unbind a C-level overrider struct.

Parameters
[in]cPointer to a caller-owned stk_event_overrider_t, or nullptr to deactivate this wrapper.

Definition at line 175 of file stk_c.cpp.

175{ m_cb = c; }

References m_cb.

Member Data Documentation

◆ m_cb

stk_event_overrider_t* EventOverrider::m_cb
private

Definition at line 206 of file stk_c.cpp.

Referenced by EventOverrider(), IsActive(), OnHardFault(), OnSleep(), and SetCallback().


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