1 /***********************************************************************//**
\r
2 * @file : lpc17xx_pinsel.h
\r
3 * @brief : Contains all macro definitions and function prototypes
\r
4 * support for Pin connect block firmware library on LPC17xx
\r
6 * @date : 25. Feb. 2009
\r
8 **************************************************************************
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * products. This software is supplied "AS IS" without any warranties.
\r
12 * NXP Semiconductors assumes no responsibility or liability for the
\r
13 * use of the software, conveys no license or title under any patent,
\r
14 * copyright, or mask work right to the product. NXP Semiconductors
\r
15 * reserves the right to make changes in the software without
\r
16 * notification. NXP Semiconductors also make no representation or
\r
17 * warranty that such application will be suitable for the specified
\r
18 * use without further testing or modification.
\r
19 **************************************************************************/
\r
21 /* Peripheral group ----------------------------------------------------------- */
\r
22 /** @defgroup PINSEL
\r
23 * @ingroup LPC1700CMSIS_FwLib_Drivers
\r
27 #ifndef LPC17XX_PINSEL_H_
\r
28 #define LPC17XX_PINSEL_H_
\r
30 /* Includes ------------------------------------------------------------------- */
\r
31 #include "lpc17xx.h"
\r
32 #include "lpc_types.h"
\r
40 /* Private Macros ------------------------------------------------------------- */
\r
41 /** @defgroup PINSEL_Private_Macros
\r
45 /** @defgroup PINSEL_REGISTER_BIT_DEFINITIONS
\r
49 /* Pin selection define */
\r
50 /* I2C Pin Configuration register bit description */
\r
51 #define PINSEL_I2CPADCFG_SDADRV0 _BIT(0) /**< Drive mode control for the SDA0 pin, P0.27 */
\r
52 #define PINSEL_I2CPADCFG_SDAI2C0 _BIT(1) /**< I2C mode control for the SDA0 pin, P0.27 */
\r
53 #define PINSEL_I2CPADCFG_SCLDRV0 _BIT(2) /**< Drive mode control for the SCL0 pin, P0.28 */
\r
54 #define PINSEL_I2CPADCFG_SCLI2C0 _BIT(3) /**< I2C mode control for the SCL0 pin, P0.28 */
\r
65 /* Public Macros -------------------------------------------------------------- */
\r
66 /** @defgroup PINSEL_Public_Macros
\r
70 /*********************************************************************//**
\r
71 *!< Macros define for PORT Selection
\r
72 ***********************************************************************/
\r
73 #define PINSEL_PORT_0 ((0)) /**< PORT 0*/
\r
74 #define PINSEL_PORT_1 ((1)) /**< PORT 1*/
\r
75 #define PINSEL_PORT_2 ((2)) /**< PORT 2*/
\r
76 #define PINSEL_PORT_3 ((3)) /**< PORT 3*/
\r
77 #define PINSEL_PORT_4 ((4)) /**< PORT 4*/
\r
80 /***********************************************************************
\r
81 * Macros define for Pin Function selection
\r
82 **********************************************************************/
\r
83 #define PINSEL_FUNC_0 ((0)) /**< default function*/
\r
84 #define PINSEL_FUNC_1 ((1)) /**< first alternate function*/
\r
85 #define PINSEL_FUNC_2 ((2)) /**< second alternate function*/
\r
86 #define PINSEL_FUNC_3 ((3)) /**< third or reserved alternate function*/
\r
90 /***********************************************************************
\r
91 * Macros define for Pin Number of Port
\r
92 **********************************************************************/
\r
93 #define PINSEL_PIN_0 ((0)) /**< Pin 0 */
\r
94 #define PINSEL_PIN_1 ((1)) /**< Pin 1 */
\r
95 #define PINSEL_PIN_2 ((2)) /**< Pin 2 */
\r
96 #define PINSEL_PIN_3 ((3)) /**< Pin 3 */
\r
97 #define PINSEL_PIN_4 ((4)) /**< Pin 4 */
\r
98 #define PINSEL_PIN_5 ((5)) /**< Pin 5 */
\r
99 #define PINSEL_PIN_6 ((6)) /**< Pin 6 */
\r
100 #define PINSEL_PIN_7 ((7)) /**< Pin 7 */
\r
101 #define PINSEL_PIN_8 ((8)) /**< Pin 8 */
\r
102 #define PINSEL_PIN_9 ((9)) /**< Pin 9 */
\r
103 #define PINSEL_PIN_10 ((10)) /**< Pin 10 */
\r
104 #define PINSEL_PIN_11 ((11)) /**< Pin 11 */
\r
105 #define PINSEL_PIN_12 ((12)) /**< Pin 12 */
\r
106 #define PINSEL_PIN_13 ((13)) /**< Pin 13 */
\r
107 #define PINSEL_PIN_14 ((14)) /**< Pin 14 */
\r
108 #define PINSEL_PIN_15 ((15)) /**< Pin 15 */
\r
109 #define PINSEL_PIN_16 ((16)) /**< Pin 16 */
\r
110 #define PINSEL_PIN_17 ((17)) /**< Pin 17 */
\r
111 #define PINSEL_PIN_18 ((18)) /**< Pin 18 */
\r
112 #define PINSEL_PIN_19 ((19)) /**< Pin 19 */
\r
113 #define PINSEL_PIN_20 ((20)) /**< Pin 20 */
\r
114 #define PINSEL_PIN_21 ((21)) /**< Pin 21 */
\r
115 #define PINSEL_PIN_22 ((22)) /**< Pin 22 */
\r
116 #define PINSEL_PIN_23 ((23)) /**< Pin 23 */
\r
117 #define PINSEL_PIN_24 ((24)) /**< Pin 24 */
\r
118 #define PINSEL_PIN_25 ((25)) /**< Pin 25 */
\r
119 #define PINSEL_PIN_26 ((26)) /**< Pin 26 */
\r
120 #define PINSEL_PIN_27 ((27)) /**< Pin 27 */
\r
121 #define PINSEL_PIN_28 ((28)) /**< Pin 28 */
\r
122 #define PINSEL_PIN_29 ((29)) /**< Pin 29 */
\r
123 #define PINSEL_PIN_30 ((30)) /**< Pin 30 */
\r
124 #define PINSEL_PIN_31 ((31)) /**< Pin 31 */
\r
127 /***********************************************************************
\r
128 * Macros define for Pin mode
\r
129 **********************************************************************/
\r
130 #define PINSEL_PINMODE_PULLUP ((0)) /**< Internal pull-up resistor*/
\r
131 #define PINSEL_PINMODE_TRISTATE ((2)) /**< Tri-state */
\r
132 #define PINSEL_PINMODE_PULLDOWN ((3)) /**< Internal pull-down resistor */
\r
135 /***********************************************************************
\r
136 * Macros define for Pin mode (normal/open drain)
\r
137 **********************************************************************/
\r
138 #define PINSEL_PINMODE_NORMAL ((0)) /**< Pin is in the normal (not open drain) mode.*/
\r
139 #define PINSEL_PINMODE_OPENDRAIN ((1)) /**< Pin is in the open drain mode */
\r
142 /***********************************************************************
\r
143 * Macros define for I2C mode
\r
144 ***********************************************************************/
\r
145 #define PINSEL_I2C_Normal_Mode ((0)) /**< The standard drive mode */
\r
146 #define PINSEL_I2C_Fast_Mode ((1)) /**< Fast Mode Plus drive mode */
\r
154 /* Public Types --------------------------------------------------------------- */
\r
155 /** @defgroup PINSEL_Public_Types
\r
159 /** @brief Pin configuration structure */
\r
162 uint8_t Portnum; /**< Port Number, should be PINSEL_PORT_x,
\r
163 where x should be in range from 0 to 4 */
\r
164 uint8_t Pinnum; /**< Pin Number, should be PINSEL_PIN_x,
\r
165 where x should be in range from 0 to 31 */
\r
166 uint8_t Funcnum; /**< Function Number, should be PINSEL_FUNC_x,
\r
167 where x should be in range from 0 to 3 */
\r
168 uint8_t Pinmode; /**< Pin Mode, should be:
\r
169 - PINSEL_PINMODE_PULLUP: Internal pull-up resistor
\r
170 - PINSEL_PINMODE_TRISTATE: Tri-state
\r
171 - PINSEL_PINMODE_PULLDOWN: Internal pull-down resistor */
\r
172 uint8_t OpenDrain; /**< OpenDrain mode, should be:
\r
173 - PINSEL_PINMODE_NORMAL: Pin is in the normal (not open drain) mode
\r
174 - PINSEL_PINMODE_OPENDRAIN: Pin is in the open drain mode */
\r
182 /* Public Functions ----------------------------------------------------------- */
\r
183 /** @defgroup PINSEL_Public_Functions
\r
187 void PINSEL_SetPinFunc ( uint8_t portnum, uint8_t pinnum, uint8_t funcnum);
\r
188 void PINSEL_ConfigTraceFunc (FunctionalState NewState);
\r
189 void PINSEL_SetResistorMode ( uint8_t portnum, uint8_t pinnum, uint8_t modenum);
\r
190 void PINSEL_SetOpenDrainMode( uint8_t portnum, uint8_t pinnum, uint8_t modenum);
\r
191 void PINSEL_SetI2C0Pins(uint8_t i2cPinMode, FunctionalState filterSlewRateEnable);
\r
192 void PINSEL_ConfigPin(PINSEL_CFG_Type *PinCfg);
\r
203 #endif /* LPC17XX_PINSEL_H_ */
\r
209 /* --------------------------------- End Of File ------------------------------ */
\r