NilRTOS - A Fast Tiny Preemptive RTOS

pito,

Do you still need the call to analogReference() after changing FifoItem_t?

I really would like to get to the bottom of why you need the analogReference() call. All it does is set the global analog_reference. My experience has been that things like this are a symptom of a nasty bug.

uint8_t analog_reference = DEFAULT;

void analogReference(uint8_t mode)
{
	// can't actually set the register here because the default setting
	// will connect AVCC and the AREF pin, which would cause a short if
	// there's something connected to AREF.
	analog_reference = mode;
}

I have more cases where bit fields work and a lot where they don't. Clearly they are to be avoided.