X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=int%2Ftask.c;h=8fde866a338fd4562cdf9dc9482dbfa665605c30;hb=e09afe083f9077d63a8bd6c27ed8fa5da60430a8;hp=2e0fbb40a41279afec56527e258c83371d3112a6;hpb=7edf1780ae3b91d9136db2d94b25e88d64896645;p=mTask.git diff --git a/int/task.c b/int/task.c index 2e0fbb4..8fde866 100644 --- a/int/task.c +++ b/int/task.c @@ -1,15 +1,22 @@ -#include #include #include + +#ifndef STM #include +#include +#endif -#include "misc.h" #include "task.h" +#include "interface.h" -struct task tasks[MAXTASKS];// = {0}; -uint8_t c; +struct task tasks[MAXTASKS]; -int task_register(int fd) +void task_init(void) +{ + memset(&tasks, 0, sizeof(struct task)*MAXTASKS); +} + +int task_register(void) { uint8_t ct; @@ -17,35 +24,39 @@ int task_register(int fd) if(!tasks[ct].used) break; if(ct == MAXTASKS) - die("Trying to add too much tasks...\n"); + die("Trying to add too much tasks..."); memset(&tasks[ct], 0, sizeof(struct task)); - debug("Interval: "); //Read interval - read16(fd, c, tasks[ct].interval); + tasks[ct].interval = read16(); + debug("interval"); + debugi(tasks[ct].interval); //Read tasklength - debug("Length: "); - read16(fd, c, tasks[ct].tlen); + tasks[ct].tlen = read16(); + debug("length"); + debugi(tasks[ct].tlen); if(tasks[ct].tlen > MAXTASKSIZE) - die("Task is too long: %d\n", tasks[ct].tlen); + die("Task is too long: %d", tasks[ct].tlen); //Read task bytecode - for(int i = 0; i