Easiest way to use FTDI in c++ ??

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi all. I have FTDI chip which is seen as /dev/ttyUSB0
Im connecting with it using putty with no problems but Id like to put
all of this what is putten by my chip into my own application (using
Qt4 and already looking nice).

Now Im getting ewerything by system('cat /dev/ttyUSB0') - but its not
cool. I know that there must be something especially for it. Maybe
some kind of lib or sth.

ps. it works at 115200

Re: Easiest way to use FTDI in c++ ??
Quoted text here. Click to load it

Why not use the "open" command like ....

        fdPort = open( SERIAL_PORT, O_RDWR | O_NOCTTY );
    if (fdPort < 0)
    {
        printf("\nError opening %s - %d %s\n", SERIAL_PORT, errno,
strerror(errno));
        return -1;
    }
    //Save old attributes of the port
    tcgetattr( fdPort, &oldAttr );

    //Configure port with new attributes
    bzero( &newAttr, sizeof( newAttr ));
    newAttr.c_cflag = BAUD_RATE | CS8 | CREAD | CLOCAL ;
    newAttr.c_iflag = IGNPAR;
    newAttr.c_oflag = 0;
    //non-cononical mode
    newAttr.c_lflag = 0;
    //Unused inter ch timer
    newAttr.c_cc[ VTIME ] = 0;
    //No blocking for read chars
    newAttr.c_cc[ VMIN ] = 0;

    tcflush( fdPort, TCIFLUSH );
    tcsetattr( fdPort, TCSANOW, &newAttr );

Site Timeline