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: Stu Bell
Subject: RE: [avr-libc-dev] Wishlist: place static bool in GPIO registers
Date: Wed, 19 Dec 2007 12:20:32 -0700

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) {}

------------------------

Best regards, 

Stu Bell 
DataPlay (DPHI, Inc.) 


-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Shaun Jackman
Sent: Wednesday, December 19, 2007 12:00 PM
To: address@hidden
Subject: [avr-libc-dev] Wishlist: place static bool in GPIO registers

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.

Cheers,
Shaun


_______________________________________________
AVR-libc-dev mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev




reply via email to

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