|
| 1 | +/* |
| 2 | + * Copyright (c) 2016 Nordic Semiconductor ASA |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * Redistribution and use in source and binary forms, with or without modification, |
| 6 | + * are permitted provided that the following conditions are met: |
| 7 | + * |
| 8 | + * 1. Redistributions of source code must retain the above copyright notice, this list |
| 9 | + * of conditions and the following disclaimer. |
| 10 | + * |
| 11 | + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
| 12 | + * integrated circuit in a product or a software update for such product, must reproduce |
| 13 | + * the above copyright notice, this list of conditions and the following disclaimer in |
| 14 | + * the documentation and/or other materials provided with the distribution. |
| 15 | + * |
| 16 | + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
| 17 | + * used to endorse or promote products derived from this software without specific prior |
| 18 | + * written permission. |
| 19 | + * |
| 20 | + * 4. This software, with or without modification, must only be used with a |
| 21 | + * Nordic Semiconductor ASA integrated circuit. |
| 22 | + * |
| 23 | + * 5. Any software provided in binary or object form under this license must not be reverse |
| 24 | + * engineered, decompiled, modified and/or disassembled. |
| 25 | + * |
| 26 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 27 | + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 28 | + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 29 | + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
| 30 | + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 31 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 32 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 33 | + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 34 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 35 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 36 | + * |
| 37 | + */ |
| 38 | + |
| 39 | +#ifndef MBED_PINNAMES_H |
| 40 | +#define MBED_PINNAMES_H |
| 41 | + |
| 42 | +#include "cmsis.h" |
| 43 | + |
| 44 | +#ifdef __cplusplus |
| 45 | +extern "C" { |
| 46 | +#endif |
| 47 | + |
| 48 | +typedef enum { |
| 49 | + PIN_INPUT, |
| 50 | + PIN_OUTPUT |
| 51 | +} PinDirection; |
| 52 | + |
| 53 | +#define NOT_CONNECTED (int)0xFFFFFFFF |
| 54 | +#define PORT_SHIFT 3 |
| 55 | + |
| 56 | +typedef enum { |
| 57 | + p0 = 0, |
| 58 | + p1 = 1, |
| 59 | + p2 = 2, |
| 60 | + p3 = 3, |
| 61 | + p4 = 4, |
| 62 | + p5 = 5, |
| 63 | + p6 = 6, |
| 64 | + p7 = 7, |
| 65 | + p8 = 8, |
| 66 | + p9 = 9, |
| 67 | + p10 = 10, |
| 68 | + p11 = 11, |
| 69 | + p12 = 12, |
| 70 | + p13 = 13, |
| 71 | + p14 = 14, |
| 72 | + p15 = 15, |
| 73 | + p16 = 16, |
| 74 | + p17 = 17, |
| 75 | + p18 = 18, |
| 76 | + p19 = 19, |
| 77 | + p20 = 20, |
| 78 | + p21 = 21, |
| 79 | + p22 = 22, |
| 80 | + p23 = 23, |
| 81 | + p24 = 24, |
| 82 | + p25 = 25, |
| 83 | + p26 = 26, |
| 84 | + p27 = 27, |
| 85 | + p28 = 28, |
| 86 | + p29 = 29, |
| 87 | + p30 = 30, |
| 88 | + p31 = 31, |
| 89 | + |
| 90 | + P0_0 = p0, |
| 91 | + P0_1 = p1, |
| 92 | + P0_2 = p2, |
| 93 | + P0_3 = p3, |
| 94 | + P0_4 = p4, |
| 95 | + P0_5 = p5, |
| 96 | + P0_6 = p6, |
| 97 | + P0_7 = p7, |
| 98 | + |
| 99 | + P0_8 = p8, |
| 100 | + P0_9 = p9, |
| 101 | + P0_10 = p10, |
| 102 | + P0_11 = p11, |
| 103 | + P0_12 = p12, |
| 104 | + P0_13 = p13, |
| 105 | + P0_14 = p14, |
| 106 | + P0_15 = p15, |
| 107 | + |
| 108 | + P0_16 = p16, |
| 109 | + P0_17 = p17, |
| 110 | + P0_18 = p18, |
| 111 | + P0_19 = p19, |
| 112 | + P0_20 = p20, |
| 113 | + P0_21 = p21, |
| 114 | + P0_22 = p22, |
| 115 | + P0_23 = p23, |
| 116 | + |
| 117 | + P0_24 = p24, |
| 118 | + P0_25 = p25, |
| 119 | + P0_26 = p26, |
| 120 | + P0_27 = p27, |
| 121 | + P0_28 = p28, |
| 122 | + P0_29 = p29, |
| 123 | + P0_30 = p30, |
| 124 | + P0_31 = p31, |
| 125 | + |
| 126 | + RX_PIN_NUMBER = p8, |
| 127 | + TX_PIN_NUMBER = p6, |
| 128 | + CTS_PIN_NUMBER = p7, |
| 129 | + RTS_PIN_NUMBER = p5, |
| 130 | + |
| 131 | + // mBed interface Pins |
| 132 | + STDIO_UART_TX = TX_PIN_NUMBER, |
| 133 | + STDIO_UART_RX = RX_PIN_NUMBER, |
| 134 | + STDIO_UART_CTS = CTS_PIN_NUMBER, |
| 135 | + STDIO_UART_RTS = RTS_PIN_NUMBER, |
| 136 | + |
| 137 | + // Analog |
| 138 | + A0 = P0_2, |
| 139 | + A1 = P0_3, |
| 140 | + A2 = P0_4, |
| 141 | + A3 = P0_28, |
| 142 | + |
| 143 | + // General Pin Input Output (GPIO) |
| 144 | + GPIO0 = P0_9, |
| 145 | + GPIO1 = P0_10, |
| 146 | + GPIO2 = P0_17, |
| 147 | + GPIO3 = P0_29, |
| 148 | + GPIO4 = NOT_CONNECTED, |
| 149 | + GPIO5 = NOT_CONNECTED, |
| 150 | + GPIO6 = NOT_CONNECTED, |
| 151 | + |
| 152 | + //Purse Width Modulation (PWM) |
| 153 | + PWM0 = GPIO2, |
| 154 | + PWM1 = GPIO3, |
| 155 | + PWM2 = GPIO0, |
| 156 | + PWM3 = GPIO1, |
| 157 | + |
| 158 | + // LEDs |
| 159 | + LED0 = GPIO0, |
| 160 | + LED1 = GPIO1, |
| 161 | + LED2 = GPIO2, |
| 162 | + |
| 163 | + LED_RED = LED0, |
| 164 | + LED_GREEN = LED1, |
| 165 | + LED_BLUE = LED2, |
| 166 | + |
| 167 | + // USB bridge and SWD UART connected UART pins |
| 168 | + USBTX = TX_PIN_NUMBER, |
| 169 | + USBRX = RX_PIN_NUMBER, |
| 170 | + |
| 171 | + // UART pins |
| 172 | + UART0_RX = NOT_CONNECTED, |
| 173 | + UART0_TX = NOT_CONNECTED, |
| 174 | + UART0_CTS = NOT_CONNECTED, |
| 175 | + UART0_RTS = NOT_CONNECTED, |
| 176 | + |
| 177 | + UART1_RX = P0_8, |
| 178 | + UART1_TX = P0_6, |
| 179 | + UART1_CTS = P0_7, |
| 180 | + UART1_RTS = P0_5, |
| 181 | + |
| 182 | + UART2_RX = NOT_CONNECTED, |
| 183 | + UART2_TX = NOT_CONNECTED, |
| 184 | + UART2_CTS = NOT_CONNECTED, |
| 185 | + UART2_RTS = NOT_CONNECTED, |
| 186 | + |
| 187 | + // I2C pins |
| 188 | + I2C0_SCL = P0_27, |
| 189 | + I2C0_SDA = P0_26, |
| 190 | + |
| 191 | + I2C1_SCL = P0_31, |
| 192 | + I2C1_SDA = P0_30, |
| 193 | + |
| 194 | + I2C2_SCL = NOT_CONNECTED, |
| 195 | + I2C2_SDA = NOT_CONNECTED, |
| 196 | + |
| 197 | + // SPI pins |
| 198 | + SPI0_SCK = P0_14, |
| 199 | + SPI0_MOSI = P0_12, |
| 200 | + SPI0_MISO = P0_13, |
| 201 | + SPI0_SS0 = P0_11, |
| 202 | + SPI0_SS1 = P0_15, |
| 203 | + SPI0_SS2 = P0_16, |
| 204 | + |
| 205 | + SPI1_SCK = P0_25, |
| 206 | + SPI1_MOSI = P0_23, |
| 207 | + SPI1_MISO = P0_24, |
| 208 | + SPI1_SS0 = P0_22, |
| 209 | + SPI1_SS1 = P0_19, |
| 210 | + SPI1_SS2 = P0_20, |
| 211 | + |
| 212 | + SPI2_SCK = NOT_CONNECTED, |
| 213 | + SPI2_MOSI = NOT_CONNECTED, |
| 214 | + SPI2_MISO = NOT_CONNECTED, |
| 215 | + SPI2_SS0 = NOT_CONNECTED, |
| 216 | + SPI2_SS1 = NOT_CONNECTED, |
| 217 | + SPI2_SS2 = NOT_CONNECTED, |
| 218 | + |
| 219 | + SPI3_SCK = NOT_CONNECTED, |
| 220 | + SPI3_MOSI = NOT_CONNECTED, |
| 221 | + SPI3_MISO = NOT_CONNECTED, |
| 222 | + SPI3_SS0 = NOT_CONNECTED, |
| 223 | + SPI3_SS1 = NOT_CONNECTED, |
| 224 | + SPI3_SS2 = NOT_CONNECTED, |
| 225 | + |
| 226 | + // SWD UART |
| 227 | + SWD_TGT_TX = UART1_TX, |
| 228 | + SWD_TGT_RX = UART1_RX, |
| 229 | + SWD_TGT_CTS = UART1_CTS, |
| 230 | + SWD_TGT_RTS = UART1_RTS, |
| 231 | + |
| 232 | + // Not connected |
| 233 | + NC = NOT_CONNECTED |
| 234 | + |
| 235 | +} PinName; |
| 236 | + |
| 237 | +typedef enum { |
| 238 | + PullNone = 0, |
| 239 | + PullDown = 1, |
| 240 | + PullUp = 3, |
| 241 | + PullDefault = PullUp |
| 242 | +} PinMode; |
| 243 | + |
| 244 | +#ifdef __cplusplus |
| 245 | +} |
| 246 | +#endif |
| 247 | + |
| 248 | +#endif |
0 commit comments