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 156:ff21514d8981 1 /* mbed Microcontroller Library
AnnaBridge 156:ff21514d8981 2 *******************************************************************************
Anna Bridge 169:a7c7b631e539 3 * Copyright (c) 2018, STMicroelectronics
AnnaBridge 156:ff21514d8981 4 * All rights reserved.
AnnaBridge 156:ff21514d8981 5 *
AnnaBridge 156:ff21514d8981 6 * Redistribution and use in source and binary forms, with or without
AnnaBridge 156:ff21514d8981 7 * modification, are permitted provided that the following conditions are met:
AnnaBridge 156:ff21514d8981 8 *
AnnaBridge 156:ff21514d8981 9 * 1. Redistributions of source code must retain the above copyright notice,
AnnaBridge 156:ff21514d8981 10 * this list of conditions and the following disclaimer.
AnnaBridge 156:ff21514d8981 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
AnnaBridge 156:ff21514d8981 12 * this list of conditions and the following disclaimer in the documentation
AnnaBridge 156:ff21514d8981 13 * and/or other materials provided with the distribution.
AnnaBridge 156:ff21514d8981 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
AnnaBridge 156:ff21514d8981 15 * may be used to endorse or promote products derived from this software
AnnaBridge 156:ff21514d8981 16 * without specific prior written permission.
AnnaBridge 156:ff21514d8981 17 *
AnnaBridge 156:ff21514d8981 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AnnaBridge 156:ff21514d8981 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
AnnaBridge 156:ff21514d8981 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 156:ff21514d8981 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
AnnaBridge 156:ff21514d8981 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
AnnaBridge 156:ff21514d8981 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
AnnaBridge 156:ff21514d8981 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
AnnaBridge 156:ff21514d8981 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
AnnaBridge 156:ff21514d8981 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
AnnaBridge 156:ff21514d8981 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 156:ff21514d8981 28 *******************************************************************************
AnnaBridge 156:ff21514d8981 29 */
Anna Bridge 169:a7c7b631e539 30
AnnaBridge 156:ff21514d8981 31 #ifndef MBED_PINNAMES_H
AnnaBridge 156:ff21514d8981 32 #define MBED_PINNAMES_H
AnnaBridge 156:ff21514d8981 33
AnnaBridge 156:ff21514d8981 34 #include "cmsis.h"
AnnaBridge 156:ff21514d8981 35 #include "PinNamesTypes.h"
AnnaBridge 156:ff21514d8981 36
AnnaBridge 156:ff21514d8981 37 #ifdef __cplusplus
AnnaBridge 156:ff21514d8981 38 extern "C" {
AnnaBridge 156:ff21514d8981 39 #endif
AnnaBridge 156:ff21514d8981 40
AnnaBridge 156:ff21514d8981 41 typedef enum {
Anna Bridge 169:a7c7b631e539 42 ALT0 = 0x100,
Anna Bridge 169:a7c7b631e539 43 ALT1 = 0x200,
Anna Bridge 169:a7c7b631e539 44 ALT2 = 0x300,
Anna Bridge 169:a7c7b631e539 45 ALT3 = 0x400
Anna Bridge 169:a7c7b631e539 46 } ALTx;
Anna Bridge 169:a7c7b631e539 47
Anna Bridge 169:a7c7b631e539 48 typedef enum {
AnnaBridge 156:ff21514d8981 49 PA_0 = 0x00,
AnnaBridge 156:ff21514d8981 50 PA_1 = 0x01,
AnnaBridge 156:ff21514d8981 51 PA_2 = 0x02,
AnnaBridge 170:e95d10626187 52 PA_2_ALT0 = PA_2 | ALT0,
AnnaBridge 170:e95d10626187 53 PA_2_ALT1 = PA_2 | ALT1,
AnnaBridge 156:ff21514d8981 54 PA_3 = 0x03,
AnnaBridge 170:e95d10626187 55 PA_3_ALT0 = PA_3 | ALT0,
AnnaBridge 170:e95d10626187 56 PA_3_ALT1 = PA_3 | ALT1,
AnnaBridge 156:ff21514d8981 57 PA_4 = 0x04,
AnnaBridge 156:ff21514d8981 58 PA_5 = 0x05,
AnnaBridge 156:ff21514d8981 59 PA_6 = 0x06,
AnnaBridge 170:e95d10626187 60 PA_6_ALT0 = PA_6 | ALT0,
AnnaBridge 156:ff21514d8981 61 PA_7 = 0x07,
AnnaBridge 170:e95d10626187 62 PA_7_ALT0 = PA_7 | ALT0,
AnnaBridge 170:e95d10626187 63 PA_7_ALT1 = PA_7 | ALT1,
AnnaBridge 170:e95d10626187 64 PA_7_ALT2 = PA_7 | ALT2,
AnnaBridge 156:ff21514d8981 65 PA_8 = 0x08,
AnnaBridge 156:ff21514d8981 66 PA_9 = 0x09,
AnnaBridge 156:ff21514d8981 67 PA_10 = 0x0A,
AnnaBridge 156:ff21514d8981 68 PA_11 = 0x0B,
AnnaBridge 156:ff21514d8981 69 PA_12 = 0x0C,
AnnaBridge 156:ff21514d8981 70 PA_13 = 0x0D,
AnnaBridge 156:ff21514d8981 71 PA_14 = 0x0E,
AnnaBridge 170:e95d10626187 72 PA_14_ALT0 = PA_14 | ALT0,
AnnaBridge 156:ff21514d8981 73 PA_15 = 0x0F,
AnnaBridge 156:ff21514d8981 74
AnnaBridge 156:ff21514d8981 75 PB_0 = 0x10,
AnnaBridge 156:ff21514d8981 76 PB_1 = 0x11,
AnnaBridge 156:ff21514d8981 77 PB_2 = 0x12,
AnnaBridge 156:ff21514d8981 78 PB_3 = 0x13,
AnnaBridge 156:ff21514d8981 79 PB_4 = 0x14,
AnnaBridge 170:e95d10626187 80 PB_4_ALT0 = PB_4 | ALT0,
AnnaBridge 170:e95d10626187 81 PB_4_ALT1 = PB_4 | ALT1,
AnnaBridge 156:ff21514d8981 82 PB_5 = 0x15,
AnnaBridge 170:e95d10626187 83 PB_5_ALT0 = PB_5 | ALT0,
AnnaBridge 170:e95d10626187 84 PB_5_ALT1 = PB_5 | ALT1,
AnnaBridge 156:ff21514d8981 85 PB_6 = 0x16,
AnnaBridge 156:ff21514d8981 86 PB_7 = 0x17,
AnnaBridge 156:ff21514d8981 87 PB_8 = 0x18,
AnnaBridge 156:ff21514d8981 88 PB_9 = 0x19,
AnnaBridge 156:ff21514d8981 89 PB_10 = 0x1A,
AnnaBridge 156:ff21514d8981 90 PB_11 = 0x1B,
AnnaBridge 156:ff21514d8981 91 PB_12 = 0x1C,
AnnaBridge 156:ff21514d8981 92 PB_13 = 0x1D,
AnnaBridge 156:ff21514d8981 93 PB_14 = 0x1E,
AnnaBridge 156:ff21514d8981 94 PB_15 = 0x1F,
AnnaBridge 156:ff21514d8981 95
AnnaBridge 156:ff21514d8981 96 PC_0 = 0x20,
AnnaBridge 156:ff21514d8981 97 PC_1 = 0x21,
AnnaBridge 156:ff21514d8981 98 PC_2 = 0x22,
AnnaBridge 156:ff21514d8981 99 PC_3 = 0x23,
AnnaBridge 156:ff21514d8981 100 PC_4 = 0x24,
AnnaBridge 156:ff21514d8981 101 PC_5 = 0x25,
AnnaBridge 156:ff21514d8981 102 PC_6 = 0x26,
AnnaBridge 170:e95d10626187 103 PC_6_ALT0 = PC_6 | ALT0,
AnnaBridge 156:ff21514d8981 104 PC_7 = 0x27,
AnnaBridge 170:e95d10626187 105 PC_7_ALT0 = PC_7 | ALT0,
AnnaBridge 156:ff21514d8981 106 PC_8 = 0x28,
AnnaBridge 156:ff21514d8981 107 PC_9 = 0x29,
AnnaBridge 156:ff21514d8981 108 PC_10 = 0x2A,
AnnaBridge 170:e95d10626187 109 PC_10_ALT0 = PC_10 | ALT0,
AnnaBridge 156:ff21514d8981 110 PC_11 = 0x2B,
AnnaBridge 170:e95d10626187 111 PC_11_ALT0 = PC_11 | ALT0,
AnnaBridge 156:ff21514d8981 112 PC_12 = 0x2C,
AnnaBridge 156:ff21514d8981 113 PC_13 = 0x2D,
AnnaBridge 156:ff21514d8981 114 PC_14 = 0x2E,
AnnaBridge 156:ff21514d8981 115 PC_15 = 0x2F,
AnnaBridge 156:ff21514d8981 116
AnnaBridge 156:ff21514d8981 117 PD_2 = 0x32,
AnnaBridge 156:ff21514d8981 118
AnnaBridge 156:ff21514d8981 119 PH_0 = 0x70,
AnnaBridge 156:ff21514d8981 120 PH_1 = 0x71,
AnnaBridge 156:ff21514d8981 121
AnnaBridge 156:ff21514d8981 122 // ADC internal channels
AnnaBridge 156:ff21514d8981 123 ADC_TEMP = 0xF0,
AnnaBridge 156:ff21514d8981 124 ADC_VREF = 0xF1,
AnnaBridge 156:ff21514d8981 125 ADC_VLCD = 0xF2,
AnnaBridge 156:ff21514d8981 126
AnnaBridge 156:ff21514d8981 127 // Arduino connector namings
AnnaBridge 156:ff21514d8981 128 A0 = PA_0,
AnnaBridge 156:ff21514d8981 129 A1 = PA_1,
AnnaBridge 156:ff21514d8981 130 A2 = PA_4,
AnnaBridge 156:ff21514d8981 131 A3 = PB_0,
AnnaBridge 156:ff21514d8981 132 A4 = PC_1,
AnnaBridge 156:ff21514d8981 133 A5 = PC_0,
AnnaBridge 156:ff21514d8981 134 D0 = PA_3,
AnnaBridge 156:ff21514d8981 135 D1 = PA_2,
AnnaBridge 156:ff21514d8981 136 D2 = PA_10,
AnnaBridge 156:ff21514d8981 137 D3 = PB_3,
AnnaBridge 156:ff21514d8981 138 D4 = PB_5,
AnnaBridge 156:ff21514d8981 139 D5 = PB_4,
AnnaBridge 156:ff21514d8981 140 D6 = PB_10,
AnnaBridge 156:ff21514d8981 141 D7 = PA_8,
AnnaBridge 156:ff21514d8981 142 D8 = PA_9,
AnnaBridge 156:ff21514d8981 143 D9 = PC_7,
AnnaBridge 156:ff21514d8981 144 D10 = PB_6,
AnnaBridge 156:ff21514d8981 145 D11 = PA_7,
AnnaBridge 156:ff21514d8981 146 D12 = PA_6,
AnnaBridge 156:ff21514d8981 147 D13 = PA_5,
AnnaBridge 156:ff21514d8981 148 D14 = PB_9,
AnnaBridge 156:ff21514d8981 149 D15 = PB_8,
AnnaBridge 156:ff21514d8981 150
AnnaBridge 161:aa5281ff4a02 151 // STDIO for console print
AnnaBridge 161:aa5281ff4a02 152 #ifdef MBED_CONF_TARGET_STDIO_UART_TX
AnnaBridge 161:aa5281ff4a02 153 STDIO_UART_TX = MBED_CONF_TARGET_STDIO_UART_TX,
AnnaBridge 161:aa5281ff4a02 154 #else
AnnaBridge 161:aa5281ff4a02 155 STDIO_UART_TX = PA_2,
AnnaBridge 161:aa5281ff4a02 156 #endif
AnnaBridge 161:aa5281ff4a02 157 #ifdef MBED_CONF_TARGET_STDIO_UART_RX
AnnaBridge 161:aa5281ff4a02 158 STDIO_UART_RX = MBED_CONF_TARGET_STDIO_UART_RX,
AnnaBridge 161:aa5281ff4a02 159 #else
AnnaBridge 161:aa5281ff4a02 160 STDIO_UART_RX = PA_3,
AnnaBridge 161:aa5281ff4a02 161 #endif
AnnaBridge 161:aa5281ff4a02 162
AnnaBridge 156:ff21514d8981 163 // Generic signals namings
AnnaBridge 156:ff21514d8981 164 LED1 = PA_5,
AnnaBridge 156:ff21514d8981 165 LED2 = PA_5,
AnnaBridge 156:ff21514d8981 166 LED3 = PA_5,
AnnaBridge 156:ff21514d8981 167 LED4 = PA_5,
AnnaBridge 156:ff21514d8981 168 USER_BUTTON = PC_13,
AnnaBridge 156:ff21514d8981 169 // Standardized button names
AnnaBridge 156:ff21514d8981 170 BUTTON1 = USER_BUTTON,
AnnaBridge 161:aa5281ff4a02 171 SERIAL_TX = STDIO_UART_TX,
AnnaBridge 161:aa5281ff4a02 172 SERIAL_RX = STDIO_UART_RX,
AnnaBridge 161:aa5281ff4a02 173 USBTX = STDIO_UART_TX,
AnnaBridge 161:aa5281ff4a02 174 USBRX = STDIO_UART_RX,
AnnaBridge 156:ff21514d8981 175 I2C_SCL = PB_8,
AnnaBridge 156:ff21514d8981 176 I2C_SDA = PB_9,
AnnaBridge 156:ff21514d8981 177 SPI_MOSI = PA_7,
AnnaBridge 156:ff21514d8981 178 SPI_MISO = PA_6,
AnnaBridge 156:ff21514d8981 179 SPI_SCK = PA_5,
AnnaBridge 156:ff21514d8981 180 SPI_CS = PB_6,
AnnaBridge 156:ff21514d8981 181 PWM_OUT = PB_3,
AnnaBridge 156:ff21514d8981 182
AnnaBridge 170:e95d10626187 183 /**** USB pins ****/
AnnaBridge 156:ff21514d8981 184 USB_DM = PA_11,
AnnaBridge 156:ff21514d8981 185 USB_DP = PA_12,
AnnaBridge 156:ff21514d8981 186 USB_NOE = PC_9,
Anna Bridge 169:a7c7b631e539 187 USB_NOE_ALT0 = PA_13,
Anna Bridge 169:a7c7b631e539 188
AnnaBridge 170:e95d10626187 189 /**** OSCILLATOR pins ****/
Anna Bridge 169:a7c7b631e539 190 RCC_OSC32_IN = PC_14,
Anna Bridge 169:a7c7b631e539 191 RCC_OSC32_OUT = PC_15,
Anna Bridge 169:a7c7b631e539 192 RCC_OSC_IN = PH_0,
Anna Bridge 169:a7c7b631e539 193 RCC_OSC_OUT = PH_1,
Anna Bridge 169:a7c7b631e539 194
AnnaBridge 170:e95d10626187 195 /**** DEBUG pins ****/
Anna Bridge 169:a7c7b631e539 196 SYS_PVD_IN = PB_7,
Anna Bridge 169:a7c7b631e539 197 SYS_SWCLK = PA_14,
Anna Bridge 169:a7c7b631e539 198 SYS_SWDIO = PA_13,
Anna Bridge 169:a7c7b631e539 199 SYS_VREF_OUT_PB0 = PB_0,
Anna Bridge 169:a7c7b631e539 200 SYS_VREF_OUT_PB1 = PB_1,
Anna Bridge 169:a7c7b631e539 201 SYS_WKUP1 = PA_0,
Anna Bridge 169:a7c7b631e539 202 SYS_WKUP2 = PC_13,
AnnaBridge 156:ff21514d8981 203
AnnaBridge 156:ff21514d8981 204 // Not connected
AnnaBridge 156:ff21514d8981 205 NC = (int)0xFFFFFFFF
AnnaBridge 156:ff21514d8981 206 } PinName;
AnnaBridge 156:ff21514d8981 207
AnnaBridge 156:ff21514d8981 208 #ifdef __cplusplus
AnnaBridge 156:ff21514d8981 209 }
AnnaBridge 156:ff21514d8981 210 #endif
AnnaBridge 156:ff21514d8981 211
AnnaBridge 156:ff21514d8981 212 #endif