On Dec 19, 2007 12:35 PM, Weddington, Eric <[EMAIL PROTECTED]> wrote:
> > The General Purpose I/O Registers (GPIOR0 through GIPOR3) are directly
> > bit-accessible. It would be a very handy feature to be able to place a
> > static bool (or any variable, I suppose) in the GPIO registers.
>
> Hi Shaun,
>
> Could you be more specific? Anyone can use bitwise operators now to
> achieve this. Do you have something different in mind?
>
> Eric

Bit flags in GPIO registers can be accomplished right now using
accessor macros, such as
#define my_flag (GPIOR0 & 0x80)
#define set_my_flag(f) ((f) ? (GPIOR0 |= 0x80) : (GPIOR0 &= ~0x80))

This method works fine, so the functionality does already exist. The
need to use a set_my_flag macro is not ideal though. I'd like to be
able to change only the declaration of static bool my_flag; without
having to change all the code that accesses it. In particular,
changing all the instances of my_flag = true; to set_my_flag(true).

So, my wishlist item is to be able to use an attribute on a static
bool to locate it in the GPIO section, similar to PROGMEM, such as
#define IOMEM __attribute__((__iomem__))
static bool IOMEM my_flag;

I suspect this feature would probably require a fair bit of GCC
hacking for a relatively minor syntactic improvement, but I'd
appreciate it!

Cheers,
Shaun


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

Reply via email to