On Dec 19, 2007 2:39 PM, Stu Bell <[EMAIL PROTECTED]> wrote:
> > The bit-field approach solves my primary complaint by not needing any
> > accessor functions. Both if (my_flag) and my_flag = true; work as
> > expected. As for the declaration, perhaps #define my_flag
> > (GPIOR0_BIT.bit0) would be sufficient, where GPIOR0_BIT is defined
> > by avr-libc as
> >
> > #define GPIOR0_BIT (*(volatile BitRegisterType
> *)_SFR_MEM_ADDR(GPIOR0))
>
> I think you need the pointer dereference (GPIOR0_BIT->bit0) instead of
> the member dereference (GPIOR0_BIT.bit0).  Otherwise, what you suggest
> is a pretty good idea.

I did the pointer dereference in the GPIOR0_BIT macro to match the
usual avr-libc style. GPIOR0, for example, is not a pointer but an
lvalue.

Cheers,
Shaun


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

Reply via email to