From 2a07744575613e2f33d79635e071302ba4ec13ee Mon Sep 17 00:00:00 2001 From: BlackMark Date: Sat, 3 Aug 2019 16:11:21 +0200 Subject: [PATCH] Added static_assert for transmitting numbers --- uart.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/uart.hpp b/uart.hpp index 45c1738..594bc83 100644 --- a/uart.hpp +++ b/uart.hpp @@ -107,7 +107,7 @@ class Uart { template static inline void txNumber(const T &val) { - // static_assert(util::is_integral_v, "Only supported on integral types"); + static_assert(util::is_integral_v, "Only supported on integral types"); constexpr size_t numDigits = detail::maxNumDigits(); typename Driver::data_t buffer[numDigits]; @@ -175,10 +175,10 @@ class Uart { return *this; } - template - Uart &operator<<(unsigned int) const + Uart &operator<<(const unsigned int &val) { - static_assert(util::always_false_v, "Not implemented"); + txNumber(val); + return *this; } template @@ -223,10 +223,10 @@ class Uart { static_assert(util::always_false_v, "Not implemented"); } - template - Uart &operator<<(bool) const + Uart &operator<<(const bool &val) { - static_assert(util::always_false_v, "Not implemented"); + txString(val ? F("true") : F("false")); + return *this; } template