2 * @brief GPIO Pin Interrupt Registers and control functions
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * LPC products. This software is supplied "AS IS" without any warranties of
\r
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
13 * all warranties, express or implied, including all implied warranties of
\r
14 * merchantability, fitness for a particular purpose and non-infringement of
\r
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
16 * or liability for the use of the software, conveys no license or rights under any
\r
17 * patent, copyright, mask work right, or any other intellectual property rights in
\r
18 * or to any products. NXP Semiconductors reserves the right to make changes
\r
19 * in the software without notification. NXP Semiconductors also makes no
\r
20 * representation or warranty that such application will be suitable for the
\r
21 * specified use without further testing or modification.
\r
24 * Permission to use, copy, modify, and distribute this software and its
\r
25 * documentation is hereby granted, under NXP Semiconductors' and its
\r
26 * licensor's relevant copyrights in the software, without fee, provided that it
\r
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
28 * copyright, permission, and disclaimer notice must appear in all copies of
\r
32 #ifndef __GPIOPININT_001_H_
\r
33 #define __GPIOPININT_001_H_
\r
35 #include "sys_config.h"
\r
42 /** @defgroup IP_GPIOPININT_001 IP: GPIO Pin Interrupt register block and driver
\r
43 * @ingroup IP_Drivers
\r
48 * @brief GPIO pin interrupt register block structure
\r
50 typedef struct { /*!< GPIO_PIN_INT Structure */
\r
51 __IO uint32_t ISEL; /*!< Pin Interrupt Mode register */
\r
52 __IO uint32_t IENR; /*!< Pin Interrupt Enable (Rising) register */
\r
53 __O uint32_t SIENR; /*!< Set Pin Interrupt Enable (Rising) register */
\r
54 __O uint32_t CIENR; /*!< Clear Pin Interrupt Enable (Rising) register */
\r
55 __IO uint32_t IENF; /*!< Pin Interrupt Enable Falling Edge / Active Level register */
\r
56 __O uint32_t SIENF; /*!< Set Pin Interrupt Enable Falling Edge / Active Level register */
\r
57 __O uint32_t CIENF; /*!< Clear Pin Interrupt Enable Falling Edge / Active Level address */
\r
58 __IO uint32_t RISE; /*!< Pin Interrupt Rising Edge register */
\r
59 __IO uint32_t FALL; /*!< Pin Interrupt Falling Edge register */
\r
60 __IO uint32_t IST; /*!< Pin Interrupt Status register */
\r
61 } IP_GPIOPININT_001_T;
\r
63 typedef enum IP_GPIOPININT_MODE {
\r
64 GPIOPININT_RISING_EDGE = 0x01,
\r
65 GPIOPININT_FALLING_EDGE = 0x02,
\r
66 GPIOPININT_ACTIVE_HIGH_LEVEL = 0x04,
\r
67 GPIOPININT_ACTIVE_LOW_LEVEL = 0x08
\r
68 } IP_GPIOPININT_MODE_T;
\r
71 * @brief Enable GPIO Interrupt
\r
72 * @param pGPIOPININT : Pointer to GPIO interrupt register block
\r
73 * @param PortNum : GPIO port number interrupt
\r
74 * @param IntMode : Interrupt mode, should be:
\r
75 * 0: Rising edge interrupt mode
\r
76 * 1: Falling edge interrupt mode
\r
77 * 2: Active-High interrupt mode
\r
78 * 3: Active-Low interrupt mode
\r
81 void IP_GPIOPININT_IntCmd(IP_GPIOPININT_001_T *pGPIOPININT, uint8_t PortNum, IP_GPIOPININT_MODE_T IntMode);
\r
84 * @brief Get GPIO Interrupt Status
\r
85 * @param pGPIOPININT : Pointer to GPIO interrupt register block
\r
86 * @param PortNum : GPIO port number interrupt
\r
87 * @return true if interrupt is pending, otherwise false
\r
89 STATIC INLINE bool IP_GPIOPININT_IntGetStatus(IP_GPIOPININT_001_T *pGPIOPININT, uint8_t PortNum)
\r
91 return (bool) (((pGPIOPININT->IST) >> PortNum) & 0x01);
\r
95 * @brief Clear GPIO Interrupt (Edge interrupt cases only)
\r
96 * @param pGPIOPININT : Pointer to GPIO interrupt register block
\r
97 * @param PortNum : GPIO port number interrupt
\r
100 STATIC INLINE void IP_GPIOPININT_IntClear(IP_GPIOPININT_001_T *pGPIOPININT, uint8_t PortNum)
\r
102 if (!(pGPIOPININT->ISEL & (1 << PortNum))) {
\r
103 pGPIOPININT->IST |= (1 << PortNum);
\r
115 #endif /* __GPIOPININT_001_H_ */
\r