Add thread-safe (-ish) console output

This commit is contained in:
Attila Body 2025-06-12 18:19:03 +02:00
parent 7f5ef3de8a
commit 01807f47ab
Signed by: abody
GPG key ID: BD0C6214E68FB5CF
6 changed files with 129 additions and 11 deletions

View file

@ -0,0 +1,23 @@
#pragma once
#include <f4ll/console_handler.h>
#include <FreeRTOS.h>
#include <semphr.h>
class thread_safe_console_output
{
public:
using size_type = f4ll::console_handler::size_type;
thread_safe_console_output(f4ll::console_handler &console);
void print(char const *s);
void flush();
size_type append(char const *s);
private:
f4ll::console_handler &m_con;
SemaphoreHandle_t m_sem;
StaticSemaphore_t m_sem_buf;
};