Hi Daniel,

>> And here's some code that implements such a ring buffer. As David
>> Kelly points out, as long as the index type is uint8_t, then nothing
>> special is required (which for this particular implementation means
>> that buffers upto 128 entries would be supported)
>>
>> <http://websvn.hylands.org/filedetails.php?repname=Projects&path=%2Fcommon%
>>2FCBUF.h&rev=0&sc=0>
>>
>> It's important that the queue be declared volatile (as myQ is in the
>> sample).
>
> And I was just about to ask if someone could post some well tested code! :)

Yes - I use this for all of my UART stuff.

You can find interrupt based UART code which uses CBUF over here:
<http://websvn.hylands.org/filedetails.php?repname=Projects&path=%2Fcommon%2Favr%2FUART.h&rev=0&sc=0>
<http://websvn.hylands.org/filedetails.php?repname=Projects&path=%2Fcommon%2Favr%2FUART.c&rev=0&sc=0>

A typical Config.h (which can be different for each project) looks like this:
<http://websvn.hylands.org/filedetails.php?repname=Projects&path=%2Favr%2FFlash-LED-robostix%2FConfig.h&rev=0&sc=0>

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to