I am using the ring buffers to buffer data from USB-UART ICs that I connected to a USB host and then ESP32. I want to emulate the IDF version of uart calls such as uart_read_bytes(), uart_write_bytes() or uart_get_buffered_data_len(). So in order to make the uart_get_buffered_data_len() I need to know how many bytes are stored in the ring buffer. Can I assume that:
available_bytes_to_read = buffer_size - xRingbufferGetMaxItemSize()
I can probably try it with a sample code but I thought I'd check to make sure this always works, not just with a simple code. Thanks.
Is there a method to get available bytes in a byte ring buffer?
Re: Is there a method to get available bytes in a byte ring buffer?
OK correction:
available_bytes_to_read = buffer_size - xRingbufferGetCurFreeSize()
This works.
available_bytes_to_read = buffer_size - xRingbufferGetCurFreeSize()
This works.
Who is online
Users browsing this forum: Bing [Bot] and 238 guests