diff options
author | HampusM <hampus@hampusmat.com> | 2022-02-14 10:11:32 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-02-14 10:11:32 +0100 |
commit | 7892ef9d248c189be68ce7faf63230ec0a318b67 (patch) | |
tree | 7c3d07779d5ce96994f81c0cc22e8b667601ee9d /src/utils/serial.hpp | |
parent | a03dfe959fcafd238119bdf7f27c07b92064496e (diff) |
refactor: reorganize & add debugging
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); |