44 lines
748 B
C++
44 lines
748 B
C++
#pragma once
|
|
|
|
#include "config.hpp"
|
|
|
|
namespace uart {
|
|
|
|
enum class Mode {
|
|
ASYNCHRONOUS,
|
|
ASYNCHRONOUS_2X,
|
|
SYNCHRONOUS_MASTER,
|
|
SYNCHRONOUS_SLAVE,
|
|
SPI,
|
|
};
|
|
|
|
enum class Driven {
|
|
INTERRUPT,
|
|
BLOCKING,
|
|
};
|
|
|
|
template <Mode mode = Mode::ASYNCHRONOUS, class cfg = config<>, Driven driven = Driven::INTERRUPT>
|
|
class hardware0 {
|
|
public:
|
|
using data_t = typename cfg::data_t;
|
|
static constexpr auto DATA_BITS = cfg::DATA_BITS;
|
|
|
|
static void init() {}
|
|
|
|
static void txByte(data_t byte)
|
|
{
|
|
static_cast<void>(byte);
|
|
}
|
|
|
|
static data_t rxByte() {}
|
|
|
|
static data_t peek() {}
|
|
|
|
private:
|
|
static constexpr auto BAUD_RATE = cfg::BAUD_RATE;
|
|
static constexpr auto PARITY = cfg::PARITY;
|
|
static constexpr auto STOP_BITS = cfg::STOP_BITS;
|
|
};
|
|
|
|
} // namespace uart
|