Refactored class names to start with capital letter
This commit is contained in:
parent
8e0ba5a463
commit
4a9cee922a
@ -37,7 +37,7 @@ struct choose_data_type<DataBits::NINE> {
|
|||||||
|
|
||||||
template <uint32_t baudRate = 9600, DataBits dataBits = DataBits::EIGHT, Parity parity = Parity::NONE,
|
template <uint32_t baudRate = 9600, DataBits dataBits = DataBits::EIGHT, Parity parity = Parity::NONE,
|
||||||
StopBits stopBits = StopBits::ONE>
|
StopBits stopBits = StopBits::ONE>
|
||||||
struct config {
|
struct Config {
|
||||||
static constexpr auto BAUD_RATE = baudRate;
|
static constexpr auto BAUD_RATE = baudRate;
|
||||||
static constexpr auto DATA_BITS = dataBits;
|
static constexpr auto DATA_BITS = dataBits;
|
||||||
static constexpr auto PARITY = parity;
|
static constexpr auto PARITY = parity;
|
||||||
|
@ -187,8 +187,8 @@ static constexpr auto currentHardware = SupportedHardware::ATmega1284P;
|
|||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <Mode mode = Mode::ASYNCHRONOUS, class cfg = config<>, Driven driven = Driven::INTERRUPT>
|
template <Mode mode = Mode::ASYNCHRONOUS, class cfg = Config<>, Driven driven = Driven::INTERRUPT>
|
||||||
class hardware0 {
|
class Hardware0 {
|
||||||
public:
|
public:
|
||||||
using data_t = typename cfg::data_t;
|
using data_t = typename cfg::data_t;
|
||||||
static constexpr auto DATA_BITS = cfg::DATA_BITS;
|
static constexpr auto DATA_BITS = cfg::DATA_BITS;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
namespace uart {
|
namespace uart {
|
||||||
|
|
||||||
template <io::P rxPin, io::P txPin, class cfg = config<>>
|
template <io::P rxPin, io::P txPin, class cfg = Config<>>
|
||||||
class software {
|
class Software {
|
||||||
public:
|
public:
|
||||||
using data_t = typename cfg::data_t;
|
using data_t = typename cfg::data_t;
|
||||||
static constexpr auto DATA_BITS = cfg::DATA_BITS;
|
static constexpr auto DATA_BITS = cfg::DATA_BITS;
|
||||||
|
76
uart.hpp
76
uart.hpp
@ -21,19 +21,19 @@ struct always_false {
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <class Driver>
|
template <class Driver>
|
||||||
class uart {
|
class Uart {
|
||||||
public:
|
public:
|
||||||
// Initialization is done upon construction
|
// Initialization is done upon construction
|
||||||
uart()
|
Uart()
|
||||||
{
|
{
|
||||||
Driver::init();
|
Driver::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moving and copying uart objects is not supported
|
// Moving and copying uart objects is not supported
|
||||||
uart(const uart &) = delete;
|
Uart(const Uart &) = delete;
|
||||||
uart(uart &&) = delete;
|
Uart(Uart &&) = delete;
|
||||||
uart &operator=(const uart &) = delete;
|
Uart &operator=(const Uart &) = delete;
|
||||||
uart &operator=(uart &&) = delete;
|
Uart &operator=(Uart &&) = delete;
|
||||||
|
|
||||||
static void txByte(typename Driver::data_t byte) FORCE_INLINE
|
static void txByte(typename Driver::data_t byte) FORCE_INLINE
|
||||||
{
|
{
|
||||||
@ -71,104 +71,104 @@ class uart {
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Output stream overloads
|
// Output stream overloads
|
||||||
|
|
||||||
uart &operator<<(const char *str) FORCE_INLINE
|
Uart &operator<<(const char *str) FORCE_INLINE
|
||||||
{
|
{
|
||||||
txString(str);
|
txString(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
uart &operator<<(const ::detail::FlashString *str) FORCE_INLINE
|
Uart &operator<<(const ::detail::FlashString *str) FORCE_INLINE
|
||||||
{
|
{
|
||||||
txString(str);
|
txString(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(char)
|
Uart &operator<<(char)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(unsigned char)
|
Uart &operator<<(unsigned char)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(short)
|
Uart &operator<<(short)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(unsigned short)
|
Uart &operator<<(unsigned short)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(int)
|
Uart &operator<<(int)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(unsigned int)
|
Uart &operator<<(unsigned int)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(long)
|
Uart &operator<<(long)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(unsigned long)
|
Uart &operator<<(unsigned long)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(long long)
|
Uart &operator<<(long long)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(unsigned long long)
|
Uart &operator<<(unsigned long long)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(float)
|
Uart &operator<<(float)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(double)
|
Uart &operator<<(double)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(long double)
|
Uart &operator<<(long double)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(bool)
|
Uart &operator<<(bool)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator<<(const void *)
|
Uart &operator<<(const void *)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
@ -177,91 +177,91 @@ class uart {
|
|||||||
// Input stream overloads
|
// Input stream overloads
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(char &)
|
Uart &operator>>(char &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(unsigned char &)
|
Uart &operator>>(unsigned char &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(short &)
|
Uart &operator>>(short &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(unsigned short &)
|
Uart &operator>>(unsigned short &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(int &)
|
Uart &operator>>(int &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(unsigned int &)
|
Uart &operator>>(unsigned int &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(long &)
|
Uart &operator>>(long &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(unsigned long &)
|
Uart &operator>>(unsigned long &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(long long &)
|
Uart &operator>>(long long &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(unsigned long long &)
|
Uart &operator>>(unsigned long long &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(float &)
|
Uart &operator>>(float &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(double &)
|
Uart &operator>>(double &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(long double &)
|
Uart &operator>>(long double &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(bool &)
|
Uart &operator>>(bool &)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
uart &operator>>(const void *&)
|
Uart &operator>>(const void *&)
|
||||||
{
|
{
|
||||||
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
static_assert(detail::always_false<Ts...>::value, "Not implemented");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user