samedi 16 décembre 2017

Linux POSIX Serial Write

I am trying to communicate to an xBee module connected to a dev board via a USB(serial) port on my Raspberry Pi. I am running windows 10 and cross compiling (using SysGCC) to Raspbian using eclipse, but I am getting a compile errors of:

no matching function for call to 'Common::ComPortManager::write(int&, const char [5], int)'

and

Invalid arguments 'Candidates are: void write(char *, int) void write(const void *, int)'

Code:

#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>

void ComPortManager::write(char* message, int size)
    {
        int n = write(fd, "ATZ\r", 4);
    }

According to the following site(s), my call to write should not generate a compile error.

http://ift.tt/2omoBo6

http://ift.tt/2hpfoY8

Other potential useful info:

Additional Compile flags -std=c++11 -pthread -c -fmessage-length=0

Aucun commentaire:

Enregistrer un commentaire