fix(ring_buffer): fixed pb when write_index comes back to 0
This commit is contained in:
parent
f7246ffcdb
commit
0b394c2c08
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
uint8_t read_entry(struct ring_buffer *buf)
|
uint8_t read_entry(struct ring_buffer *buf)
|
||||||
{
|
{
|
||||||
if (buf->read >= buf->write)
|
if (buf->read == buf->write)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uint8_t data = buf->buffer[buf->read];
|
uint8_t data = buf->buffer[buf->read];
|
||||||
|
Loading…
Reference in New Issue
Block a user