30#define GPIO_PIN_MAX 16
36#define GPIO_MODE_INPUT 0x0UL
37#define GPIO_MODE_OUTPUT 0x1UL
38#define GPIO_MODE_OPEN_DRAIN 0x2UL
39#define GPIO_MODE_QUASI 0x3UL
45#define GPIO_INT_RISING 0x00010000UL
46#define GPIO_INT_FALLING 0x00000001UL
47#define GPIO_INT_BOTH_EDGE 0x00010001UL
48#define GPIO_INT_HIGH 0x01010000UL
49#define GPIO_INT_LOW 0x01000001UL
55#define GPIO_INTTYPE_EDGE 0UL
56#define GPIO_INTTYPE_LEVEL 1UL
62#define GPIO_DBCTL_ICLK_ON 0x00000020UL
63#define GPIO_DBCTL_ICLK_OFF 0x00000000UL
65#define GPIO_DBCTL_DBCLKSRC_LIRC 0x00000010UL
66#define GPIO_DBCTL_DBCLKSRC_HCLK 0x00000000UL
68#define GPIO_DBCTL_DBCLKSEL_1 0x00000000UL
69#define GPIO_DBCTL_DBCLKSEL_2 0x00000001UL
70#define GPIO_DBCTL_DBCLKSEL_4 0x00000002UL
71#define GPIO_DBCTL_DBCLKSEL_8 0x00000003UL
72#define GPIO_DBCTL_DBCLKSEL_16 0x00000004UL
73#define GPIO_DBCTL_DBCLKSEL_32 0x00000005UL
74#define GPIO_DBCTL_DBCLKSEL_64 0x00000006UL
75#define GPIO_DBCTL_DBCLKSEL_128 0x00000007UL
76#define GPIO_DBCTL_DBCLKSEL_256 0x00000008UL
77#define GPIO_DBCTL_DBCLKSEL_512 0x00000009UL
78#define GPIO_DBCTL_DBCLKSEL_1024 0x0000000AUL
79#define GPIO_DBCTL_DBCLKSEL_2048 0x0000000BUL
80#define GPIO_DBCTL_DBCLKSEL_4096 0x0000000CUL
81#define GPIO_DBCTL_DBCLKSEL_8192 0x0000000DUL
82#define GPIO_DBCTL_DBCLKSEL_16384 0x0000000EUL
83#define GPIO_DBCTL_DBCLKSEL_32768 0x0000000FUL
100#define GPIO_PIN_DATA(port, pin) (*((volatile uint32_t *)((GPIO_PIN_DATA_BASE+(0x40*(port))) + ((pin)<<2))))
101#define PA0 GPIO_PIN_DATA(0, 0 )
102#define PA1 GPIO_PIN_DATA(0, 1 )
103#define PA2 GPIO_PIN_DATA(0, 2 )
104#define PA3 GPIO_PIN_DATA(0, 3 )
105#define PB0 GPIO_PIN_DATA(1, 0 )
106#define PB1 GPIO_PIN_DATA(1, 1 )
107#define PB2 GPIO_PIN_DATA(1, 2 )
108#define PB3 GPIO_PIN_DATA(1, 3 )
109#define PB4 GPIO_PIN_DATA(1, 4 )
110#define PB5 GPIO_PIN_DATA(1, 5 )
111#define PB6 GPIO_PIN_DATA(1, 6 )
112#define PB7 GPIO_PIN_DATA(1, 7 )
113#define PB8 GPIO_PIN_DATA(1, 8 )
114#define PB11 GPIO_PIN_DATA(1, 11)
115#define PB12 GPIO_PIN_DATA(1, 12)
116#define PB15 GPIO_PIN_DATA(1, 15)
117#define PC0 GPIO_PIN_DATA(2, 0 )
118#define PC1 GPIO_PIN_DATA(2, 1 )
119#define PC2 GPIO_PIN_DATA(2, 2 )
120#define PC3 GPIO_PIN_DATA(2, 3 )
121#define PC4 GPIO_PIN_DATA(2, 4 )
122#define PC5 GPIO_PIN_DATA(2, 5 )
123#define PC6 GPIO_PIN_DATA(2, 6 )
124#define PC7 GPIO_PIN_DATA(2, 7 )
125#define PD0 GPIO_PIN_DATA(3, 0 )
126#define PD1 GPIO_PIN_DATA(3, 1 )
127#define PD2 GPIO_PIN_DATA(3, 2 )
128#define PD3 GPIO_PIN_DATA(3, 3 )
129#define PD7 GPIO_PIN_DATA(3, 7 )
130#define PD8 GPIO_PIN_DATA(3, 8 )
131#define PD9 GPIO_PIN_DATA(3, 9 )
132#define PD12 GPIO_PIN_DATA(3, 12)
133#define PD13 GPIO_PIN_DATA(3, 13)
134#define PD14 GPIO_PIN_DATA(3, 14)
135#define PD15 GPIO_PIN_DATA(3, 15)
136#define PE0 GPIO_PIN_DATA(4, 0 )
137#define PE8 GPIO_PIN_DATA(4, 8 )
138#define PE9 GPIO_PIN_DATA(4, 9 )
139#define PE10 GPIO_PIN_DATA(4, 10)
140#define PE11 GPIO_PIN_DATA(4, 11)
141#define PE12 GPIO_PIN_DATA(4, 12)
142#define PE13 GPIO_PIN_DATA(4, 13)
143#define PF0 GPIO_PIN_DATA(5, 0 )
144#define PF1 GPIO_PIN_DATA(5, 1 )
145#define PF2 GPIO_PIN_DATA(5, 2 )
146#define PF3 GPIO_PIN_DATA(5, 3 )
147#define PF4 GPIO_PIN_DATA(5, 4 )
148#define PF5 GPIO_PIN_DATA(5, 5 )
149#define PF6 GPIO_PIN_DATA(5, 6 )
150#define PF7 GPIO_PIN_DATA(5, 7 )
173#define GPIO_CLR_INT_FLAG(port, u32PinMask) ((port)->INTSRC = (u32PinMask))
188#define GPIO_DISABLE_DEBOUNCE(port, u32PinMask) ((port)->DBEN &= ~(u32PinMask))
202#define GPIO_ENABLE_DEBOUNCE(port, u32PinMask) ((port)->DBEN |= (u32PinMask))
217#define GPIO_DISABLE_DIGITAL_PATH(port, u32PinMask) ((port)->DINOFF |= ((u32PinMask)<<16))
232#define GPIO_ENABLE_DIGITAL_PATH(port, u32PinMask) ((port)->DINOFF &= ~((u32PinMask)<<16))
247#define GPIO_DISABLE_DOUT_MASK(port, u32PinMask) ((port)->DATMSK &= ~(u32PinMask))
262#define GPIO_ENABLE_DOUT_MASK(port, u32PinMask) ((port)->DATMSK |= (u32PinMask))
278#define GPIO_GET_INT_FLAG(port, u32PinMask) ((port)->INTSRC & (u32PinMask))
310#define GPIO_SET_DEBOUNCE_TIME(u32ClkSrc, u32ClkSel) (GPIO->DBCTL = (GPIO_DBCTL_ICLKON_Msk | (u32ClkSrc) | (u32ClkSel)))
321#define GPIO_GET_IN_DATA(port) ((port)->PIN)
333#define GPIO_SET_OUT_DATA(port, u32Data) ((port)->DOUT = (u32Data))
344#define GPIO_TOGGLE(u32Pin) ((u32Pin) ^= 1)
362#define GPIO_EnableEINT GPIO_EnableInt
377#define GPIO_DisableEINT GPIO_DisableInt
void GPIO_EnableInt(GPIO_T *port, uint32_t u32Pin, uint32_t u32IntAttribs)
Enable GPIO interrupt.
void GPIO_DisableInt(GPIO_T *port, uint32_t u32Pin)
Disable GPIO interrupt.
void GPIO_SetMode(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode)
Set GPIO operation mode.