Right, StreamBuffers are (fast and lean) single-writer, single-reader queues.
As @kisielk tried to explain the basic idea is to keep ISRs as short as possible and do as much as possible of the (post-)processing in schedulable tasks.
Related to your example I’d follow Kamil”s proposal and only serve the UART interrupt, transfer the received data via StreamBuffer to the vDataQueryTask and do all parsing and further actions there.
1 Like
So I see I was able to get one byte (unless I did something wrong) sent in case of a queue whereas with streams, I am able to get upto the max number of bytes. Is this also one of the reasons behind using streams?
Also, xStreamBufferCreate() takes in xTriggerLevelBytes which indicates the number of bytes received to unblock the task. What if you want keep things dynamic and not fixed to the number of bytes to unlock the task?