Complete the code to declare the ring buffer size.
volatile char uart_buffer[[1]];The ring buffer size is set to 64 bytes to balance memory and performance.
Complete the code to increment the head index in the ring buffer.
head = (head + [1]) % BUFFER_SIZE;Incrementing by 1 moves the head to the next position in the buffer.
Fix the error in the condition to check if the buffer is full.
if (((head + 1) % BUFFER_SIZE) == [1]) { /* buffer full */ }
The buffer is full when the next head position equals the tail.
Fill both blanks to read a byte from the buffer and update the tail index.
char data = uart_buffer[[1]]; tail = (tail [2] 1) % BUFFER_SIZE;
Read data at tail, then increment tail by 1 wrapping around.
Fill all three blanks to write a byte to the buffer and update the head index safely.
if (((head + 1) % BUFFER_SIZE) != [1]) { uart_buffer[[2]] = data; head = (head [3] 1) % BUFFER_SIZE; }
Check buffer not full by comparing next head to tail, write data at head, then increment head.
