M471M/R1/S BSP V3.01.000
The Board Support Package for M4521
gpio.c
Go to the documentation of this file.
1/**************************************************************************/
9#include "NuMicro.h"
10
38void GPIO_SetMode(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode)
39{
40 uint32_t i;
41
42 for(i = 0; i < GPIO_PIN_MAX; i++)
43 {
44 if(u32PinMask & (1 << i))
45 {
46 port->MODE = (port->MODE & ~(0x3 << (i << 1))) | (u32Mode << (i << 1));
47 }
48 }
49}
50
66void GPIO_EnableInt(GPIO_T *port, uint32_t u32Pin, uint32_t u32IntAttribs)
67{
68 port->INTTYPE |= (((u32IntAttribs >> 24) & 0xFFUL) << u32Pin);
69 port->INTEN |= ((u32IntAttribs & 0xFFFFFFUL) << u32Pin);
70}
71
72
86void GPIO_DisableInt(GPIO_T *port, uint32_t u32Pin)
87{
88 port->INTTYPE &= ~(1UL << u32Pin);
89 port->INTEN &= ~((0x00010001UL) << u32Pin);
90}
91
92 /* end of group GPIO_EXPORTED_FUNCTIONS */
94 /* end of group GPIO_Driver */
96 /* end of group Standard_Driver */
98
NuMicro peripheral access layer header file.
#define GPIO_PIN_MAX
Definition: gpio.h:30
void GPIO_EnableInt(GPIO_T *port, uint32_t u32Pin, uint32_t u32IntAttribs)
Enable GPIO interrupt.
Definition: gpio.c:66
void GPIO_DisableInt(GPIO_T *port, uint32_t u32Pin)
Disable GPIO interrupt.
Definition: gpio.c:86
void GPIO_SetMode(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode)
Set GPIO operation mode.
Definition: gpio.c:38
__IO uint32_t MODE
Definition: M471M_R1_S.h:2652
__IO uint32_t INTTYPE
Definition: M471M_R1_S.h:2658
__IO uint32_t INTEN
Definition: M471M_R1_S.h:2659