avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-libc-dev] Wishlist: place static bool in GPIO registers


From: Weddington, Eric
Subject: RE: [avr-libc-dev] Wishlist: place static bool in GPIO registers
Date: Wed, 19 Dec 2007 13:12:54 -0700

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Stu Bell
> Sent: Wednesday, December 19, 2007 12:21 PM
> To: Shaun Jackman; address@hidden
> Subject: RE: [avr-libc-dev] Wishlist: place static bool in 
> GPIO registers
> 
> This was posted by Cliff Lawson on AVRFreaks.  I've modified it for
> GPIOR0.
> 
> ------------------------
> typedef struct
> {
>   unsigned char bit0:1;
>   unsigned char bit1:1;
>   unsigned char bit2:1;
>   unsigned char bit3:1;
>   unsigned char bit4:1;
>   unsigned char bit5:1;
>   unsigned char bit6:1;
>   unsigned char bit7:1;
> } BitRegisterType;
> 
> #ifndef true
> #define true 1
> #endif
> 
> #ifndef false
> #define false 0
> #
> 
> #define BIT_buffer_status    ((volatile
> BitRegisterType*)_SFR_MEM_ADDR(GPIOR0))->bit0
> #define BIT_recv_error       ((volatile
> BitRegisterType*)_SFR_MEM_ADDR(GPIOR0))->bit1
> #define BIT_active           ((volatile
> BitRegisterType*)_SFR_MEM_ADDR(GPIOR0))->bit2
> #define BIT_use_sample1      ((volatile
> BitRegisterType*)_SFR_MEM_ADDR(GPIOR0))->bit3
> 
> #define BIT_byte_count       ((volatile
> BitRegisterType*)_SFR_MEM_ADDR(GPIOR0))->bit4
> #define BIT_receive_132      ((volatile
> BitRegisterType*)_SFR_MEM_ADDR(GPIOR0))->bit5
> #define BIT_wait_uart_low    ((volatile
> BitRegisterType*)_SFR_MEM_ADDR(GPIOR0))->bit6
> #define BIT_RS232_calibrated ((volatile
> BitRegisterType*)_SFR_MEM_ADDR(GPIOR0))->bit7
> 
> 
> ....
> 
> BIT_receive_132 = 1;
> BIT_recv_error = 0;
> if (BIT_buffer_status == 1) {}
> 

Thanks!

Note that "true" and "false" are already defined in <stdbool.h> and any
implementation should use those definitions.

It would be great if someone could volunteer to help work up a full
implementation... ;-)

I know that nothing will be done with this until 1.6.0 is out and also
after the holidays.

Eric
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]