Page 1 of 1
Available bytes in serail over USB
Posted: Sun Oct 19, 2014 8:05 pm
by kamil
Is it possible to know amount of available bytes in serail over usb? I can't find appropriate function to do this.
Re: Available bytes in serail over USB
Posted: Sun Oct 19, 2014 8:10 pm
by Giovanni
Hi,
There is no dedicated function but you can check the input queue that is part of the driver structure using chQSpaceI(), it returns the number of bytes in the queue.
In general it is not recommended because after reading the number of bytes it can increase. The alternative is to use read functions with TIME_IMMEDIATE timeout specification, this makes them non-blocking and you can simply read until the queue is empty (if this is your objective).
Giovanni
Re: Available bytes in serail over USB
Posted: Sun Oct 19, 2014 8:22 pm
by kamil
Yes, it is good solution.
Thanks for fast reply!