LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
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
47
STATIC
INLINE
void
Chip_GPIO_Init
(
void
)
48
{
49
IP_GPIO_Init
(
LPC_GPIO_PORT
);
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
82
STATIC
INLINE
bool
Chip_GPIO_ReadPortBit
(
uint32_t
Port, uint8_t Bit)
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
{
123
return
IP_GPIOPININT_IntGetStatus
(
LPC_GPIO_PIN_INT
, PortNum);
124
}
125
132
STATIC
INLINE
void
Chip_GPIO_IntClear
(uint8_t PortNum, uint8_t BitValue)
133
{
134
IP_GPIOPININT_IntClear
(
LPC_GPIO_PIN_INT
, PortNum);
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
157
STATIC
INLINE
void
Chip_GPIOGP_IntPinAdd
(
IP_GPIOGROUPINT_001_Type
*pGPIOGPINT,
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
182
STATIC
INLINE
bool
Chip_GPIOGP_IntGetStatus
(
IP_GPIOGROUPINT_001_Type
*pGPIOGPINT)
183
{
184
return
IP_GPIOGP_IntGetStatus
(pGPIOGPINT);
185
}
186
192
STATIC
INLINE
void
Chip_GPIOGP_IntClear
(
IP_GPIOGROUPINT_001_Type
*pGPIOGPINT)
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
256
STATIC
INLINE
uint32_t
Chip_FIO_ReadValue
(uint8_t portNum)
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
295
STATIC
INLINE
uint32_t
Chip_GPIO_ReadValue
(uint8_t portNum)
296
{
297
return
LPC_GPIO_PORT
->PIN[portNum];
298
}
299
304
#ifdef __cplusplus
305
}
306
#endif
307
308
#endif
/* __GPIO_18XX_43XX_H_ */
software
lpc_core
lpc_chip
chip_18xx_43xx
gpio_18xx_43xx.h
Generated on Fri Nov 16 2012 13:36:41 for LPCOpen Platform by
1.8.2