MINI51DE_BSP V3.02.004
The Board Support Package for Mini51DE Series MCU
gpio.c
Go to the documentation of this file.
1/**************************************************************************/
12#include "Mini51Series.h"
13
14
15
40void GPIO_SetMode(GPIO_T *gpio, uint32_t u32PinMask, uint32_t u32Mode)
41{
42 uint32_t i;
43
44 for (i=0; i<GPIO_PIN_MAX; i++)
45 {
46 if (u32PinMask & (1 << i))
47 {
48 gpio->PMD = (gpio->PMD & ~(0x3 << (i << 1))) | (u32Mode << (i << 1));
49 }
50 }
51}
52
65void GPIO_EnableInt(GPIO_T *gpio, uint32_t u32Pin, uint32_t u32IntAttribs)
66{
67 gpio->IMD |= (((u32IntAttribs >> 24) & 0xFFUL) << u32Pin);
68 gpio->IEN |= ((u32IntAttribs & 0xFFFFFFUL) << u32Pin);
69}
70
71
82void GPIO_DisableInt(GPIO_T *gpio, uint32_t u32Pin)
83{
84 gpio->IMD &= ~(1UL << u32Pin);
85 gpio->IEN &= ~((0x00010001UL) << u32Pin);
86}
87
88
89 /* end of group MINI51_GPIO_EXPORTED_FUNCTIONS */
91 /* end of group MINI51_GPIO_Driver */
93 /* end of group MINI51_Device_Driver */
95
96/*** (C) COPYRIGHT 2013 Nuvoton Technology Corp. ***/
Mini51 series peripheral access layer header file. This file contains all the peripheral register's d...
#define GPIO_PIN_MAX
Definition: gpio.h:32
void GPIO_DisableInt(GPIO_T *gpio, uint32_t u32Pin)
Disable GPIO interrupt.
Definition: gpio.c:82
void GPIO_SetMode(GPIO_T *gpio, uint32_t u32PinMask, uint32_t u32Mode)
Set GPIO operation mode.
Definition: gpio.c:40
void GPIO_EnableInt(GPIO_T *gpio, uint32_t u32Pin, uint32_t u32IntAttribs)
Enable GPIO interrupt.
Definition: gpio.c:65
__IO uint32_t IMD
__IO uint32_t IEN
__IO uint32_t PMD