74 #error "Please define JETSON_DEVICE variable"
76 #if JETSON_DEVICE == 0
77 const char* ttyPath =
"/dev/ttyTHS0";
79 const char* ttyPath =
"/dev/ttyTHS1";
81 speed_t speed = B1000000;
82 tty_fd = open(ttyPath, O_RDWR | O_NOCTTY | O_SYNC);
85 std::cout <<
"ERROR: Could not open tty " << *ttyPath;
90 memset(&tty, 0,
sizeof tty);
94 tty.c_cflag = (CS8 | CLOCAL | CREAD);
99 cfsetospeed(&tty, speed);
100 cfsetispeed(&tty, speed);
102 tcsetattr(
tty_fd, TCSANOW, &tty);
104 tcflush(
tty_fd, TCIOFLUSH);
119 size_t written = write(
tty_fd, pData, len);
124 size_t bytesread = read(
tty_fd, pData, len);