YAHAL
Yet Another Hardware Abstraction Library
Loading...
Searching...
No Matches
posix_io.h
1/*
2 * stdio.h
3 *
4 * Created on: 13.03.2016
5 * Author: Andreas Terstegge
6 */
7
8#ifndef _POSIX_IO_H_
9#define _POSIX_IO_H_
10
11#include "posix_io_interface.h"
12#include "uart_interface.h"
13
14class posix_io {
15public:
16 // Posix IO is a singleton
17 static posix_io inst;
18
19 void register_stdin (uart_data_interface & uart_in , bool local_echo=true);
20 void register_stdout(uart_data_interface & uart_out, bool add_CR=true);
21 void register_stderr(uart_data_interface & uart_out, bool add_CR=true);
22
23 // Utility method for registering all three
24 // standard IO streams (stdin/out/err)
25 void register_stdio (uart_data_interface & uart, bool local_echo=true, bool add_CR=true);
26
27 void register_fileio(posix_io_interface & file_io);
28
29private:
30 posix_io()
31 : _uart_in(nullptr), _uart_out(nullptr), _uart_err(nullptr),
32 _file_io(nullptr), _local_echo(false),
33 _add_CR_out(false), _add_CR_err(false) {
34 }
35
36public:
37 uart_data_interface * _uart_in;
38 uart_data_interface * _uart_out;
39 uart_data_interface * _uart_err;
40 posix_io_interface * _file_io;
41 bool _local_echo;
42 bool _add_CR_out;
43 bool _add_CR_err;
44};
45
46#endif // _POSIX_IO_H_