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