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