2019-07-27 18:55:17 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-07-28 12:15:19 +02:00
|
|
|
#include "config.hpp"
|
2019-07-27 18:55:17 +02:00
|
|
|
|
|
|
|
namespace uart {
|
|
|
|
|
2019-07-28 12:15:19 +02:00
|
|
|
enum class Mode {
|
|
|
|
ASYNCHRONOUS,
|
|
|
|
ASYNCHRONOUS_2X,
|
|
|
|
SYNCHRONOUS_MASTER,
|
|
|
|
SYNCHRONOUS_SLAVE,
|
|
|
|
SPI,
|
|
|
|
};
|
|
|
|
|
2019-07-28 14:00:46 +02:00
|
|
|
template <Mode mode, class config>
|
2019-07-27 18:55:17 +02:00
|
|
|
class hardware0 {
|
|
|
|
public:
|
2019-07-28 12:15:19 +02:00
|
|
|
using data_t = typename config::data_t;
|
|
|
|
static constexpr auto DATA_BITS = config::DATA_BITS;
|
2019-07-27 18:55:17 +02:00
|
|
|
|
|
|
|
static void init() {}
|
|
|
|
|
|
|
|
static void txByte(data_t byte)
|
|
|
|
{
|
|
|
|
static_cast<void>(byte);
|
|
|
|
}
|
|
|
|
|
|
|
|
static data_t rxByte() {}
|
|
|
|
|
|
|
|
static data_t peek() {}
|
2019-07-28 12:15:19 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
static constexpr auto BAUD_RATE = config::BAUD_RATE;
|
|
|
|
static constexpr auto PARITY = config::PARITY;
|
|
|
|
static constexpr auto STOP_BITS = config::STOP_BITS;
|
2019-07-27 18:55:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace uart
|