| Nano103 BSP V3.01.002 The Board Support Package for Nano103 Series

gpio.c
Go to the documentation of this file.
1 /**************************************************************************/
12 #include "Nano103.h"
13
14
15
40 void 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->MODE = (gpio->MODE & ~(0x3 << (i << 1))) | (u32Mode << (i << 1));
49 }
50 }
51 }
52
65 void GPIO_EnableInt(GPIO_T *gpio, uint32_t u32Pin, uint32_t u32IntAttribs)
66 {
67 gpio->INTTYPE |= (((u32IntAttribs >> 24) & 0xFFUL) << u32Pin);
68 gpio->INTEN |= ((u32IntAttribs & 0xFFFFFFUL) << u32Pin);
69 }
70
71
82 void GPIO_DisableInt(GPIO_T *gpio, uint32_t u32Pin)
83 {
84 gpio->INTTYPE &= ~(1UL << u32Pin);
85 gpio->INTEN &= ~((0x00010001UL) << u32Pin);
86 }
87
88
89 /* end of group NANO103_GPIO_EXPORTED_FUNCTIONS */
91 /* end of group NANO103_GPIO_Driver */
93 /* end of group NANO103_Device_Driver */
95
96 /*** (C) COPYRIGHT 2015 Nuvoton Technology Corp. ***/
GPIO_T
Definition: Nano103.h:5998
GPIO_PIN_MAX
#define GPIO_PIN_MAX
Definition: gpio.h:32
GPIO_T::INTTYPE
__IO uint32_t INTTYPE
Definition: Nano103.h:11770
GPIO_DisableInt
void GPIO_DisableInt(GPIO_T *gpio, uint32_t u32Pin)
Disable GPIO interrupt.
Definition: gpio.c:82
GPIO_SetMode
void GPIO_SetMode(GPIO_T *gpio, uint32_t u32PinMask, uint32_t u32Mode)
Set GPIO operation mode.
Definition: gpio.c:40
GPIO_EnableInt
void GPIO_EnableInt(GPIO_T *gpio, uint32_t u32Pin, uint32_t u32IntAttribs)
Enable GPIO interrupt.
Definition: gpio.c:65
GPIO_T::MODE
__IO uint32_t MODE
Definition: Nano103.h:11764
Nano103.h
NANO103 peripheral access layer header file. This file contains all the peripheral register's definit...
GPIO_T::INTEN
__IO uint32_t INTEN
Definition: Nano103.h:11771