Bi-monthly release with minor bug fixes and improvements
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
ioctl(t_fd, TIOCEXCL)
t_fd = open(device, O_RDWR | O_NOCTTY | O_CLOEXEC);
Please Log in or Create an account to join the conversation.
void AuxCommunicator::Connect(int portFD)
{
serialPort = portFD;
}
bool AuxCommunicator::sendPacket(AuxTarget dest, AuxCommand cmd, buffer data)
{
AuxPacket pkt = AuxPacket(cmd, src, dest, data);
buffer txbuff;
pkt.fillBuf(txbuff);
int br;
int tty;
int len = txbuff.size();
char buf[len];
fprintf(stderr, "buff len %x:", len);
for (int i = 0; i < len; i++)
{
buf[i] = txbuff[i];
fprintf(stderr,"%2X ", buf[i]);
}
fprintf(stderr, "\n");
tcflush(serialPort, TCIOFLUSH);
tty = tty_write(serialPort, (const char *)buf, len, &br);
fprintf(stderr, "sendPacket br %x tty %x\n", br, tty);
return tty == TTY_OK;
}
Please Log in or Create an account to join the conversation.
#include <iostream>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
using namespace std;
int main()
{
cout << "Hello World!" << endl;
int fd = open("/dev/ttyACM0", O_RDWR);
if (fd < 0)
{
cout << "open fail " << fd << endl;
return 0;
}
unsigned char outbuf[] = {0x3b, 0x03, 0x22, 0x12, 0xfe, 0xcb};
int ws = write(fd, outbuf, 6);
cout << "written " << ws << endl;
unsigned char inbuf[20];
int rd = read(fd, &inbuf, 10);
cout << "read " << rd << ":";
for(int i = 0; i < rd; i++)
{
fprintf(stdout, " %02X", inbuf[i]);
}
cout << endl;
int cs = close(fd);
cout << "close " << cs << endl;
return 0;
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.