On Feb 12, 2006, at 1:21 PM, Rick Mann wrote:

If starting from scratch I usually write something like this:

#define TXCIE0_b  (6)
#define TXCIE0_m  (1<<TXCIE0_b)

Traditionally, Mac OS APIs were written like this, giving both a bit number and a mask value.

That is likely where I picked up the habit.

However, the technique doesn't let you explicitly show which bits you want to be zero.

This loops us back around to Larry's concern about the ! not doing what he expected. OR all the _m's that you want to set to ones, then AND ~TXCIE0_m's to clear.

What I'd really rather have is the entire UART abstracted in a struct with overlapping unions and bitfields. IIRC not all the relevant registers were grouped together, and UART0 and UART1's registers were in wildly different places.

Makes for a terribly huge file and atrocious register names but this is exactly what Motorola/Freescale/Metrowerks did for the HCS12 family.

--
David Kelly N4HHE, [EMAIL PROTECTED]
========================================================================
Whom computers would destroy, they must first drive mad.



_______________________________________________
AVR-chat mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-chat

Reply via email to