Tool Libs
UMIT-TIROL Institute of Automation and Control Engineering library collection
 
Loading...
Searching...
No Matches
Kernel Class Reference

simple kernel for running tool-libs based applications More...

#include <kern.h>

Inherits Schedule::Recurring::Registry, and Scheduler.

Collaboration diagram for Kernel:
[legend]

Public Member Functions

void initLog (Sink< Buffer< uint8_t > > &snk)
 point logger to new sink
 
void tick (uint32_t dt_ms)
 call every ms
 
int run ()
 kernel entry point
 
void exit (int code=0)
 stop kernel
 
void idle ()
 implement to not burn unnecessary cpu cycles
 
void setTimeStep (uint16_t dt_us)
 implement in simulation backend to be able to speed up time.
 
void every (uint32_t dt_ms, typename Func::Call func)
 register a function to be called every dt_ms
 
template<typename T >
void every (uint32_t dt_ms, T &base, typename Method< T >::Call method)
 register a method to be called every dt_ms
 
void reset ()
 reset calling times of all registered functions
 
bool schedule (uint32_t time, Schedule::Registry &reg)
 schedule all registered schedulables of registry if necessary
 

Public Attributes

const uint32_t & time {time_}
 const access to global uptime
 

Detailed Description

simple kernel for running tool-libs based applications

also provides logging functionality

Member Function Documentation

◆ idle()

void Kernel::idle ( )

implement to not burn unnecessary cpu cycles

a simple sleep or 'wait for interrupt' will do

if running in a single thread, you probably want to call tick() in this method to advance the time

◆ setTimeStep()

void Kernel::setTimeStep ( uint16_t  dt_us)

implement in simulation backend to be able to speed up time.

takes step size in microseconds. default is 1000

◆ reset()

void Schedule::Recurring::Registry::reset ( )
inlineinherited

reset calling times of all registered functions

this may be necessary when 'global time' jumps backwards e.g. when 'global time' is actually 'experiment time' and the experiment is restarted


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