|
|
|
|
@@ -33,8 +33,8 @@ static constexpr size_t cntDigits()
|
|
|
|
|
template <typename T, size_t Base>
|
|
|
|
|
static constexpr size_t maxNumDigits()
|
|
|
|
|
{
|
|
|
|
|
constexpr T MinVal = type::numeric_limits<T>::min();
|
|
|
|
|
constexpr T MaxVal = type::numeric_limits<T>::max();
|
|
|
|
|
constexpr T MinVal = util::numeric_limits<T>::min();
|
|
|
|
|
constexpr T MaxVal = util::numeric_limits<T>::max();
|
|
|
|
|
|
|
|
|
|
constexpr T MinDigits = cntDigits<T, MinVal, Base>();
|
|
|
|
|
constexpr T MaxDigits = cntDigits<T, MaxVal, Base>();
|
|
|
|
|
@@ -112,7 +112,7 @@ class Uart {
|
|
|
|
|
template <typename T, size_t Base = 10, size_t Padding = 0, char PadChar = '0', bool LowerCase = true>
|
|
|
|
|
static void txNumber(const T &val)
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::is_integral_v<T>, "Only supported on integral types");
|
|
|
|
|
static_assert(util::is_integral_v<T>, "Only supported on integral types");
|
|
|
|
|
static_assert(Base >= 2, "Numbers with base less than 2 make no sense");
|
|
|
|
|
static_assert(Base <= 16, "Numbers with base higher than 16 are not supported");
|
|
|
|
|
static_assert(Padding <= detail::maxNumDigits<T, Base>(), "Cannot pad more than maximum length of number");
|
|
|
|
|
@@ -234,19 +234,19 @@ class Uart {
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator<<(float) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator<<(double) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator<<(long double) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Uart &operator<<(const bool &val)
|
|
|
|
|
@@ -268,91 +268,91 @@ class Uart {
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(char &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(unsigned char &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(short &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(unsigned short &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(int &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(unsigned int &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(long &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(unsigned long &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(long long &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(unsigned long long &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(float &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(double &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(long double &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not supported by hardware");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(bool &) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
|
Uart &operator>>(const void *&) const
|
|
|
|
|
{
|
|
|
|
|
static_assert(type::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|