From 8d07e2d4db6f0fafebb00db7993b43b49aee30fc Mon Sep 17 00:00:00 2001 From: BlackMark Date: Sat, 3 Aug 2019 16:52:57 +0200 Subject: [PATCH] Implemented overloads for printing numbers --- uart.hpp | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/uart.hpp b/uart.hpp index 5056259..b87d917 100644 --- a/uart.hpp +++ b/uart.hpp @@ -153,6 +153,12 @@ class Uart { return *this; } + Uart &operator<<(const signed char &val) + { + txNumber(val); + return *this; + } + Uart &operator<<(const unsigned char &val) { txNumber(val); @@ -165,10 +171,10 @@ class Uart { return *this; } - template - Uart &operator<<(unsigned short) const + Uart &operator<<(unsigned short &val) { - static_assert(util::always_false_v, "Not implemented"); + txNumber(val); + return *this; } Uart &operator<<(const int &val) @@ -183,28 +189,28 @@ class Uart { return *this; } - template - Uart &operator<<(long) const + Uart &operator<<(const long &val) { - static_assert(util::always_false_v, "Not implemented"); + txNumber(val); + return *this; } - template - Uart &operator<<(unsigned long) const + Uart &operator<<(unsigned long &val) { - static_assert(util::always_false_v, "Not implemented"); + txNumber(val); + return *this; } - template - Uart &operator<<(long long) const + Uart &operator<<(long long &val) { - static_assert(util::always_false_v, "Not implemented"); + txNumber(val); + return *this; } - template - Uart &operator<<(unsigned long long) const + Uart &operator<<(unsigned long long &val) { - static_assert(util::always_false_v, "Not implemented"); + txNumber(val); + return *this; } template @@ -231,10 +237,10 @@ class Uart { return *this; } - template - Uart &operator<<(const void *) const + Uart &operator<<(const void *val) { - static_assert(util::always_false_v, "Not implemented"); + txNumber(reinterpret_cast(val)); + return *this; } //////////////////////////////////////////////////////////////////////////