// debug("Task %d not implemented\n", ct);
continue;
}
- //Onshot task
- if(curtask->interval == 0){
- run_task(curtask);
- curtask->used = false;
- //Interrupt task
- } else if(curtask->interval & 32768){
+ //interrupt task
+ if(is_interrupt_task(curtask) && had_interrupt(curtask)){
debug("Interrupt task %d not implemented", ct);
- //Interval task, check if interval is passed
+ run_task(curtask);
+ //Interval task, and interval passed
} else if(cyclestart-curtask->lastrun > curtask->interval){
debug("Running interval task: %d", ct);
run_task(curtask);
+
+ //Oneshot task, thus disable
+ if(curtask->interval == 0){
+ curtask->used = false;
+ }
curtask->lastrun = cyclestart;
}
}
memset(&tasks[ct], 0, sizeof(struct task));
//Read interval
tasks[ct].interval = read16();
+
+ //Interrupt task
+ if(is_interrupt_task(&tasks[ct])) {
+
+ }
+
//Read tasklength
tasks[ct].tlen = read16();
debug("task interval: %d, length: %d\n",
write_byte('\n');
}
+bool is_interrupt_task(struct task *t)
+{
+ return t->interval & (2 <<14);
+}
+
+bool had_interrupt(struct task* t)
+{
+ //Not implemented yet...
+ return false;
+ (void)t;
+}
+
void task_delete(void)
{
uint8_t c = read16();
bool used;
};
+bool is_interrupt_task(struct task* t);
+bool had_interrupt(struct task* t);
+
void task_init(void);
void task_register(void);
void task_delete(void);