| MINI55_BSP V3.02.004 The Board Support Package for Mini55 Series MCU

gpio.c
Go to the documentation of this file.
1/**************************************************************************/
12#include "Mini55Series.h"
13
14
15
44 void GPIO_SetMode(GPIO_T *gpio, uint32_t u32PinMask, uint32_t u32Mode)
45{
46 uint32_t i;
47
48 for (i=0; i<GPIO_PIN_MAX; i++)
49 {
50 if (u32PinMask & (1 << i))
51 {
52 gpio->MODE = (gpio->MODE & ~(0x3 << (i << 1))) | (u32Mode << (i << 1));
53 }
54 }
55}
56
73 void GPIO_EnableInt(GPIO_T *gpio, uint32_t u32Pin, uint32_t u32IntAttribs)
74{
75 gpio->INTTYPE |= (((u32IntAttribs >> 24) & 0xFFUL) << u32Pin);
76 gpio->INTEN |= ((u32IntAttribs & 0xFFFFFFUL) << u32Pin);
77}
78
79
90 void GPIO_DisableInt(GPIO_T *gpio, uint32_t u32Pin)
91{
92 gpio->INTTYPE &= ~(1UL << u32Pin);
93 gpio->INTEN &= ~((0x00010001UL) << u32Pin);
94}
95
96
97 /* end of group MINI55_GPIO_EXPORTED_FUNCTIONS */
99 /* end of group MINI55_GPIO_Driver */
101 /* end of group MINI55_Device_Driver */
103
104/*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
Mini55Series.h
Mini55 series peripheral access layer header file. This file contains all the peripheral register's d...
GPIO_PIN_MAX
#define GPIO_PIN_MAX
Definition: gpio.h:32
GPIO_DisableInt
void GPIO_DisableInt(GPIO_T *gpio, uint32_t u32Pin)
Disable GPIO interrupt.
Definition: gpio.c:90
GPIO_SetMode
void GPIO_SetMode(GPIO_T *gpio, uint32_t u32PinMask, uint32_t u32Mode)
Set GPIO operation mode.
Definition: gpio.c:44
GPIO_EnableInt
void GPIO_EnableInt(GPIO_T *gpio, uint32_t u32Pin, uint32_t u32IntAttribs)
Enable GPIO interrupt.
Definition: gpio.c:73
GPIO_T::INTEN
__IO uint32_t INTEN
Definition: Mini55Series.h:1684
GPIO_T::INTTYPE
__IO uint32_t INTTYPE
Definition: Mini55Series.h:1656
GPIO_T::MODE
__IO uint32_t MODE
Definition: Mini55Series.h:1554
GPIO_T
Definition: Mini55Series.h:1479