Page 1 of 1
Is there a Serial.available() function for xmos uart?
Posted: Mon May 28, 2012 2:00 am
by mifay
I've looked around a little in xmos uart modules and I couldn't find an equivalent to
Arduino's Serial.available() function. Does someone know an equivalent function?
Re: Is there a Serial.available() function for xmos uart?
Posted: Mon May 28, 2012 6:29 am
by rp181
When you use the UART component, you have to pass a reference to a state variable:
This gives you how many bytes has been received:
However, i don't believe that this resets to zero after you read the bytes from the buffer.
I just briefly looked into the code, but you may also want to look in the source files (especially uart_rx_impl) about how the struct buffer_state is used.