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:
emilmont
Date:
Fri Feb 21 10:26:12 2014 +0000
Revision:
79:0c05e21ae27e
Parent:
77:869cf507173a
Child:
81:7d30d6019079
Add LPC1549 Target
Change "us_ticker" implementation to 32-bit timer for NUCLEO_L152RE and NUCLEO_F401RE
Update KL05Z CMSIS-CORE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /* mbed Microcontroller Library
emilmont 77:869cf507173a 2 *******************************************************************************
emilmont 77:869cf507173a 3 * Copyright (c) 2014, STMicroelectronics
emilmont 77:869cf507173a 4 * All rights reserved.
emilmont 77:869cf507173a 5 *
emilmont 77:869cf507173a 6 * Redistribution and use in source and binary forms, with or without
emilmont 77:869cf507173a 7 * modification, are permitted provided that the following conditions are met:
emilmont 77:869cf507173a 8 *
emilmont 77:869cf507173a 9 * 1. Redistributions of source code must retain the above copyright notice,
emilmont 77:869cf507173a 10 * this list of conditions and the following disclaimer.
emilmont 77:869cf507173a 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
emilmont 77:869cf507173a 12 * this list of conditions and the following disclaimer in the documentation
emilmont 77:869cf507173a 13 * and/or other materials provided with the distribution.
emilmont 77:869cf507173a 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
emilmont 77:869cf507173a 15 * may be used to endorse or promote products derived from this software
emilmont 77:869cf507173a 16 * without specific prior written permission.
emilmont 77:869cf507173a 17 *
emilmont 77:869cf507173a 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
emilmont 77:869cf507173a 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
emilmont 77:869cf507173a 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
emilmont 77:869cf507173a 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
emilmont 77:869cf507173a 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
emilmont 77:869cf507173a 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
emilmont 77:869cf507173a 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emilmont 77:869cf507173a 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
emilmont 77:869cf507173a 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
emilmont 77:869cf507173a 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
emilmont 77:869cf507173a 28 *******************************************************************************
emilmont 77:869cf507173a 29 */
emilmont 77:869cf507173a 30 #ifndef MBED_PINNAMES_H
emilmont 77:869cf507173a 31 #define MBED_PINNAMES_H
emilmont 77:869cf507173a 32
emilmont 77:869cf507173a 33 #include "cmsis.h"
emilmont 77:869cf507173a 34
emilmont 77:869cf507173a 35 #ifdef __cplusplus
emilmont 77:869cf507173a 36 extern "C" {
emilmont 77:869cf507173a 37 #endif
emilmont 77:869cf507173a 38
emilmont 77:869cf507173a 39 // See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM
emilmont 77:869cf507173a 40 #define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM) << 7) | ((PUPD) << 4) | ((MODE) << 0)))
emilmont 77:869cf507173a 41 #define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
emilmont 77:869cf507173a 42 #define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
emilmont 77:869cf507173a 43 #define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F)
emilmont 77:869cf507173a 44 #define STM_MODE_INPUT (0)
emilmont 77:869cf507173a 45 #define STM_MODE_OUTPUT_PP (1)
emilmont 77:869cf507173a 46 #define STM_MODE_OUTPUT_OD (2)
emilmont 77:869cf507173a 47 #define STM_MODE_AF_PP (3)
emilmont 77:869cf507173a 48 #define STM_MODE_AF_OD (4)
emilmont 77:869cf507173a 49 #define STM_MODE_ANALOG (5)
emilmont 77:869cf507173a 50 #define STM_MODE_IT_RISING (6)
emilmont 77:869cf507173a 51 #define STM_MODE_IT_FALLING (7)
emilmont 77:869cf507173a 52 #define STM_MODE_IT_RISING_FALLING (8)
emilmont 77:869cf507173a 53 #define STM_MODE_EVT_RISING (9)
emilmont 77:869cf507173a 54 #define STM_MODE_EVT_FALLING (10)
emilmont 77:869cf507173a 55 #define STM_MODE_EVT_RISING_FALLING (11)
emilmont 77:869cf507173a 56
emilmont 77:869cf507173a 57 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
emilmont 77:869cf507173a 58 // Low nibble = pin number
emilmont 77:869cf507173a 59 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
emilmont 77:869cf507173a 60 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
emilmont 77:869cf507173a 61
emilmont 77:869cf507173a 62 typedef enum {
emilmont 77:869cf507173a 63 PIN_INPUT,
emilmont 77:869cf507173a 64 PIN_OUTPUT
emilmont 77:869cf507173a 65 } PinDirection;
emilmont 77:869cf507173a 66
emilmont 77:869cf507173a 67 typedef enum {
emilmont 77:869cf507173a 68 PA_0 = 0x00,
emilmont 77:869cf507173a 69 PA_1 = 0x01,
emilmont 77:869cf507173a 70 PA_2 = 0x02,
emilmont 77:869cf507173a 71 PA_3 = 0x03,
emilmont 77:869cf507173a 72 PA_4 = 0x04,
emilmont 77:869cf507173a 73 PA_5 = 0x05,
emilmont 77:869cf507173a 74 PA_6 = 0x06,
emilmont 77:869cf507173a 75 PA_7 = 0x07,
emilmont 77:869cf507173a 76 PA_8 = 0x08,
emilmont 77:869cf507173a 77 PA_9 = 0x09,
emilmont 77:869cf507173a 78 PA_10 = 0x0A,
emilmont 77:869cf507173a 79 PA_11 = 0x0B,
emilmont 77:869cf507173a 80 PA_12 = 0x0C,
emilmont 77:869cf507173a 81 PA_13 = 0x0D,
emilmont 77:869cf507173a 82 PA_14 = 0x0E,
emilmont 77:869cf507173a 83 PA_15 = 0x0F,
emilmont 77:869cf507173a 84
emilmont 77:869cf507173a 85 PB_0 = 0x10,
emilmont 77:869cf507173a 86 PB_1 = 0x11,
emilmont 77:869cf507173a 87 PB_2 = 0x12,
emilmont 77:869cf507173a 88 PB_3 = 0x13,
emilmont 77:869cf507173a 89 PB_4 = 0x14,
emilmont 77:869cf507173a 90 PB_5 = 0x15,
emilmont 77:869cf507173a 91 PB_6 = 0x16,
emilmont 77:869cf507173a 92 PB_7 = 0x17,
emilmont 77:869cf507173a 93 PB_8 = 0x18,
emilmont 77:869cf507173a 94 PB_9 = 0x19,
emilmont 77:869cf507173a 95 PB_10 = 0x1A,
emilmont 77:869cf507173a 96 PB_12 = 0x1C,
emilmont 77:869cf507173a 97 PB_13 = 0x1D,
emilmont 77:869cf507173a 98 PB_14 = 0x1E,
emilmont 77:869cf507173a 99 PB_15 = 0x1F,
emilmont 77:869cf507173a 100
emilmont 77:869cf507173a 101 PC_0 = 0x20,
emilmont 77:869cf507173a 102 PC_1 = 0x21,
emilmont 77:869cf507173a 103 PC_2 = 0x22,
emilmont 77:869cf507173a 104 PC_3 = 0x23,
emilmont 77:869cf507173a 105 PC_4 = 0x24,
emilmont 77:869cf507173a 106 PC_5 = 0x25,
emilmont 77:869cf507173a 107 PC_6 = 0x26,
emilmont 77:869cf507173a 108 PC_7 = 0x27,
emilmont 77:869cf507173a 109 PC_8 = 0x28,
emilmont 77:869cf507173a 110 PC_9 = 0x29,
emilmont 77:869cf507173a 111 PC_10 = 0x2A,
emilmont 77:869cf507173a 112 PC_11 = 0x2B,
emilmont 77:869cf507173a 113 PC_12 = 0x2C,
emilmont 77:869cf507173a 114 PC_13 = 0x2D,
emilmont 77:869cf507173a 115 PC_14 = 0x2E,
emilmont 77:869cf507173a 116 PC_15 = 0x2F,
emilmont 77:869cf507173a 117
emilmont 77:869cf507173a 118 PD_2 = 0x32,
emilmont 77:869cf507173a 119
emilmont 77:869cf507173a 120 PH_0 = 0x70,
emilmont 77:869cf507173a 121 PH_1 = 0x71,
emilmont 77:869cf507173a 122
emilmont 77:869cf507173a 123 // Arduino connector namings
emilmont 77:869cf507173a 124 A0 = PA_0,
emilmont 77:869cf507173a 125 A1 = PA_1,
emilmont 77:869cf507173a 126 A2 = PA_4,
emilmont 77:869cf507173a 127 A3 = PB_0,
emilmont 77:869cf507173a 128 A4 = PC_1,
emilmont 77:869cf507173a 129 A5 = PC_0,
emilmont 77:869cf507173a 130 D0 = PA_3,
emilmont 77:869cf507173a 131 D1 = PA_2,
emilmont 77:869cf507173a 132 D2 = PA_10,
emilmont 77:869cf507173a 133 D3 = PB_3,
emilmont 77:869cf507173a 134 D4 = PB_5,
emilmont 77:869cf507173a 135 D5 = PB_4,
emilmont 77:869cf507173a 136 D6 = PB_10,
emilmont 77:869cf507173a 137 D7 = PA_8,
emilmont 77:869cf507173a 138 D8 = PA_9,
emilmont 77:869cf507173a 139 D9 = PC_7,
emilmont 77:869cf507173a 140 D10 = PB_6,
emilmont 77:869cf507173a 141 D11 = PA_7,
emilmont 77:869cf507173a 142 D12 = PA_6,
emilmont 77:869cf507173a 143 D13 = PA_5,
emilmont 77:869cf507173a 144 D14 = PB_9,
emilmont 77:869cf507173a 145 D15 = PB_8,
emilmont 77:869cf507173a 146
emilmont 77:869cf507173a 147 // Generic signals namings
emilmont 77:869cf507173a 148 LED1 = PA_5,
emilmont 77:869cf507173a 149 LED2 = PA_5,
emilmont 77:869cf507173a 150 LED3 = PA_5,
emilmont 77:869cf507173a 151 LED4 = PA_5,
emilmont 77:869cf507173a 152 USER_BUTTON = PC_13,
emilmont 77:869cf507173a 153 SERIAL_TX = PA_2,
emilmont 77:869cf507173a 154 SERIAL_RX = PA_3,
emilmont 77:869cf507173a 155 I2C_SCL = PB_8,
emilmont 77:869cf507173a 156 I2C_SDA = PB_9,
emilmont 77:869cf507173a 157 SPI_MOSI = PA_7,
emilmont 77:869cf507173a 158 SPI_MISO = PA_6,
emilmont 77:869cf507173a 159 SPI_SCK = PA_5,
emilmont 77:869cf507173a 160 SPI_CS = PB_6,
emilmont 77:869cf507173a 161 PWM_OUT = PB_3,
emilmont 77:869cf507173a 162
emilmont 77:869cf507173a 163 // Not connected
emilmont 77:869cf507173a 164 NC = (int)0xFFFFFFFF
emilmont 77:869cf507173a 165 } PinName;
emilmont 77:869cf507173a 166
emilmont 77:869cf507173a 167 typedef enum {
emilmont 77:869cf507173a 168 PullNone = 0,
emilmont 77:869cf507173a 169 PullUp = 1,
emilmont 77:869cf507173a 170 PullDown = 2,
emilmont 77:869cf507173a 171 OpenDrain = 3
emilmont 77:869cf507173a 172 } PinMode;
emilmont 77:869cf507173a 173
emilmont 77:869cf507173a 174 #ifdef __cplusplus
emilmont 77:869cf507173a 175 }
emilmont 77:869cf507173a 176 #endif
emilmont 77:869cf507173a 177
emilmont 77:869cf507173a 178 #endif