The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

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