gpiogroup_11xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC11xx GPIO group driver for CHIP_LPC11AXX, CHIP_LPC11EXX, and
3  * CHIP_LPC11UXX families only.
4  *
5  * @note
6  * Copyright(C) NXP Semiconductors, 2013
7  * All rights reserved.
8  *
9  * @par
10  * Software that is described herein is for illustrative purposes only
11  * which provides customers with programming information regarding the
12  * LPC products. This software is supplied "AS IS" without any warranties of
13  * any kind, and NXP Semiconductors and its licensor disclaim any and
14  * all warranties, express or implied, including all implied warranties of
15  * merchantability, fitness for a particular purpose and non-infringement of
16  * intellectual property rights. NXP Semiconductors assumes no responsibility
17  * or liability for the use of the software, conveys no license or rights under any
18  * patent, copyright, mask work right, or any other intellectual property rights in
19  * or to any products. NXP Semiconductors reserves the right to make changes
20  * in the software without notification. NXP Semiconductors also makes no
21  * representation or warranty that such application will be suitable for the
22  * specified use without further testing or modification.
23  *
24  * @par
25  * Permission to use, copy, modify, and distribute this software and its
26  * documentation is hereby granted, under NXP Semiconductors' and its
27  * licensor's relevant copyrights in the software, without fee, provided that it
28  * is used in conjunction with NXP Semiconductors microcontrollers. This
29  * copyright, permission, and disclaimer notice must appear in all copies of
30  * this code.
31  */
32 
33 #ifndef __GPIOGROUP_11XX_H_
34 #define __GPIOGROUP_11XX_H_
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
47 #if defined(CHIP_LPC11AXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11UXX)
48 
52 typedef struct {
53  __IO uint32_t CTRL;
54  __I uint32_t RESERVED0[7];
55  __IO uint32_t PORT_POL[8];
56  __IO uint32_t PORT_ENA[8];
57  uint32_t RESERVED1[4072];
58 } LPC_GPIOGROUPINT_T;
59 
63 #define GPIOGR_INT (1 << 0)
64 #define GPIOGR_COMB (1 << 1)
65 #define GPIOGR_TRIG (1 << 2)
73 STATIC INLINE void Chip_GPIOGP_ClearIntStatus(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
74 {
75  uint32_t temp;
76 
77  temp = pGPIOGPINT[group].CTRL;
78  pGPIOGPINT[group].CTRL = temp | GPIOGR_INT;
79 }
80 
87 STATIC INLINE bool Chip_GPIOGP_GetIntStatus(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
88 {
89  return (bool) ((pGPIOGPINT[group].CTRL & GPIOGR_INT) != 0);
90 }
91 
98 STATIC INLINE void Chip_GPIOGP_SelectOrMode(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
99 {
100  pGPIOGPINT[group].CTRL &= ~GPIOGR_COMB;
101 }
102 
109 STATIC INLINE void Chip_GPIOGP_SelectAndMode(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
110 {
111  pGPIOGPINT[group].CTRL |= GPIOGR_COMB;
112 }
113 
120 STATIC INLINE void Chip_GPIOGP_SelectEdgeMode(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
121 {
122  pGPIOGPINT[group].CTRL &= ~GPIOGR_TRIG;
123 }
124 
131 STATIC INLINE void Chip_GPIOGP_SelectLevelMode(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
132 {
133  pGPIOGPINT[group].CTRL |= GPIOGR_TRIG;
134 }
135 
144 STATIC INLINE void Chip_GPIOGP_SelectLowLevel(LPC_GPIOGROUPINT_T *pGPIOGPINT,
145  uint8_t group,
146  uint8_t port,
147  uint32_t pinMask)
148 {
149  pGPIOGPINT[group].PORT_POL[port] &= ~pinMask;
150 }
151 
160 STATIC INLINE void Chip_GPIOGP_SelectHighLevel(LPC_GPIOGROUPINT_T *pGPIOGPINT,
161  uint8_t group,
162  uint8_t port,
163  uint32_t pinMask)
164 {
165  pGPIOGPINT[group].PORT_POL[port] = pinMask;
166 }
167 
177 STATIC INLINE void Chip_GPIOGP_DisableGroupPins(LPC_GPIOGROUPINT_T *pGPIOGPINT,
178  uint8_t group,
179  uint8_t port,
180  uint32_t pinMask)
181 {
182  pGPIOGPINT[group].PORT_ENA[port] &= ~pinMask;
183 }
184 
194 STATIC INLINE void Chip_GPIOGP_EnableGroupPins(LPC_GPIOGROUPINT_T *pGPIOGPINT,
195  uint8_t group,
196  uint8_t port,
197  uint32_t pinMask)
198 {
199  pGPIOGPINT[group].PORT_ENA[port] = pinMask;
200 }
201 
202 #endif /* defined(CHIP_LPC11AXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11UXX) */
203 
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 #endif /* __GPIOGROUP_11XX_H_ */
uavcan::uint32_t
std::uint32_t uint32_t
Definition: std.hpp:26
__IO
#define __IO
Definition: core_cm0.h:154
__I
#define __I
Definition: core_cm0.h:151
INLINE
#define INLINE
Definition: lpc_types.h:205
uavcan::uint8_t
std::uint8_t uint8_t
Definition: std.hpp:24
STATIC
#define STATIC
Definition: lpc_types.h:140


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:02