typedef learning notes

Now I am reading the typedef and try to figure out what is going on in the following #define statement.

#define LPC_GPIO1 ((LPC_GPIO_TypeDef   *) LPC_GPIO1_BASE )

.END



typedef struct
  {
  union
    {
    ... // member a
    struct 
      {
      ... // member b
      __IO uint32_t DATA; // Port data Register
 };
  };

  ... // member d
  __IO uint32_t DIR; // Data direction Register
  ... // interrupt member
  ... // interrupt member
  ... // interrupt member
  ... // interrupt member
  ... // interrupt member
  ... // interrupt member
  ... // interrupt member
} LPC_GPIO_TypeDef;


#define LPC_AHB_BASE          (0x50000000UL)

#define LPC_GPIO_BASE         (LPC_AHB_BASE  + 0x00000)

#define LPC_GPIO1             ((LPC_GPIO_TypeDef   *) LPC_GPIO1_BASE )

.END

No comments:

Post a Comment