uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lpc17xx_pinsel.h
Go to the documentation of this file.
1 /***********************************************************************/
21 /* Peripheral group ----------------------------------------------------------- */
27 #ifndef LPC17XX_PINSEL_H_
28 #define LPC17XX_PINSEL_H_
29 
30 /* Includes ------------------------------------------------------------------- */
31 #include "LPC17xx.h"
32 #include "lpc_types.h"
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 /* Public Macros -------------------------------------------------------------- */
44 /*********************************************************************/
47 #define PINSEL_PORT_0 ((0))
48 #define PINSEL_PORT_1 ((1))
49 #define PINSEL_PORT_2 ((2))
50 #define PINSEL_PORT_3 ((3))
51 #define PINSEL_PORT_4 ((4))
53 /***********************************************************************
54  * Macros define for Pin Function selection
55  **********************************************************************/
56 #define PINSEL_FUNC_0 ((0))
57 #define PINSEL_FUNC_1 ((1))
58 #define PINSEL_FUNC_2 ((2))
59 #define PINSEL_FUNC_3 ((3))
61 /***********************************************************************
62  * Macros define for Pin Number of Port
63  **********************************************************************/
64 #define PINSEL_PIN_0 ((0))
65 #define PINSEL_PIN_1 ((1))
66 #define PINSEL_PIN_2 ((2))
67 #define PINSEL_PIN_3 ((3))
68 #define PINSEL_PIN_4 ((4))
69 #define PINSEL_PIN_5 ((5))
70 #define PINSEL_PIN_6 ((6))
71 #define PINSEL_PIN_7 ((7))
72 #define PINSEL_PIN_8 ((8))
73 #define PINSEL_PIN_9 ((9))
74 #define PINSEL_PIN_10 ((10))
75 #define PINSEL_PIN_11 ((11))
76 #define PINSEL_PIN_12 ((12))
77 #define PINSEL_PIN_13 ((13))
78 #define PINSEL_PIN_14 ((14))
79 #define PINSEL_PIN_15 ((15))
80 #define PINSEL_PIN_16 ((16))
81 #define PINSEL_PIN_17 ((17))
82 #define PINSEL_PIN_18 ((18))
83 #define PINSEL_PIN_19 ((19))
84 #define PINSEL_PIN_20 ((20))
85 #define PINSEL_PIN_21 ((21))
86 #define PINSEL_PIN_22 ((22))
87 #define PINSEL_PIN_23 ((23))
88 #define PINSEL_PIN_24 ((24))
89 #define PINSEL_PIN_25 ((25))
90 #define PINSEL_PIN_26 ((26))
91 #define PINSEL_PIN_27 ((27))
92 #define PINSEL_PIN_28 ((28))
93 #define PINSEL_PIN_29 ((29))
94 #define PINSEL_PIN_30 ((30))
95 #define PINSEL_PIN_31 ((31))
97 /***********************************************************************
98  * Macros define for Pin mode
99  **********************************************************************/
100 #define PINSEL_PINMODE_PULLUP ((0))
101 #define PINSEL_PINMODE_TRISTATE ((2))
102 #define PINSEL_PINMODE_PULLDOWN ((3))
104 /***********************************************************************
105  * Macros define for Pin mode (normal/open drain)
106  **********************************************************************/
107 #define PINSEL_PINMODE_NORMAL ((0))
108 #define PINSEL_PINMODE_OPENDRAIN ((1))
110 /***********************************************************************
111  * Macros define for I2C mode
112  ***********************************************************************/
113 #define PINSEL_I2C_Normal_Mode ((0))
114 #define PINSEL_I2C_Fast_Mode ((1))
120 /* Private Macros ------------------------------------------------------------- */
121 
125 /* Pin selection define */
126 /* I2C Pin Configuration register bit description */
127 #define PINSEL_I2CPADCFG_SDADRV0 _BIT(0)
128 #define PINSEL_I2CPADCFG_SDAI2C0 _BIT(1)
129 #define PINSEL_I2CPADCFG_SCLDRV0 _BIT(2)
130 #define PINSEL_I2CPADCFG_SCLI2C0 _BIT(3)
137 /* Public Types --------------------------------------------------------------- */
138 
143 typedef struct
144 {
145  uint8_t Portnum;
147  uint8_t Pinnum;
149  uint8_t Funcnum;
151  uint8_t Pinmode;
155  uint8_t OpenDrain;
159 
165 /* Public Functions ----------------------------------------------------------- */
170 void PINSEL_ConfigPin(PINSEL_CFG_Type *PinCfg);
172 void PINSEL_SetI2C0Pins(uint8_t i2cPinMode, FunctionalState filterSlewRateEnable);
173 
174 
180 #ifdef __cplusplus
181 }
182 #endif
183 
184 #endif /* LPC17XX_PINSEL_H_ */
185 
190 /* --------------------------------- End Of File ------------------------------ */
191