krnl 1
Loading...
Searching...
No Matches
ksimple01.ino
Go to the documentation of this file.
1#include <krnl.h>
2
3struct k_t * p_t1;
4
5#define STK_SIZE 200
6
7char s1[STK_SIZE]; // stak for t1 ... and t2
8
9volatile int icnt=0;
10
11void doBlink(void) {
12 static char flag = 0;
13
14 flag = ! flag;
15 digitalWrite(13,flag);
16}
17
18
19void t1()
20{
21 while (1) {
22 doBlink();
23 k_sleep(100);
24 }
25}
26
27void setup() {
28
29 Serial.begin(9600);
30 pinMode(13,OUTPUT);
31
32 k_init(1,0,0); // from now you can crt task,sem etc
33
34 p_t1 = k_crt_task(t1,10,s1,200);
35 Serial.println("just bef");
36 k_start(10); // now we are runnning with timer 10 msev
37 Serial.println("oev");
38}
39
40void loop(void) {} // just for compilation - will never be called
41
42/* QED :-) */
43
44
45
46
unsigned char s1[110]
Definition k03asleep.ino:25
int k_sleep(int time)
let task sleep for a number of milliseconds
Definition krnl.c:445
struct k_t * k_crt_task(void(*pTask)(void), char prio, char *pStk, int stkSize)
create a task - only to be called before k_start creates a task and put it in the active Q
Definition krnl.c:328
int k_init(int nrTask, int nrSem, int nrMsg)
Definition krnl.c:1108
int k_start()
Definition krnl.c:1149
#define STK_SIZE
Definition isem.ino:17
struct k_t * p_t1
Definition isem.ino:15
volatile int icnt
Definition isem.ino:22
struct k_t * t1
Definition krnlgen.ino:3
void loop(void)
Definition ksimple01.ino:40
void doBlink(void)
Definition ksimple01.ino:11
void setup()
Definition ksimple01.ino:27
void t1()
Definition ksimple01.ino:19
Definition krnl.h:323