#include <_stdio.h> #include <alloc.h> #include <osTasks.h> #include <stdint.h> #include <task.h> #include <terminal.h> Task mainTask; Task printerTask; Task *keyboardConsumer = &mainTask; void printLoop() { while (1) { Message *message = popBeginning(&printerTask.messages); if (message == 0) { yield(); continue; } for (uint16_t i = 0; i < message->size; i++) { writeChar(((char *)(message->data))[i]); } free(message->data); free(message); } } void initOSTasks() { setRunningTask(&mainTask); createTask(&printerTask, (uint32_t)printLoop, 0x0, 0x0); } inline Task *getPrinterTask() { return &printerTask; } inline Task *getKeyboardConsumer() { return keyboardConsumer; }