Skip to content

Commit

Permalink
[nps] define UICLC flag to 0 if not known (e.g. on OSX as the flag is…
Browse files Browse the repository at this point in the history
… not in POSIX)
  • Loading branch information
flixr committed Jun 30, 2012
1 parent 51f53b3 commit 34e8417
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions sw/simulator/nps/nps_radio_control_spektrum.c
Expand Up @@ -10,11 +10,17 @@
#include <errno.h>
#include <inttypes.h>

// IUCLC flag translates upper case to lower case (actually needed here?)
// but is not in POSIX and OSX
#ifndef IUCLC
#define IUCLC 0
#endif

static int sp_fd;

static gboolean on_serial_data_received(GIOChannel *source,
GIOCondition condition,
gpointer data);
GIOCondition condition,
gpointer data);
static void parse_data(char* buf, int len);
static void handle_frame(void);

Expand All @@ -28,7 +34,7 @@ int nps_radio_control_spektrum_init(const char* device) {
struct termios termios;
/* input modes */
termios.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|INPCK|ISTRIP|INLCR|IGNCR
|ICRNL |IUCLC|IXON|IXANY|IXOFF|IMAXBEL);
|ICRNL|IUCLC|IXON|IXANY|IXOFF|IMAXBEL);
termios.c_iflag |= IGNPAR;
/* control modes*/
termios.c_cflag &= ~(CSIZE|PARENB|CRTSCTS|PARODD|HUPCL);
Expand Down Expand Up @@ -57,8 +63,8 @@ int nps_radio_control_spektrum_init(const char* device) {


static gboolean on_serial_data_received(GIOChannel *source,
GIOCondition condition __attribute__ ((unused)),
gpointer data __attribute__ ((unused))) {
GIOCondition condition __attribute__ ((unused)),
gpointer data __attribute__ ((unused))) {
char buf[255];
gsize bytes_read;
GError* _err = NULL;
Expand Down Expand Up @@ -110,7 +116,7 @@ static void parse_data(char* buf, int len) {
idx++;
if (idx == FRAME_LEN) {
status = STA_UNINIT;
handle_frame();
handle_frame();
}
break;
}
Expand Down

0 comments on commit 34e8417

Please sign in to comment.