libftdi Archives

Subject: How to do this with libftdi ?

From: Rui Barreiros <rui.barreiros@xxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 21 Apr 2011 17:53:54 +0100
Hi there,

I'm trying to implement this original source code from FTDI D2XX lib in libftdi with no success, could anyone give me a pointer on how can I do this ?

     // set RS485 for receive
    FT_W32_EscapeCommFunction(ftHandle,SETRTS);

    FTTIMEOUTS ftTS;
    ftTS.ReadIntervalTimeout = 0;
    ftTS.ReadTotalTimeoutMultiplier = 0;
    ftTS.ReadTotalTimeoutConstant = 1000;
    ftTS.WriteTotalTimeoutMultiplier = 0;
    ftTS.WriteTotalTimeoutConstant = 200;
    FT_W32_SetCommTimeouts(ftHandle,&ftTS);

    DWORD dwMask = EV_ERR;
    FT_W32_SetCommMask(ftHandle,dwMask);
    DWORD dwEvents;

    while (!Terminated) {

        FT_W32_WaitCommEvent(ftHandle, &dwEvents, NULL);


        FT_W32_ClearCommError(ftHandle, &dwErrors, (FTCOMSTAT *)&newCS);

        if (dwErrors != dwOldErrors) {
            bChanged = true;
            dwOldErrors = dwErrors;
        }

        if (bChanged) {
            if ((dwErrors & CE_BREAK) || (dwErrors & CE_FRAME)) {
FT_W32_ReadFile(ftHandle, &temp_StartCode, 1, &bytesWritten, NULL); FT_W32_ReadFile(ftHandle, temp_DMXData, 512, &bytesWritten, NULL);
                Synchronize(UpdateScreen);
            }
        }
        FT_W32_PurgeComm(ftHandle,FT_PURGE_TX | FT_PURGE_RX);

    }

Basically my biggest issue is how to detect the line status error in libftdi.

Best regards,

--
Rui Barreiros
Audioluz - Sérgio Bandeira Unipessoal Lda
Rua Alminhas das Cais, 950
4410-497 SERZEDO VNG
Nif: 506107523


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
Current Thread
  • How to do this with libftdi ?, Rui Barreiros <=