Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. #ifndef GPIO_H
  2. #define GPIO_H
  3.  
  4. // GPIO - General Purpose Input Output for MD407
  5. typedef struct _gpio
  6. {
  7. unsigned int MODER; // 0x00
  8. union
  9. {
  10. unsigned short OTYPER; // 0x04
  11. struct
  12. {
  13. unsigned char OTYPER_LOW; // 0x04
  14. unsigned char OTYPER_HIGH; // 0x05
  15. };
  16. };
  17. unsigned short OTYPER_RESERVED; // 0x06
  18. union
  19. {
  20. unsigned int OSPEEDR; // 0x08
  21. struct
  22. {
  23. unsigned short OSPEEDR_LOW; // 0x08
  24. unsigned short OSPEEDR_HIGH; // 0x0A
  25. };
  26. };
  27. union
  28. {
  29. unsigned int PUPDR; // 0x0C
  30. struct
  31. {
  32. unsigned short PUPDR_LOW; // 0x0C
  33. unsigned short PUPDR_HIGH; // 0x0E
  34. };
  35. };
  36. union
  37. {
  38. unsigned short IDR; // 0x10
  39. struct
  40. {
  41. unsigned char IDR_LOW; // 0x10
  42. unsigned char IDR_HIGH; // 0x11
  43. };
  44. };
  45. unsigned short IDR_RESERVED; // 0x12
  46. union
  47. {
  48. unsigned short ODR; // 0x14
  49. struct
  50. {
  51. unsigned char ODR_LOW; // 0x14
  52. unsigned char ODR_HIGH; // 0x15
  53. };
  54. };
  55. unsigned short ODR_RESERVED; // 0x16
  56. unsigned int BSSR; // 0x18
  57. unsigned int LCKR; // 0x1C
  58. unsigned int AFRL; // 0x20
  59. unsigned int AFRH; // 0x24
  60. } GPIO;
  61. #define GPIO_A (*((volatile GPIO*) 0x40020000))
  62. #define GPIO_B (*((volatile GPIO*) 0x40020400))
  63. #define GPIO_C (*((volatile GPIO*) 0x40020800))
  64. #define GPIO_D (*((volatile GPIO*) 0x40020C00))
  65. #define GPIO_E (*((volatile GPIO*) 0x40021000))
  66.  
  67. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement