Moved always_false template to utils
This commit is contained in:
parent
1ca8ea2061
commit
778f5f9754
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
#include "../io/io.hpp"
|
||||
|
||||
@ -8,6 +9,8 @@ namespace uart {
|
||||
|
||||
template <io::P rxPin, io::P txPin, class cfg = Config<>>
|
||||
class Software {
|
||||
static_assert(util::always_false_v<cfg>, "Not implemented");
|
||||
|
||||
public:
|
||||
using data_t = typename cfg::data_t;
|
||||
static constexpr auto DATA_BITS = cfg::DATA_BITS;
|
||||
|
70
uart.hpp
70
uart.hpp
@ -4,6 +4,7 @@
|
||||
#include "hardware0.hpp"
|
||||
#include "hardware1.hpp"
|
||||
#include "software.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
#include "../flash/flash.hpp"
|
||||
|
||||
@ -11,15 +12,6 @@
|
||||
|
||||
namespace uart {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename...>
|
||||
struct always_false {
|
||||
static constexpr auto value = false;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class Driver>
|
||||
class Uart {
|
||||
public:
|
||||
@ -91,91 +83,91 @@ class Uart {
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(char)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(unsigned char)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(short)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(unsigned short)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(int)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(unsigned int)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(long)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(unsigned long)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(long long)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(unsigned long long)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(float)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(double)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(long double)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(bool)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator<<(const void *)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -184,91 +176,91 @@ class Uart {
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(char &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(unsigned char &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(short &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(unsigned short &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(int &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(unsigned int &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(long &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(unsigned long &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(long long &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(unsigned long long &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(float &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(double &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(long double &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(bool &)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
Uart &operator>>(const void *&)
|
||||
{
|
||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||
static_assert(util::always_false_v<Ts...>, "Not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
|
15
utils.hpp
Normal file
15
utils.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
namespace uart {
|
||||
namespace util {
|
||||
|
||||
template <typename...>
|
||||
struct always_false {
|
||||
static constexpr auto value = false;
|
||||
};
|
||||
|
||||
template <typename... Ts>
|
||||
static constexpr auto always_false_v = always_false<Ts...>::value;
|
||||
|
||||
} // namespace util
|
||||
} // namespace uart
|
Loading…
Reference in New Issue
Block a user