I am learning about microcontrollers and I am having difficulty understanding how one would use a union to set individual bits on a gpio port.
typedef union _BYTE
{
byte _byte;
struct
{
unsigned b0:1;
unsigned b1:1;
unsigned b2:1;
unsigned b3:1;
unsigned b4:1;
unsigned b5:1;
unsigned b6:1;
unsigned b7:1;
}Bit;
} BYTE;
I am using the above to gain access to the individual bits of a byte, but how do I use this to assign a io port values in the following manner?
MCF_GPIO_PORTDD.Bit.b0 = 1;
I would rather not allocate a type of _BYTE and then assign the port to that.
#define MCF_GPIO_PORTDD (*(vuint8 *)(&__IPSBAR[0x100009]))
MCF_GPIO_PORTDD is just a memory address.