Changed interface to not initialize uart on construction
This commit is contained in:
parent
778f5f9754
commit
7d4eddbd8b
15
uart.hpp
15
uart.hpp
@ -15,11 +15,10 @@ namespace uart {
|
|||||||
template <class Driver>
|
template <class Driver>
|
||||||
class Uart {
|
class Uart {
|
||||||
public:
|
public:
|
||||||
// Initialization is done upon construction
|
// Constructing a uart object does not initialize the driver to allow different specializations with the same
|
||||||
Uart()
|
// back-end to exists at the same time
|
||||||
{
|
// Note that init must be called every time when switching specializations with the same back-end
|
||||||
Driver::init();
|
Uart() = default;
|
||||||
}
|
|
||||||
|
|
||||||
// Moving and copying uart objects is not supported
|
// Moving and copying uart objects is not supported
|
||||||
Uart(const Uart &) = delete;
|
Uart(const Uart &) = delete;
|
||||||
@ -27,6 +26,12 @@ class Uart {
|
|||||||
Uart &operator=(const Uart &) = delete;
|
Uart &operator=(const Uart &) = delete;
|
||||||
Uart &operator=(Uart &&) = delete;
|
Uart &operator=(Uart &&) = delete;
|
||||||
|
|
||||||
|
// Before using the uart init must be called
|
||||||
|
static void init()
|
||||||
|
{
|
||||||
|
Driver::init();
|
||||||
|
}
|
||||||
|
|
||||||
static void txByte(const typename Driver::data_t &byte)
|
static void txByte(const typename Driver::data_t &byte)
|
||||||
{
|
{
|
||||||
Driver::txByte(byte);
|
Driver::txByte(byte);
|
||||||
|
Loading…
Reference in New Issue
Block a user