SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
os.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <timer.h>
Include dependency graph for os.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  task_struct
 
struct  timer_struct
 

Macros

#define TIMER_ALWAYS_RUN   0xFFFFFFFF
 

Typedefs

typedef struct task_struct task_t
 
typedef struct timer_struct timer_t
 

Functions

void timer_create (timer_t *timer, void(*callback)(void *arg, uint32_t event), void *arg)
 Create a timer.
 
void timer_start (timer_t *timer, uint32_t max_run_count, uint32_t interval)
 Start a timer.
 
void timer_handle ()
 Timer processing function, needs to be called continuously in the main loop to achieve normal operation of the timer.
 

Macro Definition Documentation

◆ TIMER_ALWAYS_RUN

#define TIMER_ALWAYS_RUN   0xFFFFFFFF

Typedef Documentation

◆ task_t

typedef struct task_struct task_t

◆ timer_t

typedef struct timer_struct timer_t

Function Documentation

◆ timer_create()

void timer_create ( timer_t timer,
void(*)(void *arg, uint32_t event)  callback,
void *  arg 
)

Create a timer.

Parameters
timerA pointer to a timer_t object to save the newly created timer.
callbackA pointer to the function that will be called when the timer times out.
argA void pointer used to pass arguments to the callback function.

◆ timer_handle()

void timer_handle ( )

Timer processing function, needs to be called continuously in the main loop to achieve normal operation of the timer.

◆ timer_start()

void timer_start ( timer_t timer,
uint32_t  max_run_count,
uint32_t  interval 
)

Start a timer.

Parameters
timerA pointer to an already created timer_t object.
max_run_countThe maximum number of times the timer will run. 0 means it will run indefinitely.
intervalThe time interval of the timer.