diff options
author | HampusM <hampus@hampusmat.com> | 2022-02-15 12:33:52 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-02-15 12:33:52 +0100 |
commit | bcdce9633dc351d3bc7f347a165348b8fab87cd9 (patch) | |
tree | 88c2f5d8f0c5fac2bca28e4b543e5209f3bc98fb /src/utils/serial.cpp | |
parent | 917adc6a2b6b166e37fc3d4f94b41488f0c245a5 (diff) |
refactor: reorganize files & improve classes
Diffstat (limited to 'src/utils/serial.cpp')
-rw-r--r-- | src/utils/serial.cpp | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/utils/serial.cpp b/src/utils/serial.cpp deleted file mode 100644 index 8e4194f..0000000 --- a/src/utils/serial.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "serial.hpp" - -#include "general.hpp" - -SerialStream::SerialStream(Serial_ serial, uint64_t baud_rate) : _serial(serial) -{ - this->_serial.begin(baud_rate); - - while (!this->_serial) {} -} - -SerialStream &SerialStream::operator<<(const char *str) -{ - this->write(str); - return *this; -} - -SerialStream &SerialStream::operator<<(const SmartString &str) -{ - this->write(str.c_str); - return *this; -} - -SerialStream &SerialStream::operator<<(const double &num) -{ - this->write(doubleToStr(num)->c_str); - return *this; -} - -SerialStream &SerialStream::operator<<(const int &num) -{ - this->write(intToStr(num)->c_str); - return *this; -} - -SerialStream &SerialStream::operator<<(const unsigned int &num) -{ - this->write(uintToStr(num)->c_str); - return *this; -} - -SerialStream &SerialStream::operator<<(const uint32_t &num) -{ - this->write(uintToStr(num)->c_str); - return *this; -} - -SerialStream &SerialStream::operator<<(void (*manipulator)(SerialStream *)) -{ - manipulator(this); - return *this; -} - -void SerialStream::write(const char *str) -{ - this->_serial.write(str); -} - -void SerialStream::flush() -{ - this->_serial.flush(); -} - -void endl(SerialStream *serial_stream) -{ - serial_stream->write("\n"); - serial_stream->flush(); -} |