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:
<>
Date:
Mon Jan 16 12:05:23 2017 +0000
Revision:
134:ad3be0349dc5
Parent:
128:9bcdf88f62b0
Child:
135:176b8275d35d
Release 134 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3488: Dev stm i2c v2 unitary functions https://github.com/ARMmbed/mbed-os/pull/3488
3492: Fix #3463 CAN read() return value https://github.com/ARMmbed/mbed-os/pull/3492
3503: [LPC15xx] Ensure that PWM=1 is resolved correctly https://github.com/ARMmbed/mbed-os/pull/3503
3504: [LPC15xx] CAN implementation improvements https://github.com/ARMmbed/mbed-os/pull/3504
3539: NUCLEO_F412ZG - Add support of TRNG peripheral https://github.com/ARMmbed/mbed-os/pull/3539
3540: STM: SPI: Initialize Rx in spi_master_write https://github.com/ARMmbed/mbed-os/pull/3540
3438: K64F: Add support for SERIAL ASYNCH API https://github.com/ARMmbed/mbed-os/pull/3438
3519: MCUXpresso: Fix ENET driver to enable interrupts after interrupt handler is set https://github.com/ARMmbed/mbed-os/pull/3519
3544: STM32L4 deepsleep improvement https://github.com/ARMmbed/mbed-os/pull/3544
3546: NUCLEO-F412ZG - Add CAN peripheral https://github.com/ARMmbed/mbed-os/pull/3546
3551: Fix I2C driver for RZ/A1H https://github.com/ARMmbed/mbed-os/pull/3551
3558: K64F UART Asynch API: Fix synchronization issue https://github.com/ARMmbed/mbed-os/pull/3558
3563: LPC4088 - Fix vector checksum https://github.com/ARMmbed/mbed-os/pull/3563
3567: Dev stm32 F0 v1.7.0 https://github.com/ARMmbed/mbed-os/pull/3567
3577: Fixes linking errors when building with debug profile https://github.com/ARMmbed/mbed-os/pull/3577

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 128:9bcdf88f62b0 1 /* mbed Microcontroller Library
<> 128:9bcdf88f62b0 2 *******************************************************************************
<> 128:9bcdf88f62b0 3 * Copyright (c) 2016, STMicroelectronics
<> 128:9bcdf88f62b0 4 * All rights reserved.
<> 128:9bcdf88f62b0 5 *
<> 128:9bcdf88f62b0 6 * Redistribution and use in source and binary forms, with or without
<> 128:9bcdf88f62b0 7 * modification, are permitted provided that the following conditions are met:
<> 128:9bcdf88f62b0 8 *
<> 128:9bcdf88f62b0 9 * 1. Redistributions of source code must retain the above copyright notice,
<> 128:9bcdf88f62b0 10 * this list of conditions and the following disclaimer.
<> 128:9bcdf88f62b0 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 128:9bcdf88f62b0 12 * this list of conditions and the following disclaimer in the documentation
<> 128:9bcdf88f62b0 13 * and/or other materials provided with the distribution.
<> 128:9bcdf88f62b0 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 128:9bcdf88f62b0 15 * may be used to endorse or promote products derived from this software
<> 128:9bcdf88f62b0 16 * without specific prior written permission.
<> 128:9bcdf88f62b0 17 *
<> 128:9bcdf88f62b0 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 128:9bcdf88f62b0 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 128:9bcdf88f62b0 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 128:9bcdf88f62b0 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 128:9bcdf88f62b0 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 128:9bcdf88f62b0 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 128:9bcdf88f62b0 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 128:9bcdf88f62b0 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 128:9bcdf88f62b0 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 128:9bcdf88f62b0 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 128:9bcdf88f62b0 28 *******************************************************************************
<> 128:9bcdf88f62b0 29 */
<> 128:9bcdf88f62b0 30 #ifndef MBED_PINNAMES_H
<> 128:9bcdf88f62b0 31 #define MBED_PINNAMES_H
<> 128:9bcdf88f62b0 32
<> 128:9bcdf88f62b0 33 #include "cmsis.h"
<> 128:9bcdf88f62b0 34
<> 128:9bcdf88f62b0 35 #ifdef __cplusplus
<> 128:9bcdf88f62b0 36 extern "C" {
<> 128:9bcdf88f62b0 37 #endif
<> 128:9bcdf88f62b0 38
<> 128:9bcdf88f62b0 39 #define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\
<> 128:9bcdf88f62b0 40 ((PUPD & 0x07) << 4) |\
<> 128:9bcdf88f62b0 41 ((AFNUM & 0x0F) << 7)))
<> 128:9bcdf88f62b0 42
<> 128:9bcdf88f62b0 43 #define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\
<> 128:9bcdf88f62b0 44 ((PUPD & 0x07) << 4) |\
<> 128:9bcdf88f62b0 45 ((AFNUM & 0x0F) << 7) |\
<> 128:9bcdf88f62b0 46 ((CHANNEL & 0x1F) << 11) |\
<> 128:9bcdf88f62b0 47 ((INVERTED & 0x01) << 16)))
<> 128:9bcdf88f62b0 48
<> 128:9bcdf88f62b0 49 #define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
<> 128:9bcdf88f62b0 50 #define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
<> 128:9bcdf88f62b0 51 #define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F)
<> 128:9bcdf88f62b0 52 #define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F)
<> 128:9bcdf88f62b0 53 #define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01)
<> 128:9bcdf88f62b0 54
<> 128:9bcdf88f62b0 55 #define STM_MODE_INPUT (0)
<> 128:9bcdf88f62b0 56 #define STM_MODE_OUTPUT_PP (1)
<> 128:9bcdf88f62b0 57 #define STM_MODE_OUTPUT_OD (2)
<> 128:9bcdf88f62b0 58 #define STM_MODE_AF_PP (3)
<> 128:9bcdf88f62b0 59 #define STM_MODE_AF_OD (4)
<> 128:9bcdf88f62b0 60 #define STM_MODE_ANALOG (5)
<> 128:9bcdf88f62b0 61 #define STM_MODE_IT_RISING (6)
<> 128:9bcdf88f62b0 62 #define STM_MODE_IT_FALLING (7)
<> 128:9bcdf88f62b0 63 #define STM_MODE_IT_RISING_FALLING (8)
<> 128:9bcdf88f62b0 64 #define STM_MODE_EVT_RISING (9)
<> 128:9bcdf88f62b0 65 #define STM_MODE_EVT_FALLING (10)
<> 128:9bcdf88f62b0 66 #define STM_MODE_EVT_RISING_FALLING (11)
<> 128:9bcdf88f62b0 67 #define STM_MODE_IT_EVT_RESET (12)
<> 128:9bcdf88f62b0 68
<> 128:9bcdf88f62b0 69 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H, 8=I, 9=J, A=K)
<> 128:9bcdf88f62b0 70 // Low nibble = pin number
<> 128:9bcdf88f62b0 71 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
<> 128:9bcdf88f62b0 72 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
<> 128:9bcdf88f62b0 73
<> 128:9bcdf88f62b0 74 typedef enum {
<> 128:9bcdf88f62b0 75 PIN_INPUT,
<> 128:9bcdf88f62b0 76 PIN_OUTPUT
<> 128:9bcdf88f62b0 77 } PinDirection;
<> 128:9bcdf88f62b0 78
<> 128:9bcdf88f62b0 79 typedef enum {
<> 128:9bcdf88f62b0 80 PA_0 = 0x00,
<> 128:9bcdf88f62b0 81 PA_1 = 0x01,
<> 128:9bcdf88f62b0 82 PA_2 = 0x02,
<> 128:9bcdf88f62b0 83 PA_3 = 0x03,
<> 128:9bcdf88f62b0 84 PA_4 = 0x04,
<> 128:9bcdf88f62b0 85 PA_5 = 0x05,
<> 128:9bcdf88f62b0 86 PA_6 = 0x06,
<> 128:9bcdf88f62b0 87 PA_7 = 0x07,
<> 128:9bcdf88f62b0 88 PA_8 = 0x08,
<> 128:9bcdf88f62b0 89 PA_9 = 0x09,
<> 128:9bcdf88f62b0 90 PA_10 = 0x0A,
<> 128:9bcdf88f62b0 91 PA_11 = 0x0B,
<> 128:9bcdf88f62b0 92 PA_12 = 0x0C,
<> 128:9bcdf88f62b0 93 PA_13 = 0x0D,
<> 128:9bcdf88f62b0 94 PA_14 = 0x0E,
<> 128:9bcdf88f62b0 95 PA_15 = 0x0F,
<> 128:9bcdf88f62b0 96
<> 128:9bcdf88f62b0 97 PB_0 = 0x10,
<> 128:9bcdf88f62b0 98 PB_1 = 0x11,
<> 128:9bcdf88f62b0 99 PB_2 = 0x12,
<> 128:9bcdf88f62b0 100 PB_3 = 0x13,
<> 128:9bcdf88f62b0 101 PB_4 = 0x14,
<> 128:9bcdf88f62b0 102 PB_5 = 0x15,
<> 128:9bcdf88f62b0 103 PB_6 = 0x16,
<> 128:9bcdf88f62b0 104 PB_7 = 0x17,
<> 128:9bcdf88f62b0 105 PB_8 = 0x18,
<> 128:9bcdf88f62b0 106 PB_9 = 0x19,
<> 128:9bcdf88f62b0 107 PB_10 = 0x1A,
<> 128:9bcdf88f62b0 108 PB_11 = 0x1B,
<> 128:9bcdf88f62b0 109 PB_12 = 0x1C,
<> 128:9bcdf88f62b0 110 PB_13 = 0x1D,
<> 128:9bcdf88f62b0 111 PB_14 = 0x1E,
<> 128:9bcdf88f62b0 112 PB_15 = 0x1F,
<> 128:9bcdf88f62b0 113
<> 128:9bcdf88f62b0 114 PC_0 = 0x20,
<> 128:9bcdf88f62b0 115 PC_1 = 0x21,
<> 128:9bcdf88f62b0 116 PC_2 = 0x22,
<> 128:9bcdf88f62b0 117 PC_3 = 0x23,
<> 128:9bcdf88f62b0 118 PC_4 = 0x24,
<> 128:9bcdf88f62b0 119 PC_5 = 0x25,
<> 128:9bcdf88f62b0 120 PC_6 = 0x26,
<> 128:9bcdf88f62b0 121 PC_7 = 0x27,
<> 128:9bcdf88f62b0 122 PC_8 = 0x28,
<> 128:9bcdf88f62b0 123 PC_9 = 0x29,
<> 128:9bcdf88f62b0 124 PC_10 = 0x2A,
<> 128:9bcdf88f62b0 125 PC_11 = 0x2B,
<> 128:9bcdf88f62b0 126 PC_12 = 0x2C,
<> 128:9bcdf88f62b0 127 PC_13 = 0x2D,
<> 128:9bcdf88f62b0 128 PC_14 = 0x2E,
<> 128:9bcdf88f62b0 129 PC_15 = 0x2F,
<> 128:9bcdf88f62b0 130
<> 128:9bcdf88f62b0 131 PD_0 = 0x30,
<> 128:9bcdf88f62b0 132 PD_1 = 0x31,
<> 128:9bcdf88f62b0 133 PD_2 = 0x32,
<> 128:9bcdf88f62b0 134 PD_3 = 0x33,
<> 128:9bcdf88f62b0 135 PD_4 = 0x34,
<> 128:9bcdf88f62b0 136 PD_5 = 0x35,
<> 128:9bcdf88f62b0 137 PD_6 = 0x36,
<> 128:9bcdf88f62b0 138 PD_7 = 0x37,
<> 128:9bcdf88f62b0 139 PD_8 = 0x38,
<> 128:9bcdf88f62b0 140 PD_9 = 0x39,
<> 128:9bcdf88f62b0 141 PD_10 = 0x3A,
<> 128:9bcdf88f62b0 142 PD_11 = 0x3B,
<> 128:9bcdf88f62b0 143 PD_12 = 0x3C,
<> 128:9bcdf88f62b0 144 PD_13 = 0x3D,
<> 128:9bcdf88f62b0 145 PD_14 = 0x3E,
<> 128:9bcdf88f62b0 146 PD_15 = 0x3F,
<> 128:9bcdf88f62b0 147
<> 128:9bcdf88f62b0 148 PE_0 = 0x40,
<> 128:9bcdf88f62b0 149 PE_1 = 0x41,
<> 128:9bcdf88f62b0 150 PE_2 = 0x42,
<> 128:9bcdf88f62b0 151 PE_3 = 0x43,
<> 128:9bcdf88f62b0 152 PE_4 = 0x44,
<> 128:9bcdf88f62b0 153 PE_5 = 0x45,
<> 128:9bcdf88f62b0 154 PE_6 = 0x46,
<> 128:9bcdf88f62b0 155 PE_7 = 0x47,
<> 128:9bcdf88f62b0 156 PE_8 = 0x48,
<> 128:9bcdf88f62b0 157 PE_9 = 0x49,
<> 128:9bcdf88f62b0 158 PE_10 = 0x4A,
<> 128:9bcdf88f62b0 159 PE_11 = 0x4B,
<> 128:9bcdf88f62b0 160 PE_12 = 0x4C,
<> 128:9bcdf88f62b0 161 PE_13 = 0x4D,
<> 128:9bcdf88f62b0 162 PE_14 = 0x4E,
<> 128:9bcdf88f62b0 163 PE_15 = 0x4F,
<> 128:9bcdf88f62b0 164
<> 128:9bcdf88f62b0 165 PF_0 = 0x50,
<> 128:9bcdf88f62b0 166 PF_1 = 0x51,
<> 128:9bcdf88f62b0 167 PF_2 = 0x52,
<> 128:9bcdf88f62b0 168 PF_3 = 0x53,
<> 128:9bcdf88f62b0 169 PF_4 = 0x54,
<> 128:9bcdf88f62b0 170 PF_5 = 0x55,
<> 128:9bcdf88f62b0 171 PF_6 = 0x56,
<> 128:9bcdf88f62b0 172 PF_7 = 0x57,
<> 128:9bcdf88f62b0 173 PF_8 = 0x58,
<> 128:9bcdf88f62b0 174 PF_9 = 0x59,
<> 128:9bcdf88f62b0 175 PF_10 = 0x5A,
<> 128:9bcdf88f62b0 176 PF_11 = 0x5B,
<> 128:9bcdf88f62b0 177 PF_12 = 0x5C,
<> 128:9bcdf88f62b0 178 PF_13 = 0x5D,
<> 128:9bcdf88f62b0 179 PF_14 = 0x5E,
<> 128:9bcdf88f62b0 180 PF_15 = 0x5F,
<> 128:9bcdf88f62b0 181
<> 128:9bcdf88f62b0 182 PG_0 = 0x60,
<> 128:9bcdf88f62b0 183 PG_1 = 0x61,
<> 128:9bcdf88f62b0 184 PG_2 = 0x62,
<> 128:9bcdf88f62b0 185 PG_3 = 0x63,
<> 128:9bcdf88f62b0 186 PG_4 = 0x64,
<> 128:9bcdf88f62b0 187 PG_5 = 0x65,
<> 128:9bcdf88f62b0 188 PG_6 = 0x66,
<> 128:9bcdf88f62b0 189 PG_7 = 0x67,
<> 128:9bcdf88f62b0 190 PG_8 = 0x68,
<> 128:9bcdf88f62b0 191 PG_9 = 0x69,
<> 128:9bcdf88f62b0 192 PG_10 = 0x6A,
<> 128:9bcdf88f62b0 193 PG_11 = 0x6B,
<> 128:9bcdf88f62b0 194 PG_12 = 0x6C,
<> 128:9bcdf88f62b0 195 PG_13 = 0x6D,
<> 128:9bcdf88f62b0 196 PG_14 = 0x6E,
<> 128:9bcdf88f62b0 197 PG_15 = 0x6F,
<> 128:9bcdf88f62b0 198
<> 128:9bcdf88f62b0 199 PH_0 = 0x70,
<> 128:9bcdf88f62b0 200 PH_1 = 0x71,
<> 128:9bcdf88f62b0 201
<> 128:9bcdf88f62b0 202 // ADC internal channels
<> 128:9bcdf88f62b0 203 ADC_TEMP = 0xF0,
<> 128:9bcdf88f62b0 204 ADC_VREF = 0xF1,
<> 128:9bcdf88f62b0 205 ADC_VBAT = 0xF2,
<> 128:9bcdf88f62b0 206
<> 128:9bcdf88f62b0 207 // Arduino connector namings
<> 128:9bcdf88f62b0 208 A0 = PA_3,
<> 128:9bcdf88f62b0 209 A1 = PC_0,
<> 128:9bcdf88f62b0 210 A2 = PC_3,
<> 128:9bcdf88f62b0 211 A3 = PF_3,
<> 128:9bcdf88f62b0 212 A4 = PF_5,
<> 128:9bcdf88f62b0 213 A5 = PF_10,
<> 128:9bcdf88f62b0 214 D0 = PG_9,
<> 128:9bcdf88f62b0 215 D1 = PG_14,
<> 128:9bcdf88f62b0 216 D2 = PF_15,
<> 128:9bcdf88f62b0 217 D3 = PE_13,
<> 128:9bcdf88f62b0 218 D4 = PF_14,
<> 128:9bcdf88f62b0 219 D5 = PE_11,
<> 128:9bcdf88f62b0 220 D6 = PE_9,
<> 128:9bcdf88f62b0 221 D7 = PF_13,
<> 128:9bcdf88f62b0 222 D8 = PF_12,
<> 128:9bcdf88f62b0 223 D9 = PD_15,
<> 128:9bcdf88f62b0 224 D10 = PD_14,
<> 128:9bcdf88f62b0 225 D11 = PA_7,
<> 128:9bcdf88f62b0 226 D12 = PA_6,
<> 128:9bcdf88f62b0 227 D13 = PA_5,
<> 128:9bcdf88f62b0 228 D14 = PB_9,
<> 128:9bcdf88f62b0 229 D15 = PB_8,
<> 128:9bcdf88f62b0 230
<> 128:9bcdf88f62b0 231 // Generic signals namings
<> 128:9bcdf88f62b0 232 LED1 = PB_0, // LD1 = GREEN
<> 128:9bcdf88f62b0 233 LED2 = PB_7, // Blue
<> 128:9bcdf88f62b0 234 LED3 = PB_14, // Red
<> 128:9bcdf88f62b0 235 LED4 = PB_0,
<> 128:9bcdf88f62b0 236 USER_BUTTON = PC_13,
<> 128:9bcdf88f62b0 237 SERIAL_TX = PD_8, // Virtual Com Port
<> 128:9bcdf88f62b0 238 SERIAL_RX = PD_9, // Virtual Com Port
<> 128:9bcdf88f62b0 239 USBTX = PD_8, // Virtual Com Port
<> 128:9bcdf88f62b0 240 USBRX = PD_9, // Virtual Com Port
<> 128:9bcdf88f62b0 241 I2C_SCL = D15,
<> 128:9bcdf88f62b0 242 I2C_SDA = D14,
<> 128:9bcdf88f62b0 243 SPI_MOSI = D11,
<> 128:9bcdf88f62b0 244 SPI_MISO = D12,
<> 128:9bcdf88f62b0 245 SPI_SCK = D13,
<> 128:9bcdf88f62b0 246 SPI_CS = D10,
<> 128:9bcdf88f62b0 247 PWM_OUT = D9,
<> 128:9bcdf88f62b0 248
<> 128:9bcdf88f62b0 249 // Not connected
<> 128:9bcdf88f62b0 250 NC = (int)0xFFFFFFFF
<> 128:9bcdf88f62b0 251 } PinName;
<> 128:9bcdf88f62b0 252
<> 128:9bcdf88f62b0 253 typedef enum {
<> 128:9bcdf88f62b0 254 PullNone = 0,
<> 128:9bcdf88f62b0 255 PullUp = 1,
<> 128:9bcdf88f62b0 256 PullDown = 2,
<> 128:9bcdf88f62b0 257 OpenDrain = 3,
<> 128:9bcdf88f62b0 258 PullDefault = PullNone
<> 128:9bcdf88f62b0 259 } PinMode;
<> 128:9bcdf88f62b0 260
<> 128:9bcdf88f62b0 261 #ifdef __cplusplus
<> 128:9bcdf88f62b0 262 }
<> 128:9bcdf88f62b0 263 #endif
<> 128:9bcdf88f62b0 264
<> 128:9bcdf88f62b0 265 #endif