#ifdef _STK_ASSERT_REDIRECT
#include <stdint.h>
extern void STK_ASSERT_HANDLER(const char *err, const char *source, int32_t line);
#endif
#include "example.h"
#ifdef _PICO_H
#define STK_EXAMPLE_DUALCORE 1
#else
#define STK_EXAMPLE_DUALCORE 0
#endif
#define STK_EXAMPLE_USE_PIPE 1
#ifdef _PICO_H
#else
#endif
#ifdef _STK_ASSERT_REDIRECT
void STK_ASSERT_HANDLER(const char *err, const char *source, int32_t line)
{
while (true) {}
}
#endif
{
};
#if STK_EXAMPLE_USE_PIPE
#else
#endif
template <stk::EAccessMode _AccessMode>
{
public:
{}
private:
{
while (true)
{
#if STK_EXAMPLE_USE_PIPE
continue;
#else
switch (task_id)
{
if (!g_EventSwitchOn.
Wait(100))
continue;
break;
if (!g_EventSwitchOff.
Wait(100))
continue;
break;
}
#endif
{
stk::sync::Mutex::ScopedLock guard(
g_HwMutex);
Led::Set(Led::GREEN, (task_id ==
LED_OFF ?
false :
true));
}
#if !STK_EXAMPLE_USE_PIPE
#endif
}
}
};
template <stk::EAccessMode _AccessMode>
{
private:
{
#if !STK_EXAMPLE_USE_PIPE
#endif
bool led_sw = false;
while (true)
{
#if !STK_EXAMPLE_USE_PIPE
if (!g_EventReady.
Wait())
continue;
#endif
led_sw = !led_sw;
#if STK_EXAMPLE_USE_PIPE
continue;
#else
if (led_sw)
else
#endif
}
}
};
#if STK_EXAMPLE_DUALCORE
{
#if !STK_EXAMPLE_USE_PIPE
#endif
#if !STK_EXAMPLE_USE_PIPE
#endif
}
{
}
{
#if !STK_EXAMPLE_USE_PIPE
#endif
}
#else
{
#if !STK_EXAMPLE_USE_PIPE
#endif
#if !STK_EXAMPLE_USE_PIPE
#endif
#if !STK_EXAMPLE_USE_PIPE
#endif
}
#endif
Top-level STK include. Provides the Kernel class template and all built-in task-switching strategies.
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
static void __stk_debug_break()
Collection of synchronization primitives (stk::sync namespace).
unsigned int sleep(unsigned int seconds)
Suspend for seconds seconds. Cancellation point.
Namespace of STK package.
static Time GetTimeNowMs()
Get current time in milliseconds since kernel start.
static bool Sleep(Timeout tick_count)
Put calling process into a sleep state.
PlatformArmCortexM PlatformDefault
Default platform implementation.
@ KERNEL_TICKLESS
Tickless mode. To use this mode STK_TICKLESS_IDLE must be defined to 1 in stk_config....
@ KERNEL_SYNC
Synchronization support (see Event).
@ KERNEL_STATIC
All tasks are static and can not exit.
SwitchStrategyRoundRobinT< false > SwitchStrategyRR
Shorthand alias for SwitchStrategyRoundRobin.
Concrete implementation of IKernel.
void Start() override
Start the scheduler. This call does not return until all tasks have exited (KERNEL_DYNAMIC mode) or i...
EAddResult AddTask(ITask *user_task) override
Register task for a soft real-time (SRT) scheduling.
void Initialize(uint32_t resolution_us=PERIODICITY_DEFAULT) override
Initialize kernel.
void SetTraceName(const char *name)
Set name.
Partial implementation of the user task.
Binary synchronization event (signaled / non-signaled) primitive.
bool Set()
Set event to signaled state.
bool Wait(Timeout timeout_ticks=WAIT_INFINITE)
Wait until event becomes signaled or the timeout expires.
Recursive mutex primitive that allows the same thread to acquire the lock multiple times.
Thread-safe, type-safe FIFO communication pipe with internal storage.
bool Write(const T &data, Timeout timeout_ticks=WAIT_INFINITE)
Write data to the pipe.
bool Read(T &data, Timeout timeout_ticks=WAIT_INFINITE)
Read data from the pipe.
void Run()
Entry point of the user task.
void Run() override
Entry point of the user task.
static void Start(uint8_t cpu_id, void(*entry_func)(void))
static void InitAll(bool init_state)
LedTaskT< stk::ACCESS_PRIVILEGED > LedTask
static stk::sync::PipeT< LedState, 1 > g_CtrlSignalPipe
static stk::sync::Mutex g_HwMutex