Is there a Serial.available() function for xmos uart?

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
Posts: 29
Joined: Wed Dec 28, 2011 4:15 pm

Is there a Serial.available() function for xmos uart?

Postby mifay » Mon May 28, 2012 2:00 am

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?
User avatar
Respected Member
Posts: 395
Joined: Tue May 18, 2010 12:25 am

Postby rp181 » Mon May 28, 2012 6:29 am

When you use the UART component, you have to pass a reference to a state variable:

Code: Select all

uart_rx_client_state rxState;

This gives you how many bytes has been received:

Code: Select all


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.

Return to “Development Tools and Programming”

Who is online

Users browsing this forum: No registered users and 7 guests