krnl
1
Loading...
Searching...
No Matches
examples
oldexamples
old-may-not_work
ksimple01
ksimple01.ino
Go to the documentation of this file.
1
#include <
krnl.h
>
2
3
struct
k_t
*
p_t1
;
4
5
#define STK_SIZE 200
6
7
char
s1
[
STK_SIZE
];
// stak for t1 ... and t2
8
9
volatile
int
icnt
=0;
10
11
void
doBlink
(
void
) {
12
static
char
flag = 0;
13
14
flag = ! flag;
15
digitalWrite(13,flag);
16
}
17
18
19
void
t1
()
20
{
21
while
(1) {
22
doBlink
();
23
k_sleep
(100);
24
}
25
}
26
27
void
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
40
void
loop
(
void
) {}
// just for compilation - will never be called
41
42
/* QED :-) */
43
44
45
46
s1
unsigned char s1[110]
Definition
k03asleep.ino:25
k_sleep
int k_sleep(int time)
let task sleep for a number of milliseconds
Definition
krnl.c:445
k_crt_task
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
k_init
int k_init(int nrTask, int nrSem, int nrMsg)
Definition
krnl.c:1108
k_start
int k_start()
Definition
krnl.c:1149
krnl.h
STK_SIZE
#define STK_SIZE
Definition
isem.ino:17
p_t1
struct k_t * p_t1
Definition
isem.ino:15
icnt
volatile int icnt
Definition
isem.ino:22
t1
struct k_t * t1
Definition
krnlgen.ino:3
loop
void loop(void)
Definition
ksimple01.ino:40
doBlink
void doBlink(void)
Definition
ksimple01.ino:11
setup
void setup()
Definition
ksimple01.ino:27
t1
void t1()
Definition
ksimple01.ino:19
k_t
Definition
krnl.h:323
Generated by
1.15.0