diff options
Diffstat (limited to 'src/utils/serial.hpp')
-rw-r--r-- | src/utils/serial.hpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/utils/serial.hpp b/src/utils/serial.hpp new file mode 100644 index 0000000..f97e1d8 --- /dev/null +++ b/src/utils/serial.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "smart_string.hpp" + +#include <USBAPI.h> + +class SerialStream +{ +public: + SerialStream(Serial_ serial, unsigned long baud_rate); + ~SerialStream(); + + SerialStream &operator<<(const char *str); + SerialStream &operator<<(const SmartString &str); + SerialStream &operator<<(const float num); + + SerialStream &operator<<(void (*manipulator)(SerialStream *)); + + void write(const char *str); + + void flush(); + +private: + Serial_ _serial; +}; + +void endl(SerialStream *serial_stream); |