21.07.2015 Views

Programming Info D2XXPG31.pdf

Programming Info D2XXPG31.pdf

Programming Info D2XXPG31.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

FT-Win32 API Functions845.8 FT_W32_ClearCommErrorGets information about a communications error and get current status of the device.BOOL FT_W32_ClearCommError (FT_HANDLE ftHandle, LPDWORD lpdwErrors,LPFTCOMSTAT lpftComstat)ParametersftHandlelpdwErrorslpftComstatHandle of the device.Variable that contains the error mask.Pointer to FTCOMSTAT structure.Return ValueIf the function is successful, the return value is nonzero.If the function is unsuccessful, the return value is zero.RemarksLinux does not support the W32 API.ExampleThis example shows how to use this function.static COMSTAT oldCS = {0};static DWORD dwOldErrors = 0;FT_HANDLE ftHandle; // setup by FT_W32_CreateFileCOMSTAT newCS;DWORD dwErrors;BOOL bChanged = FALSE;if (!FT_W32_ClearCommError(ftHandle, &dwErrors, (FTCOMSTAT *)&newCS)); // FT_W32_ClearCommError failedif (dwErrors != dwOldErrors) {bChanged = TRUE;dwErrorsOld = dwErrors;}if (memcmp(&oldCS, &newCS, sizeof(FTCOMSTAT))) {bChanged = TRUE;oldCS = newCS;}if (bChanged) {if (dwErrors & CE_BREAK); // BREAK condition detectedif (dwErrors & CE_FRAME); // Framing error detectedif (dwErrors & CE_RXOVER); // Receive buffer has overflowedif (dwErrors & CE_TXFULL); // Transmit buffer fullif (dwErrors & CE_OVERRUN); // Character buffer overrunif (dwErrors & CE_RXPARITY); // Parity error detectedif (newCS.fCtsHold); // Transmitter waiting for CTSif (newCS.fDsrHold)© Future Technology Devices International Ltd. 2005

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!