Adapted interface to move more often used template parameters to the front

This commit is contained in:
BlackMark 2019-08-05 20:06:42 +02:00
parent c74f1afcac
commit 0354bc3020
2 changed files with 41 additions and 43 deletions

View File

@ -11,7 +11,7 @@
void newUartUsage() void newUartUsage()
{ {
using namespace uart; using namespace uart;
Uart<Hardware1<Mode::ASYNCHRONOUS, Config<115200>, Driven::INTERRUPT>> serial1; Uart<Hardware1<Config<115200>, Driven::INTERRUPT, Mode::ASYNCHRONOUS>> serial1;
serial1.init(); serial1.init();
serial1 << "New uart hi from RAM. " << F("New uart hi from flash\r\n"); serial1 << "New uart hi from RAM. " << F("New uart hi from flash\r\n");
@ -43,7 +43,7 @@ void newUartUsage2()
using namespace uart; using namespace uart;
using config = Config<115200, DataBits::EIGHT, Parity::NONE, StopBits::ONE>; using config = Config<115200, DataBits::EIGHT, Parity::NONE, StopBits::ONE>;
using uart0 = Hardware0<Mode::ASYNCHRONOUS, config, Driven::INTERRUPT>; using uart0 = Hardware0<config, Driven::INTERRUPT, Mode::ASYNCHRONOUS>;
Uart<uart0> serial; Uart<uart0> serial;
serial.init(); serial.init();
@ -56,7 +56,7 @@ void newUartUsage2()
void newUartStreamOverloads() void newUartStreamOverloads()
{ {
using namespace uart; using namespace uart;
Uart<Hardware1<Mode::ASYNCHRONOUS, Config<115200>, Driven::BLOCKING>> serial; Uart<Hardware1<Config<115200>, Driven::BLOCKING, Mode::ASYNCHRONOUS>> serial;
serial.init(); serial.init();
bool bVal = true; bool bVal = true;
@ -109,7 +109,6 @@ void newUartStreamOverloads()
serial.flushTx(); serial.flushTx();
} }
/*
namespace spi { namespace spi {
enum class Cpol { enum class Cpol {
@ -147,7 +146,7 @@ struct spi {
namespace uart { namespace uart {
template <class Config> template <class Config>
class Hardware0<Mode::SPI, Config> { class Hardware0<Config, Driven::INTERRUPT, Mode::SPI> {
public: public:
static void init() static void init()
{ {
@ -180,11 +179,10 @@ class Hardware0<Mode::SPI, Config> {
void spiTest() void spiTest()
{ {
using config = spi::Config<spi::Cpol::MODE_0, spi::Cpha::MODE_0, spi::DataOrder::MSB>; using config = spi::Config<spi::Cpol::MODE_0, spi::Cpha::MODE_0, spi::DataOrder::MSB>;
using uartspi = uart::Hardware0<uart::Mode::SPI, config>; using uartspi = uart::Hardware0<config, uart::Driven::INTERRUPT, uart::Mode::SPI>;
spi::spi<uartspi> uartSpi; spi::spi<uartspi> uartSpi;
} }
*/
static inline void initUart(const uint32_t baudRate) static inline void initUart(const uint32_t baudRate)
{ {
@ -247,7 +245,7 @@ int main()
txString(F("\r\n")); txString(F("\r\n"));
flushTx(); flushTx();
// spiTest(); spiTest();
return 0; return 0;
} }

@ -1 +1 @@
Subproject commit 87e693605143d019f1f6eb7b5ca40d914765c2e0 Subproject commit c4f38cbcdf722c2c41325617066f5910c4a8cfea