Add thread-safe (-ish) console output
This commit is contained in:
parent
7f5ef3de8a
commit
01807f47ab
6 changed files with 129 additions and 11 deletions
23
components/app/inc/thread_safe_console_output.h
Normal file
23
components/app/inc/thread_safe_console_output.h
Normal 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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue