diff --git a/uart.hpp b/uart.hpp index 2d3e2ce..c7cef43 100644 --- a/uart.hpp +++ b/uart.hpp @@ -15,11 +15,10 @@ namespace uart { template 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);