A Small Cooperative Multitasking Kernel

Dependencies:   mbed

tasks-printf-c.h

Committer:
Ivop
Date:
2011-07-24
Revision:
0:73b89fc74e9f

File content as of revision 0:73b89fc74e9f:

#include "kernel.h"
#include <stdio.h>

static void task_zero(void);
static void task_one(void);

struct ou_task ou_tasks[] = {
    { task_zero, 2, 0, 0, 0, NULL },
    { task_one,  1, 0, 0, 0, NULL }
};

const unsigned ou_ntasks = sizeof(ou_tasks)/sizeof(struct ou_task);

OU_TASK(task_zero)
    OU_WAIT(100);
    printf("hello\r\n");
    OU_WAIT(100);
    printf("world\r\n");
OU_ENDTASK

OU_TASK(task_one)
    OU_WAIT(100);
    printf("goodbye\r\n");
    OU_WAIT(100);
    printf("cruel\r\n");
    OU_WAIT(100);
    printf("world...\r\n");
    for(;;) {
        OU_WAIT(50);
        printf("loop\r\n");
    }
OU_ENDTASK