| MINI58_BSP V3.01.003 The Board Support Package for Mini58 Series MCU

gpio.c
Go to the documentation of this file.
1/**************************************************************************/
12#include "Mini58Series.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 Mini58_GPIO_EXPORTED_FUNCTIONS */
99 /* end of group Mini58_GPIO_Driver */
101 /* end of group Mini58_Device_Driver */
103
104/*** (C) COPYRIGHT 2022 Nuvoton Technology Corp. ***/
Mini58Series.h
Mini58 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: Mini58Series.h:2701
GPIO_T::INTTYPE
__IO uint32_t INTTYPE
Definition: Mini58Series.h:2451
GPIO_T::MODE
__IO uint32_t MODE
Definition: Mini58Series.h:1751
GPIO_T
Definition: Mini58Series.h:1604