#include "example.h"
{
};
{
};
{
Led::Id led = stk::hw::GetTlsPtr<MyTls>()->led;
}
#ifdef _PICO_H
#else
#endif
template <uint8_t _TaskId, Led::Id _LedId, stk::EAccessMode _AccessMode>
{
public:
{
}
private:
{
stk::hw::SetTlsPtr(&
m_tls);
while (true)
{
g_Sem[(_TaskId + 1) % 4]->Signal();
}
}
};
{
kernel.Initialize();
kernel.AddTask(&task1);
kernel.AddTask(&task2);
kernel.AddTask(&task3);
kernel.AddTask(&task4);
kernel.Start();
}
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.
Implementation of synchronization primitive: stk::sync::SemaphoreT and stk::sync::Semaphore.
Namespace of STK package.
int64_t Ticks
Ticks value.
static bool SleepUntil(Ticks timestamp)
Put calling process into a sleep state until the specified timestamp.
static Ticks GetTicksFromMs(Time ms, uint32_t resolution)
Convert milliseconds to ticks.
static Ticks GetTicks()
Get number of ticks elapsed since kernel start.
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.
SemaphoreT< uint16_t > Semaphore
Default counting semaphore with a 16-bit counter (max count 0xFFFF).
Concrete implementation of IKernel.
Partial implementation of the user task.
bool Wait(Timeout timeout_ticks=WAIT_INFINITE)
Wait for a signal (decrement counter).
void Run() override
Entry point of the user task.
static void InitAll(bool init_state)
static void SwitchOnExclusive(Id led)
static stk::Ticks g_Timeline
static stk::Ticks g_Timeline
static stk::sync::Semaphore g_Sem1(0)
static void SwitchOnLED()
static stk::sync::Semaphore *const g_Sem[LED_MAX]
static stk::sync::Semaphore g_Sem3(0)
static stk::sync::Semaphore g_Sem2(0)
static stk::sync::Semaphore g_Sem0(1)