This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Ring buffer or queue for different datatype

Hi,

I want to sample ADC signals and send data when requested via BLE or UART. I set a timer that triggers every 100 ms and gets ADC data.

To store the data, I would like to use some large buffer that will store incoming data. If the buffer reaches end limit and previous data isn't pulled out, it should overwrite the first data and while reading it should start reading from first data (of course not overwritten one) simple: FIFO with first in data replaceable if size full.

I think Ring buffer should solve my issue but the problem is with its data type. The datatype of ADC values is uint16_t while ring buffer has uint8_t so I have to break values in two 8 bytes and store them.

Ring Buffer

Queue library

I read a post about the difference between ring and queue here but it is a general discussion and states both are the same.

Could you please suggest what mechanism shall I use and do I need to modify nrf ring buffer library to support the required data type?

Related