Skip to content

Commit

Permalink
gps: just use termios on QURT
Browse files Browse the repository at this point in the history
QURT has added support for termios calls a while back that we can now
use.
  • Loading branch information
julianoes committed Apr 13, 2017
1 parent 239370d commit b40f2c5
Showing 1 changed file with 2 additions and 36 deletions.
38 changes: 2 additions & 36 deletions src/drivers/gps/gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@
#endif


#ifndef __PX4_QURT
#include <termios.h>

#ifndef __PX4_QURT
#include <poll.h>
#else
#include <sys/ioctl.h>
#include <dev_fs_lib_serial.h>
#endif


Expand Down Expand Up @@ -476,37 +474,6 @@ bool GPS::injectData(uint8_t *data, size_t len)

int GPS::setBaudrate(unsigned baud)
{

#if __PX4_QURT
// TODO: currently QURT does not support configuration with termios.
dspal_serial_ioctl_data_rate data_rate;

switch (baud) {
case 9600: data_rate.bit_rate = DSPAL_SIO_BITRATE_9600; break;

case 19200: data_rate.bit_rate = DSPAL_SIO_BITRATE_19200; break;

case 38400: data_rate.bit_rate = DSPAL_SIO_BITRATE_38400; break;

case 57600: data_rate.bit_rate = DSPAL_SIO_BITRATE_57600; break;

case 115200: data_rate.bit_rate = DSPAL_SIO_BITRATE_115200; break;

case 230400: data_rate.bit_rate = DSPAL_SIO_BITRATE_230400; break;

default:
PX4_ERR("ERR: unknown baudrate: %d", baud);
return -EINVAL;
}

int ret = ::ioctl(_serial_fd, SERIAL_IOCTL_SET_DATA_RATE, (void *)&data_rate);

if (ret != 0) {

return ret;
}

#else
/* process baud rate */
int speed;

Expand Down Expand Up @@ -586,7 +553,6 @@ int GPS::setBaudrate(unsigned baud)
return -1;
}

#endif
return 0;
}

Expand Down

0 comments on commit b40f2c5

Please sign in to comment.