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 161 of file stk_c.cpp.

Constructor & Destructor Documentation

◆ EventOverrider()

EventOverrider::EventOverrider ( )
inline

Definition at line 164 of file stk_c.cpp.

164 : m_cb(nullptr)
165 {}
stk_event_overrider_t * m_cb
Definition stk_c.cpp:207

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 180 of file stk_c.cpp.

180{ 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 194 of file stk_c.cpp.

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

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 183 of file stk_c.cpp.

184 {
185 bool is_handled = false;
186
187 if ((m_cb != nullptr) && (m_cb->on_sleep != nullptr))
188 {
189 is_handled = m_cb->on_sleep(static_cast<stk_timeout_t>(sleep_ticks), m_cb->user_data);
190 }
191
192 return is_handled;
193 }
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 176 of file stk_c.cpp.

176{ m_cb = c; }

References m_cb.

Member Data Documentation

◆ m_cb

stk_event_overrider_t* EventOverrider::m_cb
private

Definition at line 207 of file stk_c.cpp.

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


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