Changed interface to not initialize uart on construction

This commit is contained in:
BlackMark 2019-08-03 11:14:01 +02:00
parent 778f5f9754
commit 7d4eddbd8b

View File

@ -15,11 +15,10 @@ namespace uart {
template <class Driver>
class Uart {
public:
// Initialization is done upon construction
Uart()
{
Driver::init();
}
// Constructing a uart object does not initialize the driver to allow different specializations with the same
// back-end to exists at the same time
// Note that init must be called every time when switching specializations with the same back-end
Uart() = default;
// Moving and copying uart objects is not supported
Uart(const Uart &) = delete;
@ -27,6 +26,12 @@ class Uart {
Uart &operator=(const 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)
{
Driver::txByte(byte);