libftdi Archives

Subject: Checking for available bytes

From: Matthias Nagl <libftdi2009@xxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 17 Jun 2009 22:33:37 +0200
Hello,

I'm using libftdi to communicate with an AVR (via FT232R). To receive bytes 
sent from the µC I am currently polling the FT with repeated calls of 
ftdi_read_data() in a loop. However this method often doesn't notice new bytes 
available before I send something downstream. Another problem is that it 
blocks the calling thread which is also responsible for sending commands (a 
nonblocking read function would be better in my case).

Is there a method to poll for the number of available bytes like FT_GetStatus 
in the official D2XX-Driver? Or is there even an event driven method (I think 
the ideal solution would be a callback-function, that is automatically called 
after a newline has been received). As I don't see any suitable methods I 
assume that this feature is not available in libftdi (yet?). So my question is 
if it is possible / makes sense considering the abilities of the FT hardware.

Regards

Matthias Nagl

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread