diff --git a/settings.hpp b/settings.hpp index d646e57..a6575fb 100644 --- a/settings.hpp +++ b/settings.hpp @@ -29,6 +29,20 @@ enum class Parity { EVEN, }; +namespace detail { + +template +struct choose_data_size { + using type = uint8_t; +}; + +template <> +struct choose_data_size { + using type = uint16_t; +}; + +} // namespace detail + template class settings { @@ -37,7 +51,7 @@ class settings { static constexpr auto DATA_BITS = dataBits; static constexpr auto PARITY = parity; static constexpr auto STOP_BITS = stopBits; - using data_t = uint8_t; + using data_t = typename detail::choose_data_size::type; }; } // namespace uart