Skip to content
Snippets Groups Projects
Commit cf6e979a authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Added a function to set the serial port in low latency mode (mainly for FTDI USB adapters).

parent 5d57ff84
No related branches found
No related tags found
No related merge requests found
Pipeline #16977 passed
......@@ -10,6 +10,7 @@
#include <fcntl.h>
#include <errno.h>
#include <string>
#include <linux/serial.h>
/**
* \brief Available types of parity
......@@ -464,6 +465,7 @@ class CRS232 : public CComm
* current state is inactive (positive voltage).
*/
bool get_control_signal(control_signals signal);
void set_low_latency(void);
/**
* \brief destructor
*
......
......@@ -359,6 +359,24 @@ bool CRS232::get_control_signal(control_signals signal)
return false;
}
void CRS232::set_low_latency(void)
{
struct serial_struct serinfo;
if (ioctl(this->serial_fd, TIOCGSERIAL, &serinfo) < 0)
{
/* handle exception */
throw CRS232Exception(_HERE_,"Impossible to get the port configuration.\n",this->comm_id);
}
serinfo.flags &= ~ASYNC_LOW_LATENCY;
serinfo.flags |= ASYNC_LOW_LATENCY;
if (ioctl(this->serial_fd, TIOCSSERIAL, &serinfo) < 0)
{
/* handle exception */
throw CRS232Exception(_HERE_,"Impossible to set the port configuration.\n",this->comm_id);
}
}
CRS232::~CRS232()
{
this->close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment