What does {0} mean below?
An array of one zero char? But I don't think you can initialize a larger array with a smaller array, or can you? And it would be int, not char, so would cause at least a warning, right? Or am I misunderstanding it completely? Does this result in buffer's first character being zeroed out?
struct ring_buffer
{
unsigned char buffer[SERIAL_BUFFER_SIZE];
volatile unsigned int head;
volatile unsigned int tail;
};
ring_buffer rx_buffer = { { 0 }, 0, 0 };