mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Child:
157:ff67d9f36b67
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

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