33 lines
570 B
C++
33 lines
570 B
C++
#pragma once
|
|
|
|
namespace uart {
|
|
|
|
enum class DataBits {
|
|
FIVE,
|
|
SIX,
|
|
SEVEN,
|
|
EIGHT,
|
|
NINE,
|
|
};
|
|
|
|
enum class StopBits {
|
|
ONE,
|
|
TWO,
|
|
};
|
|
|
|
enum class Parity {
|
|
NONE,
|
|
ODD,
|
|
EVEN,
|
|
};
|
|
|
|
template<uint32_t baudRate = 9600, DataBits dataBits = DataBits::EIGHT, Parity parity = Parity::NONE, StopBits stopBits = StopBits::ONE>
|
|
struct Config {
|
|
static constexpr auto BAUD_RATE = baudRate;
|
|
static constexpr auto DATA_BITS = dataBits;
|
|
static constexpr auto PARITY = parity;
|
|
static constexpr auto STOP_BITS = stopBits;
|
|
};
|
|
|
|
} // namespace uart
|