LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gpio_18xx_43xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC18xx/43xx GPIO driver
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __GPIO_18XX_43XX_H_
33 #define __GPIO_18XX_43XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
50 {
51  IP_GPIO_Init(pGPIO);
52 }
53 
62 STATIC INLINE void Chip_GPIO_WritePortBit(LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit, bool setting)
63 {
64  IP_GPIO_WritePortBit(pGPIO, port, bit, setting);
65 }
66 
75 STATIC INLINE void Chip_GPIO_WriteDirBit(LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit, bool setting)
76 {
77  IP_GPIO_WriteDirBit(pGPIO, port, bit, setting);
78 }
79 
87 STATIC INLINE bool Chip_GPIO_ReadPortBit(LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit)
88 {
89  return IP_GPIO_ReadPortBit(pGPIO, port, bit);
90 }
91 
99 STATIC INLINE bool Chip_GPIO_ReadDirBit(LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit)
100 {
101  return IP_GPIO_ReadDirBit(pGPIO, port, bit);
102 }
103 
116 STATIC INLINE void Chip_GPIO_IntCmd(LPC_GPIOPININT_T* pGPIOPinInt, uint8_t portNum, uint8_t bitValue, IP_GPIOPININT_MODE_T intMode)
117 {
118  IP_GPIOPININT_IntCmd(pGPIOPinInt, portNum, intMode);
119 }
120 
129 STATIC INLINE bool Chip_GPIO_IntGetStatus(LPC_GPIOPININT_T* pGPIOPinInt, uint8_t portNum, uint8_t pinNum, uint8_t intMode)
130 {
131  return IP_GPIOPININT_IntGetStatus(pGPIOPinInt, portNum);
132 }
133 
141 STATIC INLINE void Chip_GPIO_IntClear(LPC_GPIOPININT_T* pGPIOPinInt, uint8_t portNum, uint8_t bitValue)
142 {
143  IP_GPIOPININT_IntClear(pGPIOPinInt, portNum);
144 }
145 
153 STATIC INLINE void Chip_GPIOGP_IntInit(IP_GPIOGROUPINT_001_T *pGPIOGPINT, uint8_t PortComb, uint8_t PortTrigger)
154 {
155  IP_GPIOGP_IntInit(pGPIOGPINT, PortComb, PortTrigger);
156 }
157 
167  uint8_t PortNum,
168  uint8_t PinNum,
169  bool ActiveMode)
170 {
171  IP_GPIOGP_IntPinAdd(pGPIOGPINT, PortNum, PinNum, ActiveMode);
172 }
173 
181 STATIC INLINE void Chip_GPIOGP_IntPinRemove(IP_GPIOGROUPINT_001_T *pGPIOGPINT, uint8_t PortNum, uint8_t PinNum)
182 {
183  IP_GPIOGP_IntPinRemove(pGPIOGPINT, PortNum, PinNum);
184 }
185 
192 {
193  return IP_GPIOGP_IntGetStatus(pGPIOGPINT);
194 }
195 
202 {
203  IP_GPIOGP_IntClear(pGPIOGPINT);
204 }
205 
215 void Chip_GPIO_SetDir(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue, uint8_t out);
216 
226 STATIC INLINE void Chip_FIO_SetDir(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue, uint8_t out)
227 {
228  /* Same with Chip_GPIO_SetDir() */
229  Chip_GPIO_SetDir(pGPIO, portNum, bitValue, out);
230 }
231 
241 STATIC INLINE void Chip_FIO_SetValue(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue)
242 {
243  /* Same with GPIO_SetValue() */
244  pGPIO->SET[portNum] = bitValue;
245 }
246 
256 STATIC INLINE void Chip_FIO_ClearValue(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue)
257 {
258  /* Same with GPIO_ClearValue() */
259  pGPIO->CLR[portNum] = bitValue;
260 }
261 
271 {
272  /* Same with GPIO_ReadValue() */
273  return pGPIO->PIN[portNum];
274 }
275 
285 STATIC INLINE void Chip_GPIO_SetValue(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue)
286 {
287  pGPIO->SET[portNum] = bitValue;
288 }
289 
299 STATIC INLINE void Chip_GPIO_ClearValue(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue)
300 {
301  pGPIO->CLR[portNum] = bitValue;
302 }
303 
313 {
314  return pGPIO->PIN[portNum];
315 }
316 
321 #ifdef __cplusplus
322 }
323 #endif
324 
325 #endif /* __GPIO_18XX_43XX_H_ */