#include "usart.h" #include #include #include #include #include #include using namespace std::chrono; class Top : public BaseLayer { static constexpr int max = 1024; unsigned tx_cnt, rx_cnt; volatile unsigned index; int passcnt; char buffer [max]; public: explicit Top () : BaseLayer(), tx_cnt(0u), rx_cnt(0u), index(0u), passcnt(0) {} void puts (const char * str) { const unsigned l = strlen(str); tx_cnt += Down(str, l); } uint32_t Up(const char * data, const uint32_t len) override { rx_cnt += len; for (unsigned n=0; n 1) { baud = atoi (argv[1]); } loop = true; signal (SIGINT, Handler); //UsartClass usart ("/dev/ttyACM0", baud); // obecnÄ› UsartClass usart ("/dev/serial/by-id/usb-Kizarm_Labs._USB__=__USART_0002-if00", baud); Top top; top += usart; auto start = high_resolution_clock::now(); while (loop) { top.puts(TestString); } auto stop = high_resolution_clock::now(); usleep(100'000); int duration = duration_cast(stop - start).count(); top.result(duration); return 0; }