Is there a Serial.available() function for xmos uart?
Is there a Serial.available() function for xmos uart?
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?
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.
Code: Select all
uart_rx_client_state rxState;
Code: Select all
rxState.received_bytes
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.