Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef GPIO_H
- #define GPIO_H
- // GPIO - General Purpose Input Output for MD407
- typedef struct _gpio
- {
- unsigned int MODER; // 0x00
- union
- {
- unsigned short OTYPER; // 0x04
- struct
- {
- unsigned char OTYPER_LOW; // 0x04
- unsigned char OTYPER_HIGH; // 0x05
- };
- };
- unsigned short OTYPER_RESERVED; // 0x06
- union
- {
- unsigned int OSPEEDR; // 0x08
- struct
- {
- unsigned short OSPEEDR_LOW; // 0x08
- unsigned short OSPEEDR_HIGH; // 0x0A
- };
- };
- union
- {
- unsigned int PUPDR; // 0x0C
- struct
- {
- unsigned short PUPDR_LOW; // 0x0C
- unsigned short PUPDR_HIGH; // 0x0E
- };
- };
- union
- {
- unsigned short IDR; // 0x10
- struct
- {
- unsigned char IDR_LOW; // 0x10
- unsigned char IDR_HIGH; // 0x11
- };
- };
- unsigned short IDR_RESERVED; // 0x12
- union
- {
- unsigned short ODR; // 0x14
- struct
- {
- unsigned char ODR_LOW; // 0x14
- unsigned char ODR_HIGH; // 0x15
- };
- };
- unsigned short ODR_RESERVED; // 0x16
- unsigned int BSSR; // 0x18
- unsigned int LCKR; // 0x1C
- unsigned int AFRL; // 0x20
- unsigned int AFRH; // 0x24
- } GPIO;
- #define GPIO_A (*((volatile GPIO*) 0x40020000))
- #define GPIO_B (*((volatile GPIO*) 0x40020400))
- #define GPIO_C (*((volatile GPIO*) 0x40020800))
- #define GPIO_D (*((volatile GPIO*) 0x40020C00))
- #define GPIO_E (*((volatile GPIO*) 0x40021000))
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement