I'm working with UART device sending and receiving data. I can open the port, send data, receive data, and close the port without a problem. I'm having trouble with ignoring the CR. So I get data like this from the device:
AA BB CC \r>
But what is getting stored is:
>A BB CC
Here is the code snippet I'm working with.
Code: Select all
#include <iostream>
#include <cstdio>
#include <cerrno>
#include <string>
#include <cstdlib>
#include <wiringPi.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
int fd;
char rxData[256];
main
{
fd = open ("/dev/ttyAMA0", O_RDWR | O_NOCTTY | O_NDELAY);
tcgetattr(fd, &options);
options.c_iflag |= IGNCR;
write(fd, sendString , sizeof(sendString));
dealy(1);
read (fd, rxData, sizeof(rxData));
cout << rxData << endl;
Any advice would be appreciated.