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 156:ff21514d8981 52 PA_3 = 0x03,
AnnaBridge 156:ff21514d8981 53 PA_4 = 0x04,
AnnaBridge 156:ff21514d8981 54 PA_5 = 0x05,
AnnaBridge 156:ff21514d8981 55 PA_6 = 0x06,
AnnaBridge 170:e95d10626187 56 PA_6_ALT0 = PA_6 | ALT0,
AnnaBridge 156:ff21514d8981 57 PA_7 = 0x07,
AnnaBridge 170:e95d10626187 58 PA_7_ALT0 = PA_7 | ALT0,
AnnaBridge 170:e95d10626187 59 PA_7_ALT1 = PA_7 | ALT1,
AnnaBridge 170:e95d10626187 60 PA_7_ALT2 = PA_7 | ALT2,
AnnaBridge 156:ff21514d8981 61 PA_8 = 0x08,
AnnaBridge 156:ff21514d8981 62 PA_9 = 0x09,
AnnaBridge 156:ff21514d8981 63 PA_10 = 0x0A,
AnnaBridge 156:ff21514d8981 64 PA_11 = 0x0B,
AnnaBridge 156:ff21514d8981 65 PA_12 = 0x0C,
AnnaBridge 156:ff21514d8981 66 PA_13 = 0x0D,
AnnaBridge 156:ff21514d8981 67 PA_14 = 0x0E,
AnnaBridge 156:ff21514d8981 68 PA_15 = 0x0F,
AnnaBridge 156:ff21514d8981 69
AnnaBridge 156:ff21514d8981 70 PB_0 = 0x10,
AnnaBridge 170:e95d10626187 71 PB_0_ALT0 = PB_0 | ALT0,
AnnaBridge 156:ff21514d8981 72 PB_1 = 0x11,
AnnaBridge 170:e95d10626187 73 PB_1_ALT0 = PB_1 | ALT0,
AnnaBridge 170:e95d10626187 74 PB_1_ALT1 = PB_1 | ALT1,
Anna Bridge 169:a7c7b631e539 75 PB_2 = 0x12,
AnnaBridge 156:ff21514d8981 76 PB_3 = 0x13,
AnnaBridge 156:ff21514d8981 77 PB_4 = 0x14,
AnnaBridge 156:ff21514d8981 78 PB_5 = 0x15,
AnnaBridge 156:ff21514d8981 79 PB_6 = 0x16,
AnnaBridge 156:ff21514d8981 80 PB_7 = 0x17,
AnnaBridge 156:ff21514d8981 81 PB_8 = 0x18,
AnnaBridge 156:ff21514d8981 82 PB_9 = 0x19,
AnnaBridge 156:ff21514d8981 83
AnnaBridge 156:ff21514d8981 84 PF_0 = 0x50,
AnnaBridge 156:ff21514d8981 85 PF_1 = 0x51,
AnnaBridge 156:ff21514d8981 86
AnnaBridge 156:ff21514d8981 87 // ADC internal channels
AnnaBridge 156:ff21514d8981 88 ADC_TEMP = 0xF0,
AnnaBridge 156:ff21514d8981 89 ADC_VREF = 0xF1,
AnnaBridge 156:ff21514d8981 90 ADC_VBAT = 0xF2,
AnnaBridge 156:ff21514d8981 91
AnnaBridge 156:ff21514d8981 92 // Arduino connector namings
AnnaBridge 156:ff21514d8981 93 A0 = PA_0,
AnnaBridge 156:ff21514d8981 94 A1 = PA_1,
AnnaBridge 156:ff21514d8981 95 A2 = PA_3,
AnnaBridge 156:ff21514d8981 96 A3 = PA_4,
AnnaBridge 156:ff21514d8981 97 A4 = PA_5,
AnnaBridge 156:ff21514d8981 98 A5 = PA_6,
AnnaBridge 156:ff21514d8981 99 A6 = PA_7,
AnnaBridge 156:ff21514d8981 100 A7 = PA_2,
AnnaBridge 156:ff21514d8981 101 D0 = PA_10,
AnnaBridge 156:ff21514d8981 102 D1 = PA_9,
AnnaBridge 156:ff21514d8981 103 D2 = PA_12,
AnnaBridge 156:ff21514d8981 104 D3 = PB_0,
AnnaBridge 156:ff21514d8981 105 D4 = PB_7,
AnnaBridge 156:ff21514d8981 106 D5 = PB_6,
AnnaBridge 156:ff21514d8981 107 D6 = PB_1,
AnnaBridge 156:ff21514d8981 108 D7 = PF_0,
AnnaBridge 156:ff21514d8981 109 D8 = PF_1,
AnnaBridge 156:ff21514d8981 110 D9 = PA_8,
AnnaBridge 156:ff21514d8981 111 D10 = PA_11,
AnnaBridge 156:ff21514d8981 112 D11 = PB_5,
AnnaBridge 156:ff21514d8981 113 D12 = PB_4,
AnnaBridge 156:ff21514d8981 114 D13 = PB_3,
AnnaBridge 156:ff21514d8981 115
AnnaBridge 161:aa5281ff4a02 116 // STDIO for console print
AnnaBridge 161:aa5281ff4a02 117 #ifdef MBED_CONF_TARGET_STDIO_UART_TX
AnnaBridge 161:aa5281ff4a02 118 STDIO_UART_TX = MBED_CONF_TARGET_STDIO_UART_TX,
AnnaBridge 161:aa5281ff4a02 119 #else
AnnaBridge 161:aa5281ff4a02 120 STDIO_UART_TX = PA_2,
AnnaBridge 161:aa5281ff4a02 121 #endif
AnnaBridge 161:aa5281ff4a02 122 #ifdef MBED_CONF_TARGET_STDIO_UART_RX
AnnaBridge 161:aa5281ff4a02 123 STDIO_UART_RX = MBED_CONF_TARGET_STDIO_UART_RX,
AnnaBridge 161:aa5281ff4a02 124 #else
AnnaBridge 161:aa5281ff4a02 125 STDIO_UART_RX = PA_15,
AnnaBridge 161:aa5281ff4a02 126 #endif
AnnaBridge 161:aa5281ff4a02 127
AnnaBridge 156:ff21514d8981 128 // Generic signals namings
AnnaBridge 156:ff21514d8981 129 LED1 = PB_3,
AnnaBridge 156:ff21514d8981 130 LED2 = PB_3,
AnnaBridge 156:ff21514d8981 131 LED3 = PB_3,
AnnaBridge 156:ff21514d8981 132 LED4 = PB_3,
AnnaBridge 161:aa5281ff4a02 133 SERIAL_TX = STDIO_UART_TX,
AnnaBridge 161:aa5281ff4a02 134 SERIAL_RX = STDIO_UART_RX,
AnnaBridge 161:aa5281ff4a02 135 USBTX = STDIO_UART_TX,
AnnaBridge 161:aa5281ff4a02 136 USBRX = STDIO_UART_RX,
AnnaBridge 156:ff21514d8981 137 I2C_SCL = PA_9,
AnnaBridge 156:ff21514d8981 138 I2C_SDA = PA_10,
AnnaBridge 156:ff21514d8981 139 SPI_MOSI = PB_5,
AnnaBridge 156:ff21514d8981 140 SPI_MISO = PB_4,
AnnaBridge 156:ff21514d8981 141 SPI_SCK = PB_3,
AnnaBridge 156:ff21514d8981 142 SPI_CS = PB_1,
AnnaBridge 156:ff21514d8981 143 PWM_OUT = PB_0,
AnnaBridge 156:ff21514d8981 144
AnnaBridge 170:e95d10626187 145 /**** OSCILLATOR pins ****/
Anna Bridge 169:a7c7b631e539 146 RCC_OSC_IN = PF_0,
Anna Bridge 169:a7c7b631e539 147 RCC_OSC_OUT = PF_1,
Anna Bridge 169:a7c7b631e539 148
AnnaBridge 170:e95d10626187 149 /**** DEBUG pins ****/
Anna Bridge 169:a7c7b631e539 150 SYS_SWCLK = PA_14,
Anna Bridge 169:a7c7b631e539 151 SYS_SWDIO = PA_13,
Anna Bridge 169:a7c7b631e539 152 SYS_WKUP1 = PA_0,
Anna Bridge 169:a7c7b631e539 153
AnnaBridge 156:ff21514d8981 154 // Not connected
AnnaBridge 156:ff21514d8981 155 NC = (int)0xFFFFFFFF
AnnaBridge 156:ff21514d8981 156 } PinName;
AnnaBridge 156:ff21514d8981 157
AnnaBridge 156:ff21514d8981 158 #ifdef __cplusplus
AnnaBridge 156:ff21514d8981 159 }
AnnaBridge 156:ff21514d8981 160 #endif
AnnaBridge 156:ff21514d8981 161
AnnaBridge 156:ff21514d8981 162 #endif