#include #include #include #include #include #include #include #include #include #include #include #include #include "uart.hpp" using namespace std; using namespace iflytop; #define UART_NAME "/dev/ttyS0" int main(int argc, char const* argv[]) { Uart uart; uart.open(UART_NAME, "115200"); thread th([&]() { // while (true) { char buf[1024]; memset(buf, 0, 1024); int size = uart.receive(buf, 1024, 10); if (size > 0) { cout << "receive:" << buf << endl; } } }); while (true) { printf("tx hello\n"); uart.send("hello", 5); sleep(1); } }