Implemented overloads for printing numbers

This commit is contained in:
BlackMark 2019-08-03 16:52:57 +02:00
parent fe9e67036e
commit 8d07e2d4db

View File

@ -153,6 +153,12 @@ class Uart {
return *this; return *this;
} }
Uart &operator<<(const signed char &val)
{
txNumber(val);
return *this;
}
Uart &operator<<(const unsigned char &val) Uart &operator<<(const unsigned char &val)
{ {
txNumber(val); txNumber(val);
@ -165,10 +171,10 @@ class Uart {
return *this; return *this;
} }
template <typename... Ts> Uart &operator<<(unsigned short &val)
Uart &operator<<(unsigned short) const
{ {
static_assert(util::always_false_v<Ts...>, "Not implemented"); txNumber(val);
return *this;
} }
Uart &operator<<(const int &val) Uart &operator<<(const int &val)
@ -183,28 +189,28 @@ class Uart {
return *this; return *this;
} }
template <typename... Ts> Uart &operator<<(const long &val)
Uart &operator<<(long) const
{ {
static_assert(util::always_false_v<Ts...>, "Not implemented"); txNumber(val);
return *this;
} }
template <typename... Ts> Uart &operator<<(unsigned long &val)
Uart &operator<<(unsigned long) const
{ {
static_assert(util::always_false_v<Ts...>, "Not implemented"); txNumber(val);
return *this;
} }
template <typename... Ts> Uart &operator<<(long long &val)
Uart &operator<<(long long) const
{ {
static_assert(util::always_false_v<Ts...>, "Not implemented"); txNumber(val);
return *this;
} }
template <typename... Ts> Uart &operator<<(unsigned long long &val)
Uart &operator<<(unsigned long long) const
{ {
static_assert(util::always_false_v<Ts...>, "Not implemented"); txNumber(val);
return *this;
} }
template <typename... Ts> template <typename... Ts>
@ -231,10 +237,10 @@ class Uart {
return *this; return *this;
} }
template <typename... Ts> Uart &operator<<(const void *val)
Uart &operator<<(const void *) const
{ {
static_assert(util::always_false_v<Ts...>, "Not implemented"); txNumber(reinterpret_cast<uint16_t>(val));
return *this;
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////