Dependencies:   mbed

Committer:
lynxeyed_atsu
Date:
Fri Jan 21 08:39:48 2011 +0000
Revision:
0:63ed631d8c3a

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lynxeyed_atsu 0:63ed631d8c3a 1 /***********************************************************************//**
lynxeyed_atsu 0:63ed631d8c3a 2 * @file lpc17xx_pinsel.h
lynxeyed_atsu 0:63ed631d8c3a 3 * @brief Contains all macro definitions and function prototypes
lynxeyed_atsu 0:63ed631d8c3a 4 * support for Pin connect block firmware library on LPC17xx
lynxeyed_atsu 0:63ed631d8c3a 5 * @version 2.0
lynxeyed_atsu 0:63ed631d8c3a 6 * @date 21. May. 2010
lynxeyed_atsu 0:63ed631d8c3a 7 * @author NXP MCU SW Application Team
lynxeyed_atsu 0:63ed631d8c3a 8 **************************************************************************
lynxeyed_atsu 0:63ed631d8c3a 9 * Software that is described herein is for illustrative purposes only
lynxeyed_atsu 0:63ed631d8c3a 10 * which provides customers with programming information regarding the
lynxeyed_atsu 0:63ed631d8c3a 11 * products. This software is supplied "AS IS" without any warranties.
lynxeyed_atsu 0:63ed631d8c3a 12 * NXP Semiconductors assumes no responsibility or liability for the
lynxeyed_atsu 0:63ed631d8c3a 13 * use of the software, conveys no license or title under any patent,
lynxeyed_atsu 0:63ed631d8c3a 14 * copyright, or mask work right to the product. NXP Semiconductors
lynxeyed_atsu 0:63ed631d8c3a 15 * reserves the right to make changes in the software without
lynxeyed_atsu 0:63ed631d8c3a 16 * notification. NXP Semiconductors also make no representation or
lynxeyed_atsu 0:63ed631d8c3a 17 * warranty that such application will be suitable for the specified
lynxeyed_atsu 0:63ed631d8c3a 18 * use without further testing or modification.
lynxeyed_atsu 0:63ed631d8c3a 19 **************************************************************************/
lynxeyed_atsu 0:63ed631d8c3a 20
lynxeyed_atsu 0:63ed631d8c3a 21 /* Peripheral group ----------------------------------------------------------- */
lynxeyed_atsu 0:63ed631d8c3a 22 /** @defgroup PINSEL PINSEL
lynxeyed_atsu 0:63ed631d8c3a 23 * @ingroup LPC1700CMSIS_FwLib_Drivers
lynxeyed_atsu 0:63ed631d8c3a 24 * @{
lynxeyed_atsu 0:63ed631d8c3a 25 */
lynxeyed_atsu 0:63ed631d8c3a 26
lynxeyed_atsu 0:63ed631d8c3a 27 #ifndef LPC17XX_PINSEL_H_
lynxeyed_atsu 0:63ed631d8c3a 28 #define LPC17XX_PINSEL_H_
lynxeyed_atsu 0:63ed631d8c3a 29
lynxeyed_atsu 0:63ed631d8c3a 30 /* Includes ------------------------------------------------------------------- */
lynxeyed_atsu 0:63ed631d8c3a 31 #include "LPC17xx.h"
lynxeyed_atsu 0:63ed631d8c3a 32 #include "lpc_types.h"
lynxeyed_atsu 0:63ed631d8c3a 33
lynxeyed_atsu 0:63ed631d8c3a 34 #ifdef __cplusplus
lynxeyed_atsu 0:63ed631d8c3a 35 extern "C"
lynxeyed_atsu 0:63ed631d8c3a 36 {
lynxeyed_atsu 0:63ed631d8c3a 37 #endif
lynxeyed_atsu 0:63ed631d8c3a 38
lynxeyed_atsu 0:63ed631d8c3a 39 /* Public Macros -------------------------------------------------------------- */
lynxeyed_atsu 0:63ed631d8c3a 40 /** @defgroup PINSEL_Public_Macros PINSEL Public Macros
lynxeyed_atsu 0:63ed631d8c3a 41 * @{
lynxeyed_atsu 0:63ed631d8c3a 42 */
lynxeyed_atsu 0:63ed631d8c3a 43
lynxeyed_atsu 0:63ed631d8c3a 44 /*********************************************************************//**
lynxeyed_atsu 0:63ed631d8c3a 45 *!< Macros define for PORT Selection
lynxeyed_atsu 0:63ed631d8c3a 46 ***********************************************************************/
lynxeyed_atsu 0:63ed631d8c3a 47 #define PINSEL_PORT_0 ((0)) /**< PORT 0*/
lynxeyed_atsu 0:63ed631d8c3a 48 #define PINSEL_PORT_1 ((1)) /**< PORT 1*/
lynxeyed_atsu 0:63ed631d8c3a 49 #define PINSEL_PORT_2 ((2)) /**< PORT 2*/
lynxeyed_atsu 0:63ed631d8c3a 50 #define PINSEL_PORT_3 ((3)) /**< PORT 3*/
lynxeyed_atsu 0:63ed631d8c3a 51 #define PINSEL_PORT_4 ((4)) /**< PORT 4*/
lynxeyed_atsu 0:63ed631d8c3a 52
lynxeyed_atsu 0:63ed631d8c3a 53 /***********************************************************************
lynxeyed_atsu 0:63ed631d8c3a 54 * Macros define for Pin Function selection
lynxeyed_atsu 0:63ed631d8c3a 55 **********************************************************************/
lynxeyed_atsu 0:63ed631d8c3a 56 #define PINSEL_FUNC_0 ((0)) /**< default function*/
lynxeyed_atsu 0:63ed631d8c3a 57 #define PINSEL_FUNC_1 ((1)) /**< first alternate function*/
lynxeyed_atsu 0:63ed631d8c3a 58 #define PINSEL_FUNC_2 ((2)) /**< second alternate function*/
lynxeyed_atsu 0:63ed631d8c3a 59 #define PINSEL_FUNC_3 ((3)) /**< third or reserved alternate function*/
lynxeyed_atsu 0:63ed631d8c3a 60
lynxeyed_atsu 0:63ed631d8c3a 61 /***********************************************************************
lynxeyed_atsu 0:63ed631d8c3a 62 * Macros define for Pin Number of Port
lynxeyed_atsu 0:63ed631d8c3a 63 **********************************************************************/
lynxeyed_atsu 0:63ed631d8c3a 64 #define PINSEL_PIN_0 ((0)) /**< Pin 0 */
lynxeyed_atsu 0:63ed631d8c3a 65 #define PINSEL_PIN_1 ((1)) /**< Pin 1 */
lynxeyed_atsu 0:63ed631d8c3a 66 #define PINSEL_PIN_2 ((2)) /**< Pin 2 */
lynxeyed_atsu 0:63ed631d8c3a 67 #define PINSEL_PIN_3 ((3)) /**< Pin 3 */
lynxeyed_atsu 0:63ed631d8c3a 68 #define PINSEL_PIN_4 ((4)) /**< Pin 4 */
lynxeyed_atsu 0:63ed631d8c3a 69 #define PINSEL_PIN_5 ((5)) /**< Pin 5 */
lynxeyed_atsu 0:63ed631d8c3a 70 #define PINSEL_PIN_6 ((6)) /**< Pin 6 */
lynxeyed_atsu 0:63ed631d8c3a 71 #define PINSEL_PIN_7 ((7)) /**< Pin 7 */
lynxeyed_atsu 0:63ed631d8c3a 72 #define PINSEL_PIN_8 ((8)) /**< Pin 8 */
lynxeyed_atsu 0:63ed631d8c3a 73 #define PINSEL_PIN_9 ((9)) /**< Pin 9 */
lynxeyed_atsu 0:63ed631d8c3a 74 #define PINSEL_PIN_10 ((10)) /**< Pin 10 */
lynxeyed_atsu 0:63ed631d8c3a 75 #define PINSEL_PIN_11 ((11)) /**< Pin 11 */
lynxeyed_atsu 0:63ed631d8c3a 76 #define PINSEL_PIN_12 ((12)) /**< Pin 12 */
lynxeyed_atsu 0:63ed631d8c3a 77 #define PINSEL_PIN_13 ((13)) /**< Pin 13 */
lynxeyed_atsu 0:63ed631d8c3a 78 #define PINSEL_PIN_14 ((14)) /**< Pin 14 */
lynxeyed_atsu 0:63ed631d8c3a 79 #define PINSEL_PIN_15 ((15)) /**< Pin 15 */
lynxeyed_atsu 0:63ed631d8c3a 80 #define PINSEL_PIN_16 ((16)) /**< Pin 16 */
lynxeyed_atsu 0:63ed631d8c3a 81 #define PINSEL_PIN_17 ((17)) /**< Pin 17 */
lynxeyed_atsu 0:63ed631d8c3a 82 #define PINSEL_PIN_18 ((18)) /**< Pin 18 */
lynxeyed_atsu 0:63ed631d8c3a 83 #define PINSEL_PIN_19 ((19)) /**< Pin 19 */
lynxeyed_atsu 0:63ed631d8c3a 84 #define PINSEL_PIN_20 ((20)) /**< Pin 20 */
lynxeyed_atsu 0:63ed631d8c3a 85 #define PINSEL_PIN_21 ((21)) /**< Pin 21 */
lynxeyed_atsu 0:63ed631d8c3a 86 #define PINSEL_PIN_22 ((22)) /**< Pin 22 */
lynxeyed_atsu 0:63ed631d8c3a 87 #define PINSEL_PIN_23 ((23)) /**< Pin 23 */
lynxeyed_atsu 0:63ed631d8c3a 88 #define PINSEL_PIN_24 ((24)) /**< Pin 24 */
lynxeyed_atsu 0:63ed631d8c3a 89 #define PINSEL_PIN_25 ((25)) /**< Pin 25 */
lynxeyed_atsu 0:63ed631d8c3a 90 #define PINSEL_PIN_26 ((26)) /**< Pin 26 */
lynxeyed_atsu 0:63ed631d8c3a 91 #define PINSEL_PIN_27 ((27)) /**< Pin 27 */
lynxeyed_atsu 0:63ed631d8c3a 92 #define PINSEL_PIN_28 ((28)) /**< Pin 28 */
lynxeyed_atsu 0:63ed631d8c3a 93 #define PINSEL_PIN_29 ((29)) /**< Pin 29 */
lynxeyed_atsu 0:63ed631d8c3a 94 #define PINSEL_PIN_30 ((30)) /**< Pin 30 */
lynxeyed_atsu 0:63ed631d8c3a 95 #define PINSEL_PIN_31 ((31)) /**< Pin 31 */
lynxeyed_atsu 0:63ed631d8c3a 96
lynxeyed_atsu 0:63ed631d8c3a 97 /***********************************************************************
lynxeyed_atsu 0:63ed631d8c3a 98 * Macros define for Pin mode
lynxeyed_atsu 0:63ed631d8c3a 99 **********************************************************************/
lynxeyed_atsu 0:63ed631d8c3a 100 #define PINSEL_PINMODE_PULLUP ((0)) /**< Internal pull-up resistor*/
lynxeyed_atsu 0:63ed631d8c3a 101 #define PINSEL_PINMODE_TRISTATE ((2)) /**< Tri-state */
lynxeyed_atsu 0:63ed631d8c3a 102 #define PINSEL_PINMODE_PULLDOWN ((3)) /**< Internal pull-down resistor */
lynxeyed_atsu 0:63ed631d8c3a 103
lynxeyed_atsu 0:63ed631d8c3a 104 /***********************************************************************
lynxeyed_atsu 0:63ed631d8c3a 105 * Macros define for Pin mode (normal/open drain)
lynxeyed_atsu 0:63ed631d8c3a 106 **********************************************************************/
lynxeyed_atsu 0:63ed631d8c3a 107 #define PINSEL_PINMODE_NORMAL ((0)) /**< Pin is in the normal (not open drain) mode.*/
lynxeyed_atsu 0:63ed631d8c3a 108 #define PINSEL_PINMODE_OPENDRAIN ((1)) /**< Pin is in the open drain mode */
lynxeyed_atsu 0:63ed631d8c3a 109
lynxeyed_atsu 0:63ed631d8c3a 110 /***********************************************************************
lynxeyed_atsu 0:63ed631d8c3a 111 * Macros define for I2C mode
lynxeyed_atsu 0:63ed631d8c3a 112 ***********************************************************************/
lynxeyed_atsu 0:63ed631d8c3a 113 #define PINSEL_I2C_Normal_Mode ((0)) /**< The standard drive mode */
lynxeyed_atsu 0:63ed631d8c3a 114 #define PINSEL_I2C_Fast_Mode ((1)) /**< Fast Mode Plus drive mode */
lynxeyed_atsu 0:63ed631d8c3a 115
lynxeyed_atsu 0:63ed631d8c3a 116 /**
lynxeyed_atsu 0:63ed631d8c3a 117 * @}
lynxeyed_atsu 0:63ed631d8c3a 118 */
lynxeyed_atsu 0:63ed631d8c3a 119
lynxeyed_atsu 0:63ed631d8c3a 120 /* Private Macros ------------------------------------------------------------- */
lynxeyed_atsu 0:63ed631d8c3a 121 /** @defgroup PINSEL_Private_Macros PINSEL Private Macros
lynxeyed_atsu 0:63ed631d8c3a 122 * @{
lynxeyed_atsu 0:63ed631d8c3a 123 */
lynxeyed_atsu 0:63ed631d8c3a 124
lynxeyed_atsu 0:63ed631d8c3a 125 /* Pin selection define */
lynxeyed_atsu 0:63ed631d8c3a 126 /* I2C Pin Configuration register bit description */
lynxeyed_atsu 0:63ed631d8c3a 127 #define PINSEL_I2CPADCFG_SDADRV0 _BIT(0) /**< Drive mode control for the SDA0 pin, P0.27 */
lynxeyed_atsu 0:63ed631d8c3a 128 #define PINSEL_I2CPADCFG_SDAI2C0 _BIT(1) /**< I2C mode control for the SDA0 pin, P0.27 */
lynxeyed_atsu 0:63ed631d8c3a 129 #define PINSEL_I2CPADCFG_SCLDRV0 _BIT(2) /**< Drive mode control for the SCL0 pin, P0.28 */
lynxeyed_atsu 0:63ed631d8c3a 130 #define PINSEL_I2CPADCFG_SCLI2C0 _BIT(3) /**< I2C mode control for the SCL0 pin, P0.28 */
lynxeyed_atsu 0:63ed631d8c3a 131
lynxeyed_atsu 0:63ed631d8c3a 132 /**
lynxeyed_atsu 0:63ed631d8c3a 133 * @}
lynxeyed_atsu 0:63ed631d8c3a 134 */
lynxeyed_atsu 0:63ed631d8c3a 135
lynxeyed_atsu 0:63ed631d8c3a 136
lynxeyed_atsu 0:63ed631d8c3a 137 /* Public Types --------------------------------------------------------------- */
lynxeyed_atsu 0:63ed631d8c3a 138 /** @defgroup PINSEL_Public_Types PINSEL Public Types
lynxeyed_atsu 0:63ed631d8c3a 139 * @{
lynxeyed_atsu 0:63ed631d8c3a 140 */
lynxeyed_atsu 0:63ed631d8c3a 141
lynxeyed_atsu 0:63ed631d8c3a 142 /** @brief Pin configuration structure */
lynxeyed_atsu 0:63ed631d8c3a 143 typedef struct
lynxeyed_atsu 0:63ed631d8c3a 144 {
lynxeyed_atsu 0:63ed631d8c3a 145 uint8_t Portnum; /**< Port Number, should be PINSEL_PORT_x,
lynxeyed_atsu 0:63ed631d8c3a 146 where x should be in range from 0 to 4 */
lynxeyed_atsu 0:63ed631d8c3a 147 uint8_t Pinnum; /**< Pin Number, should be PINSEL_PIN_x,
lynxeyed_atsu 0:63ed631d8c3a 148 where x should be in range from 0 to 31 */
lynxeyed_atsu 0:63ed631d8c3a 149 uint8_t Funcnum; /**< Function Number, should be PINSEL_FUNC_x,
lynxeyed_atsu 0:63ed631d8c3a 150 where x should be in range from 0 to 3 */
lynxeyed_atsu 0:63ed631d8c3a 151 uint8_t Pinmode; /**< Pin Mode, should be:
lynxeyed_atsu 0:63ed631d8c3a 152 - PINSEL_PINMODE_PULLUP: Internal pull-up resistor
lynxeyed_atsu 0:63ed631d8c3a 153 - PINSEL_PINMODE_TRISTATE: Tri-state
lynxeyed_atsu 0:63ed631d8c3a 154 - PINSEL_PINMODE_PULLDOWN: Internal pull-down resistor */
lynxeyed_atsu 0:63ed631d8c3a 155 uint8_t OpenDrain; /**< OpenDrain mode, should be:
lynxeyed_atsu 0:63ed631d8c3a 156 - PINSEL_PINMODE_NORMAL: Pin is in the normal (not open drain) mode
lynxeyed_atsu 0:63ed631d8c3a 157 - PINSEL_PINMODE_OPENDRAIN: Pin is in the open drain mode */
lynxeyed_atsu 0:63ed631d8c3a 158 } PINSEL_CFG_Type;
lynxeyed_atsu 0:63ed631d8c3a 159
lynxeyed_atsu 0:63ed631d8c3a 160 /**
lynxeyed_atsu 0:63ed631d8c3a 161 * @}
lynxeyed_atsu 0:63ed631d8c3a 162 */
lynxeyed_atsu 0:63ed631d8c3a 163
lynxeyed_atsu 0:63ed631d8c3a 164
lynxeyed_atsu 0:63ed631d8c3a 165 /* Public Functions ----------------------------------------------------------- */
lynxeyed_atsu 0:63ed631d8c3a 166 /** @defgroup PINSEL_Public_Functions PINSEL Public Functions
lynxeyed_atsu 0:63ed631d8c3a 167 * @{
lynxeyed_atsu 0:63ed631d8c3a 168 */
lynxeyed_atsu 0:63ed631d8c3a 169
lynxeyed_atsu 0:63ed631d8c3a 170 void PINSEL_ConfigPin(PINSEL_CFG_Type *PinCfg);
lynxeyed_atsu 0:63ed631d8c3a 171 void PINSEL_ConfigTraceFunc (FunctionalState NewState);
lynxeyed_atsu 0:63ed631d8c3a 172 void PINSEL_SetI2C0Pins(uint8_t i2cPinMode, FunctionalState filterSlewRateEnable);
lynxeyed_atsu 0:63ed631d8c3a 173
lynxeyed_atsu 0:63ed631d8c3a 174
lynxeyed_atsu 0:63ed631d8c3a 175 /**
lynxeyed_atsu 0:63ed631d8c3a 176 * @}
lynxeyed_atsu 0:63ed631d8c3a 177 */
lynxeyed_atsu 0:63ed631d8c3a 178
lynxeyed_atsu 0:63ed631d8c3a 179
lynxeyed_atsu 0:63ed631d8c3a 180 #ifdef __cplusplus
lynxeyed_atsu 0:63ed631d8c3a 181 }
lynxeyed_atsu 0:63ed631d8c3a 182 #endif
lynxeyed_atsu 0:63ed631d8c3a 183
lynxeyed_atsu 0:63ed631d8c3a 184 #endif /* LPC17XX_PINSEL_H_ */
lynxeyed_atsu 0:63ed631d8c3a 185
lynxeyed_atsu 0:63ed631d8c3a 186 /**
lynxeyed_atsu 0:63ed631d8c3a 187 * @}
lynxeyed_atsu 0:63ed631d8c3a 188 */
lynxeyed_atsu 0:63ed631d8c3a 189
lynxeyed_atsu 0:63ed631d8c3a 190 /* --------------------------------- End Of File ------------------------------ */
lynxeyed_atsu 0:63ed631d8c3a 191