44 lines
701 B
C++
44 lines
701 B
C++
#pragma once
|
|
|
|
namespace uart {
|
|
|
|
enum class Mode {
|
|
ASYNCHRONOUS,
|
|
ASYNCHRONOUS_2X,
|
|
SYNCHRONOUS_MASTER,
|
|
SYNCHRONOUS_SLAVE,
|
|
SPI,
|
|
};
|
|
|
|
enum class DataBits {
|
|
FIVE,
|
|
SIX,
|
|
SEVEN,
|
|
EIGHT,
|
|
NINE,
|
|
};
|
|
|
|
enum class StopBits {
|
|
ONE,
|
|
TWO,
|
|
};
|
|
|
|
enum class Parity {
|
|
NONE,
|
|
ODD,
|
|
EVEN,
|
|
};
|
|
|
|
template <const uint32_t baudRate = 9600, const DataBits dataBits = DataBits::EIGHT, const Parity parity = Parity::NONE,
|
|
const StopBits stopBits = StopBits::ONE>
|
|
class settings {
|
|
public:
|
|
static constexpr auto BAUD_RATE = baudRate;
|
|
static constexpr auto DATA_BITS = dataBits;
|
|
static constexpr auto PARITY = parity;
|
|
static constexpr auto STOP_BITS = stopBits;
|
|
using data_t = uint8_t;
|
|
};
|
|
|
|
} // namespace uart
|