KD
Во втором случае Raspberry Pi -> Mini Pix. Использовались часть файлов из проекта выше, но суть одна — функция open вызывается с РОВНО теми же параметрами
Size: a a a
KD
АС
KD
KD
KD
A
A
KD
KD
KD
if(open(...)!=-1)printf("OK"); — исполняется нормальноopen, в терминале не выводится ОК-g -O0АС
KD
KD
A
KD
sbus_install находится код, который вы можете прочитать по ссылкеA
KD
sbus_err_t sbus_install(int *fd, const char *path, int blocking, uint8_t timeout)
{
*fd = open(path, O_RDWR | O_NOCTTY | (blocking ? 0 : O_NONBLOCK));
if (*fd == -1)
{
return SBUS_ERR_OPEN;
}
struct termios2 options;
if (ioctl(*fd, TCGETS2, &options) != 0)
{
return SBUS_ERR_TCGETS2;
}
options.c_cflag |= PARENB;
options.c_cflag |= CSTOPB;
options.c_cflag |= CS8;
options.c_cflag &= ~CRTSCTS;
options.c_cflag |= CREAD | CLOCAL;
options.c_lflag &= ~ICANON;
options.c_lflag &= ~ECHO;
options.c_lflag &= ~ECHOE;
options.c_lflag &= ~ECHONL;
options.c_lflag &= ~ISIG;
options.c_iflag &= ~(IXON | IXOFF | IXANY);
options.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL);
options.c_oflag &= ~OPOST;
options.c_oflag &= ~ONLCR;
options.c_cc[VTIME] = timeout;
options.c_cc[VMIN] = timeout == 0 ? SBUS_PACKET_SIZE : 0;
options.c_cflag &= ~CBAUD;
options.c_cflag |= BOTHER;
options.c_ispeed = options.c_ospeed = SBUS_BAUD;
if (ioctl(*fd, TCSETS2, &options) != 0)
{
return SBUS_ERR_TCSETS2;
}
return SBUS_OK;
}
A
KD
open