Practice / Hardware & Robotics

Ring buffer for UART receive

Medium · Coding (typed)

Bytes arrive by UART interrupt faster than the main loop processes them in bursts. Write a ring buffer in C: the receive ISR adds bytes, the main loop removes them. No locks or disabling interrupts. Explain why it is safe.

Create a free account to answer it and get scored on what a strong answer covers.