LPCOpen Platform
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  * Copyright(C) NXP Semiconductors, 2012
5  * All rights reserved.
6  *
7  * Software that is described herein is for illustrative purposes only
8  * which provides customers with programming information regarding the
9  * LPC products. This software is supplied "AS IS" without any warranties of
10  * any kind, and NXP Semiconductors and its licensor disclaim any and
11  * all warranties, express or implied, including all implied warranties of
12  * merchantability, fitness for a particular purpose and non-infringement of
13  * intellectual property rights. NXP Semiconductors assumes no responsibility
14  * or liability for the use of the software, conveys no license or rights under any
15  * patent, copyright, mask work right, or any other intellectual property rights in
16  * or to any products. NXP Semiconductors reserves the right to make changes
17  * in the software without notification. NXP Semiconductors also makes no
18  * representation or warranty that such application will be suitable for the
19  * specified use without further testing or modification.
20  *
21  * Permission to use, copy, modify, and distribute this software and its
22  * documentation is hereby granted, under NXP Semiconductors' and its
23  * licensor's relevant copyrights in the software, without fee, provided that it
24  * is used in conjunction with NXP Semiconductors microcontrollers. This
25  * copyright, permission, and disclaimer notice must appear in all copies of
26  * this code.
27  */
28 
29 #ifndef __GPIO_18XX_43XX_H_
30 #define __GPIO_18XX_43XX_H_
31 
32 #include "chip.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
48 {
50 }
51 
59 STATIC INLINE void Chip_GPIO_WritePortBit(uint32_t Port, uint8_t Bit, bool Setting)
60 {
61  IP_GPIO_WritePortBit(LPC_GPIO_PORT, Port, Bit, Setting);
62 }
63 
71 STATIC INLINE void Chip_GPIO_WriteDirBit(uint32_t Port, uint8_t Bit, bool Setting)
72 {
73  IP_GPIO_WriteDirBit(LPC_GPIO_PORT, Port, Bit, Setting);
74 }
75 
83 {
84  return IP_GPIO_ReadPortBit(LPC_GPIO_PORT, Port, Bit);
85 }
86 
93 STATIC INLINE bool Chip_GPIO_ReadDirBit(uint32_t Port, uint8_t Bit)
94 {
95  return IP_GPIO_ReadDirBit(LPC_GPIO_PORT, Port, Bit);
96 }
97 
109 STATIC INLINE void Chip_GPIO_IntCmd(uint8_t PortNum, uint8_t BitValue, Gpio_PinInt_Mode_Enum IntMode)
110 {
111  IP_GPIOPININT_IntCmd(LPC_GPIO_PIN_INT, PortNum, IntMode);
112 }
113 
121 STATIC INLINE bool Chip_GPIO_IntGetStatus(uint8_t PortNum, uint8_t PinNum, uint8_t IntMode)
122 {
124 }
125 
132 STATIC INLINE void Chip_GPIO_IntClear(uint8_t PortNum, uint8_t BitValue)
133 {
135 }
136 
144 STATIC INLINE void Chip_GPIOGP_IntInit(IP_GPIOGROUPINT_001_Type *pGPIOGPINT, uint8_t PortComb, uint8_t PortTrigger)
145 {
146  IP_GPIOGP_IntInit(pGPIOGPINT, PortComb, PortTrigger);
147 }
148 
158  uint8_t PortNum,
159  uint8_t PinNum,
160  bool ActiveMode)
161 {
162  IP_GPIOGP_IntPinAdd(pGPIOGPINT, PortNum, PinNum, ActiveMode);
163 }
164 
172 STATIC INLINE void Chip_GPIOGP_IntPinRemove(IP_GPIOGROUPINT_001_Type *pGPIOGPINT, uint8_t PortNum, uint8_t PinNum)
173 {
174  IP_GPIOGP_IntPinRemove(pGPIOGPINT, PortNum, PinNum);
175 }
176 
183 {
184  return IP_GPIOGP_IntGetStatus(pGPIOGPINT);
185 }
186 
193 {
194  IP_GPIOGP_IntClear(pGPIOGPINT);
195 }
196 
205 void Chip_GPIO_SetDir(uint8_t portNum, uint32_t bitValue, uint8_t out);
206 
215 STATIC INLINE void Chip_FIO_SetDir(uint8_t portNum, uint32_t bitValue, uint8_t out)
216 {
217  /* Same with Chip_GPIO_SetDir() */
218  Chip_GPIO_SetDir(portNum, bitValue, out);
219 }
220 
229 STATIC INLINE void Chip_FIO_SetValue(uint8_t portNum, uint32_t bitValue)
230 {
231  /* Same with GPIO_SetValue() */
232  LPC_GPIO_PORT->SET[portNum] = bitValue;
233 }
234 
243 STATIC INLINE void Chip_FIO_ClearValue(uint8_t portNum, uint32_t bitValue)
244 {
245  /* Same with GPIO_ClearValue() */
246  LPC_GPIO_PORT->CLR[portNum] = bitValue;
247 }
248 
257 {
258  /* Same with GPIO_ReadValue() */
259  return LPC_GPIO_PORT->PIN[portNum];
260 }
261 
270 STATIC INLINE void Chip_GPIO_SetValue(uint8_t portNum, uint32_t bitValue)
271 {
272  LPC_GPIO_PORT->SET[portNum] = bitValue;
273 }
274 
283 STATIC INLINE void Chip_GPIO_ClearValue(uint8_t portNum, uint32_t bitValue)
284 {
285  LPC_GPIO_PORT->CLR[portNum] = bitValue;
286 }
287 
296 {
297  return LPC_GPIO_PORT->PIN[portNum];
298 }
299 
304  #ifdef __cplusplus
305 }
306 #endif
307 
308 #endif /* __GPIO_18XX_43XX_H_ */