Renamed settings to config
This commit is contained in:
22
uart.hpp
22
uart.hpp
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.hpp"
|
||||
#include "hardware0.hpp"
|
||||
#include "hardware1.hpp"
|
||||
#include "settings.hpp"
|
||||
#include "software.hpp"
|
||||
|
||||
#include "../flash/flash.hpp"
|
||||
@@ -18,13 +18,13 @@ struct always_false {
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class Impl>
|
||||
template <class Driver>
|
||||
class uart {
|
||||
public:
|
||||
// Initialization is done upon construction
|
||||
uart()
|
||||
{
|
||||
Impl::init();
|
||||
Driver::init();
|
||||
}
|
||||
|
||||
// Moving and copying uart objects is not supported
|
||||
@@ -33,24 +33,24 @@ class uart {
|
||||
uart &operator=(const uart &) = delete;
|
||||
uart &operator=(uart &&) = delete;
|
||||
|
||||
static void txByte(typename Impl::data_t byte)
|
||||
static void txByte(typename Driver::data_t byte)
|
||||
{
|
||||
Impl::txByte(byte);
|
||||
Driver::txByte(byte);
|
||||
}
|
||||
|
||||
static typename Impl::data_t rxByte()
|
||||
static typename Driver::data_t rxByte()
|
||||
{
|
||||
return Impl::rxByte();
|
||||
return Driver::rxByte();
|
||||
}
|
||||
|
||||
static typename Impl::data_t peek()
|
||||
static typename Driver::data_t peek()
|
||||
{
|
||||
return Impl::peek();
|
||||
return Driver::peek();
|
||||
}
|
||||
|
||||
static void txString(const char *str)
|
||||
{
|
||||
static_assert(Impl::DATA_BITS == DataBits::EIGHT, "Strings are only supported with 8 data bits");
|
||||
static_assert(Driver::DATA_BITS == DataBits::EIGHT, "Strings are only supported with 8 data bits");
|
||||
|
||||
while (char ch = *str++)
|
||||
txByte(ch);
|
||||
@@ -58,7 +58,7 @@ class uart {
|
||||
|
||||
static void txString(const ::detail::FlashString *str)
|
||||
{
|
||||
static_assert(Impl::DATA_BITS == DataBits::EIGHT, "Strings are only supported with 8 data bits");
|
||||
static_assert(Driver::DATA_BITS == DataBits::EIGHT, "Strings are only supported with 8 data bits");
|
||||
|
||||
const char *strIt = reinterpret_cast<const char *>(str);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user