mbed library sources. Supersedes mbed-src.

Fork of mbed by teralytic

Committer:
rodriguise
Date:
Mon Oct 17 18:47:01 2016 +0000
Revision:
148:4802eb17e82b
Parent:
147:30b64687e01f
backup

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 147:30b64687e01f 1 /* mbed Microcontroller Library
<> 147:30b64687e01f 2 *******************************************************************************
<> 147:30b64687e01f 3 * Copyright (c) 2015, STMicroelectronics
<> 147:30b64687e01f 4 * All rights reserved.
<> 147:30b64687e01f 5 *
<> 147:30b64687e01f 6 * Redistribution and use in source and binary forms, with or without
<> 147:30b64687e01f 7 * modification, are permitted provided that the following conditions are met:
<> 147:30b64687e01f 8 *
<> 147:30b64687e01f 9 * 1. Redistributions of source code must retain the above copyright notice,
<> 147:30b64687e01f 10 * this list of conditions and the following disclaimer.
<> 147:30b64687e01f 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 147:30b64687e01f 12 * this list of conditions and the following disclaimer in the documentation
<> 147:30b64687e01f 13 * and/or other materials provided with the distribution.
<> 147:30b64687e01f 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 147:30b64687e01f 15 * may be used to endorse or promote products derived from this software
<> 147:30b64687e01f 16 * without specific prior written permission.
<> 147:30b64687e01f 17 *
<> 147:30b64687e01f 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 147:30b64687e01f 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 147:30b64687e01f 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 147:30b64687e01f 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 147:30b64687e01f 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 147:30b64687e01f 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 147:30b64687e01f 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 147:30b64687e01f 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 147:30b64687e01f 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 147:30b64687e01f 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 147:30b64687e01f 28 *******************************************************************************
<> 147:30b64687e01f 29 */
<> 147:30b64687e01f 30 #ifndef MBED_PINNAMES_H
<> 147:30b64687e01f 31 #define MBED_PINNAMES_H
<> 147:30b64687e01f 32
<> 147:30b64687e01f 33 #include "cmsis.h"
<> 147:30b64687e01f 34
<> 147:30b64687e01f 35 #ifdef __cplusplus
<> 147:30b64687e01f 36 extern "C" {
<> 147:30b64687e01f 37 #endif
<> 147:30b64687e01f 38
<> 147:30b64687e01f 39 #define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\
<> 147:30b64687e01f 40 ((PUPD & 0x07) << 4) |\
<> 147:30b64687e01f 41 ((AFNUM & 0x0F) << 7)))
<> 147:30b64687e01f 42
<> 147:30b64687e01f 43 #define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\
<> 147:30b64687e01f 44 ((PUPD & 0x07) << 4) |\
<> 147:30b64687e01f 45 ((AFNUM & 0x0F) << 7) |\
<> 147:30b64687e01f 46 ((CHANNEL & 0x0F) << 11) |\
<> 147:30b64687e01f 47 ((INVERTED & 0x01) << 15)))
<> 147:30b64687e01f 48
<> 147:30b64687e01f 49 #define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
<> 147:30b64687e01f 50 #define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
<> 147:30b64687e01f 51 #define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F)
<> 147:30b64687e01f 52 #define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x0F)
<> 147:30b64687e01f 53 #define STM_PIN_INVERTED(X) (((X) >> 15) & 0x01)
<> 147:30b64687e01f 54
<> 147:30b64687e01f 55 #define STM_MODE_INPUT (0)
<> 147:30b64687e01f 56 #define STM_MODE_OUTPUT_PP (1)
<> 147:30b64687e01f 57 #define STM_MODE_OUTPUT_OD (2)
<> 147:30b64687e01f 58 #define STM_MODE_AF_PP (3)
<> 147:30b64687e01f 59 #define STM_MODE_AF_OD (4)
<> 147:30b64687e01f 60 #define STM_MODE_ANALOG (5)
<> 147:30b64687e01f 61 #define STM_MODE_IT_RISING (6)
<> 147:30b64687e01f 62 #define STM_MODE_IT_FALLING (7)
<> 147:30b64687e01f 63 #define STM_MODE_IT_RISING_FALLING (8)
<> 147:30b64687e01f 64 #define STM_MODE_EVT_RISING (9)
<> 147:30b64687e01f 65 #define STM_MODE_EVT_FALLING (10)
<> 147:30b64687e01f 66 #define STM_MODE_EVT_RISING_FALLING (11)
<> 147:30b64687e01f 67 #define STM_MODE_IT_EVT_RESET (12)
<> 147:30b64687e01f 68
<> 147:30b64687e01f 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)
<> 147:30b64687e01f 70 // Low nibble = pin number
<> 147:30b64687e01f 71 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
<> 147:30b64687e01f 72 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
<> 147:30b64687e01f 73
<> 147:30b64687e01f 74 typedef enum {
<> 147:30b64687e01f 75 PIN_INPUT,
<> 147:30b64687e01f 76 PIN_OUTPUT
<> 147:30b64687e01f 77 } PinDirection;
<> 147:30b64687e01f 78
<> 147:30b64687e01f 79 typedef enum {
<> 147:30b64687e01f 80 PA_0 = 0x00,
<> 147:30b64687e01f 81 PA_1 = 0x01,
<> 147:30b64687e01f 82 PA_2 = 0x02,
<> 147:30b64687e01f 83 PA_3 = 0x03,
<> 147:30b64687e01f 84 PA_4 = 0x04,
<> 147:30b64687e01f 85 PA_5 = 0x05,
<> 147:30b64687e01f 86 PA_6 = 0x06,
<> 147:30b64687e01f 87 PA_7 = 0x07,
<> 147:30b64687e01f 88 PA_8 = 0x08,
<> 147:30b64687e01f 89 PA_9 = 0x09,
<> 147:30b64687e01f 90 PA_10 = 0x0A,
<> 147:30b64687e01f 91 PA_11 = 0x0B,
<> 147:30b64687e01f 92 PA_12 = 0x0C,
<> 147:30b64687e01f 93 PA_13 = 0x0D,
<> 147:30b64687e01f 94 PA_14 = 0x0E,
<> 147:30b64687e01f 95 PA_15 = 0x0F,
<> 147:30b64687e01f 96
<> 147:30b64687e01f 97 PB_0 = 0x10,
<> 147:30b64687e01f 98 PB_1 = 0x11,
<> 147:30b64687e01f 99 PB_2 = 0x12,
<> 147:30b64687e01f 100 PB_3 = 0x13,
<> 147:30b64687e01f 101 PB_4 = 0x14,
<> 147:30b64687e01f 102 PB_5 = 0x15,
<> 147:30b64687e01f 103 PB_6 = 0x16,
<> 147:30b64687e01f 104 PB_7 = 0x17,
<> 147:30b64687e01f 105 PB_8 = 0x18,
<> 147:30b64687e01f 106 PB_9 = 0x19,
<> 147:30b64687e01f 107 PB_10 = 0x1A,
<> 147:30b64687e01f 108 PB_11 = 0x1B,
<> 147:30b64687e01f 109 PB_12 = 0x1C,
<> 147:30b64687e01f 110 PB_13 = 0x1D,
<> 147:30b64687e01f 111 PB_14 = 0x1E,
<> 147:30b64687e01f 112 PB_15 = 0x1F,
<> 147:30b64687e01f 113
<> 147:30b64687e01f 114 PC_0 = 0x20,
<> 147:30b64687e01f 115 PC_1 = 0x21,
<> 147:30b64687e01f 116 PC_2 = 0x22,
<> 147:30b64687e01f 117 PC_3 = 0x23,
<> 147:30b64687e01f 118 PC_4 = 0x24,
<> 147:30b64687e01f 119 PC_5 = 0x25,
<> 147:30b64687e01f 120 PC_6 = 0x26,
<> 147:30b64687e01f 121 PC_7 = 0x27,
<> 147:30b64687e01f 122 PC_8 = 0x28,
<> 147:30b64687e01f 123 PC_9 = 0x29,
<> 147:30b64687e01f 124 PC_10 = 0x2A,
<> 147:30b64687e01f 125 PC_11 = 0x2B,
<> 147:30b64687e01f 126 PC_12 = 0x2C,
<> 147:30b64687e01f 127 PC_13 = 0x2D,
<> 147:30b64687e01f 128 PC_14 = 0x2E,
<> 147:30b64687e01f 129 PC_15 = 0x2F,
<> 147:30b64687e01f 130
<> 147:30b64687e01f 131 PD_0 = 0x30,
<> 147:30b64687e01f 132 PD_1 = 0x31,
<> 147:30b64687e01f 133 PD_2 = 0x32,
<> 147:30b64687e01f 134 PD_3 = 0x33,
<> 147:30b64687e01f 135 PD_4 = 0x34,
<> 147:30b64687e01f 136 PD_5 = 0x35,
<> 147:30b64687e01f 137 PD_6 = 0x36,
<> 147:30b64687e01f 138 PD_7 = 0x37,
<> 147:30b64687e01f 139 PD_8 = 0x38,
<> 147:30b64687e01f 140 PD_9 = 0x39,
<> 147:30b64687e01f 141 PD_10 = 0x3A,
<> 147:30b64687e01f 142 PD_11 = 0x3B,
<> 147:30b64687e01f 143 PD_12 = 0x3C,
<> 147:30b64687e01f 144 PD_13 = 0x3D,
<> 147:30b64687e01f 145 PD_14 = 0x3E,
<> 147:30b64687e01f 146 PD_15 = 0x3F,
<> 147:30b64687e01f 147
<> 147:30b64687e01f 148 PE_0 = 0x40,
<> 147:30b64687e01f 149 PE_1 = 0x41,
<> 147:30b64687e01f 150 PE_2 = 0x42,
<> 147:30b64687e01f 151 PE_3 = 0x43,
<> 147:30b64687e01f 152 PE_4 = 0x44,
<> 147:30b64687e01f 153 PE_5 = 0x45,
<> 147:30b64687e01f 154 PE_6 = 0x46,
<> 147:30b64687e01f 155 PE_7 = 0x47,
<> 147:30b64687e01f 156 PE_8 = 0x48,
<> 147:30b64687e01f 157 PE_9 = 0x49,
<> 147:30b64687e01f 158 PE_10 = 0x4A,
<> 147:30b64687e01f 159 PE_11 = 0x4B,
<> 147:30b64687e01f 160 PE_12 = 0x4C,
<> 147:30b64687e01f 161 PE_13 = 0x4D,
<> 147:30b64687e01f 162 PE_14 = 0x4E,
<> 147:30b64687e01f 163 PE_15 = 0x4F,
<> 147:30b64687e01f 164
<> 147:30b64687e01f 165 PF_0 = 0x50,
<> 147:30b64687e01f 166 PF_1 = 0x51,
<> 147:30b64687e01f 167 PF_2 = 0x52,
<> 147:30b64687e01f 168 PF_3 = 0x53,
<> 147:30b64687e01f 169 PF_4 = 0x54,
<> 147:30b64687e01f 170 PF_5 = 0x55,
<> 147:30b64687e01f 171 PF_6 = 0x56,
<> 147:30b64687e01f 172 PF_7 = 0x57,
<> 147:30b64687e01f 173 PF_8 = 0x58,
<> 147:30b64687e01f 174 PF_9 = 0x59,
<> 147:30b64687e01f 175 PF_10 = 0x5A,
<> 147:30b64687e01f 176 PF_11 = 0x5B,
<> 147:30b64687e01f 177 PF_12 = 0x5C,
<> 147:30b64687e01f 178 PF_13 = 0x5D,
<> 147:30b64687e01f 179 PF_14 = 0x5E,
<> 147:30b64687e01f 180 PF_15 = 0x5F,
<> 147:30b64687e01f 181
<> 147:30b64687e01f 182 PG_0 = 0x60,
<> 147:30b64687e01f 183 PG_1 = 0x61,
<> 147:30b64687e01f 184 PG_2 = 0x62,
<> 147:30b64687e01f 185 PG_3 = 0x63,
<> 147:30b64687e01f 186 PG_4 = 0x64,
<> 147:30b64687e01f 187 PG_5 = 0x65,
<> 147:30b64687e01f 188 PG_6 = 0x66,
<> 147:30b64687e01f 189 PG_7 = 0x67,
<> 147:30b64687e01f 190 PG_8 = 0x68,
<> 147:30b64687e01f 191 PG_9 = 0x69,
<> 147:30b64687e01f 192 PG_10 = 0x6A,
<> 147:30b64687e01f 193 PG_11 = 0x6B,
<> 147:30b64687e01f 194 PG_12 = 0x6C,
<> 147:30b64687e01f 195 PG_13 = 0x6D,
<> 147:30b64687e01f 196 PG_14 = 0x6E,
<> 147:30b64687e01f 197 PG_15 = 0x6F,
<> 147:30b64687e01f 198
<> 147:30b64687e01f 199 PH_0 = 0x70,
<> 147:30b64687e01f 200 PH_1 = 0x71,
<> 147:30b64687e01f 201 PH_2 = 0x72,
<> 147:30b64687e01f 202 PH_3 = 0x73,
<> 147:30b64687e01f 203 PH_4 = 0x74,
<> 147:30b64687e01f 204 PH_5 = 0x75,
<> 147:30b64687e01f 205 PH_6 = 0x76,
<> 147:30b64687e01f 206 PH_7 = 0x77,
<> 147:30b64687e01f 207 PH_8 = 0x78,
<> 147:30b64687e01f 208 PH_9 = 0x79,
<> 147:30b64687e01f 209 PH_10 = 0x7A,
<> 147:30b64687e01f 210 PH_11 = 0x7B,
<> 147:30b64687e01f 211 PH_12 = 0x7C,
<> 147:30b64687e01f 212 PH_13 = 0x7D,
<> 147:30b64687e01f 213 PH_14 = 0x7E,
<> 147:30b64687e01f 214 PH_15 = 0x7F,
<> 147:30b64687e01f 215
<> 147:30b64687e01f 216 PI_0 = 0x80,
<> 147:30b64687e01f 217 PI_1 = 0x81,
<> 147:30b64687e01f 218 PI_2 = 0x82,
<> 147:30b64687e01f 219 PI_3 = 0x83,
<> 147:30b64687e01f 220 PI_4 = 0x84,
<> 147:30b64687e01f 221 PI_5 = 0x85,
<> 147:30b64687e01f 222 PI_6 = 0x86,
<> 147:30b64687e01f 223 PI_7 = 0x87,
<> 147:30b64687e01f 224 PI_8 = 0x88,
<> 147:30b64687e01f 225 PI_9 = 0x89,
<> 147:30b64687e01f 226 PI_10 = 0x8A,
<> 147:30b64687e01f 227 PI_11 = 0x8B,
<> 147:30b64687e01f 228 PI_12 = 0x8C,
<> 147:30b64687e01f 229 PI_13 = 0x8D,
<> 147:30b64687e01f 230 PI_14 = 0x8E,
<> 147:30b64687e01f 231 PI_15 = 0x8F,
<> 147:30b64687e01f 232
<> 147:30b64687e01f 233 PJ_0 = 0x90,
<> 147:30b64687e01f 234 PJ_1 = 0x91,
<> 147:30b64687e01f 235 PJ_2 = 0x92,
<> 147:30b64687e01f 236 PJ_3 = 0x93,
<> 147:30b64687e01f 237 PJ_4 = 0x94,
<> 147:30b64687e01f 238 PJ_5 = 0x95,
<> 147:30b64687e01f 239 PJ_6 = 0x96,
<> 147:30b64687e01f 240 PJ_7 = 0x97,
<> 147:30b64687e01f 241 PJ_8 = 0x98,
<> 147:30b64687e01f 242 PJ_9 = 0x99,
<> 147:30b64687e01f 243 PJ_10 = 0x9A,
<> 147:30b64687e01f 244 PJ_11 = 0x9B,
<> 147:30b64687e01f 245 PJ_12 = 0x9C,
<> 147:30b64687e01f 246 PJ_13 = 0x9D,
<> 147:30b64687e01f 247 PJ_14 = 0x9E,
<> 147:30b64687e01f 248 PJ_15 = 0x9F,
<> 147:30b64687e01f 249
<> 147:30b64687e01f 250 PK_0 = 0xA0,
<> 147:30b64687e01f 251 PK_1 = 0xA1,
<> 147:30b64687e01f 252 PK_2 = 0xA2,
<> 147:30b64687e01f 253 PK_3 = 0xA3,
<> 147:30b64687e01f 254 PK_4 = 0xA4,
<> 147:30b64687e01f 255 PK_5 = 0xA5,
<> 147:30b64687e01f 256 PK_6 = 0xA6,
<> 147:30b64687e01f 257 PK_7 = 0xA7,
<> 147:30b64687e01f 258
<> 147:30b64687e01f 259 // Arduino connector namings
<> 147:30b64687e01f 260 A0 = PA_6,
<> 147:30b64687e01f 261 A1 = PA_4,
<> 147:30b64687e01f 262 A2 = PC_2,
<> 147:30b64687e01f 263 A3 = PF_10,
<> 147:30b64687e01f 264 A4 = PF_8,
<> 147:30b64687e01f 265 A5 = PF_9,
<> 147:30b64687e01f 266 D0 = PC_7,
<> 147:30b64687e01f 267 D1 = PC_6,
<> 147:30b64687e01f 268 D2 = PJ_1,
<> 147:30b64687e01f 269 D3 = PF_6,
<> 147:30b64687e01f 270 D4 = PJ_0,
<> 147:30b64687e01f 271 D5 = PC_8,
<> 147:30b64687e01f 272 D6 = PF_7,
<> 147:30b64687e01f 273 D7 = PJ_3,
<> 147:30b64687e01f 274 D8 = PJ_4,
<> 147:30b64687e01f 275 D9 = PH_6,
<> 147:30b64687e01f 276 D10 = PA_11,
<> 147:30b64687e01f 277 D11 = PB_15,
<> 147:30b64687e01f 278 D12 = PB_14,
<> 147:30b64687e01f 279 D13 = PA_12,
<> 147:30b64687e01f 280 D14 = PB_9,
<> 147:30b64687e01f 281 D15 = PB_8,
<> 147:30b64687e01f 282
<> 147:30b64687e01f 283 // Generic signals namings
<> 147:30b64687e01f 284 LED1 = PJ_13, // LD1 = RED
<> 147:30b64687e01f 285 LED2 = PJ_5, // LD2 = GREEN
<> 147:30b64687e01f 286 LED3 = PA_12, // LD3 = GREEN
<> 147:30b64687e01f 287 LED4 = PJ_13,
<> 147:30b64687e01f 288 USER_BUTTON = PA_0,
<> 147:30b64687e01f 289 SERIAL_TX = PA_9, // Virtual Com Port
<> 147:30b64687e01f 290 SERIAL_RX = PA_10, // Virtual Com Port
<> 147:30b64687e01f 291 USBTX = PA_9, // Virtual Com Port
<> 147:30b64687e01f 292 USBRX = PA_10, // Virtual Com Port
<> 147:30b64687e01f 293 I2C_SCL = D15,
<> 147:30b64687e01f 294 I2C_SDA = D14,
<> 147:30b64687e01f 295 SPI_MOSI = D11,
<> 147:30b64687e01f 296 SPI_MISO = D12,
<> 147:30b64687e01f 297 SPI_SCK = D13,
<> 147:30b64687e01f 298 SPI_CS = D10,
<> 147:30b64687e01f 299 PWM_OUT = D9,
<> 147:30b64687e01f 300
<> 147:30b64687e01f 301 // Not connected
<> 147:30b64687e01f 302 NC = (int)0xFFFFFFFF
<> 147:30b64687e01f 303 } PinName;
<> 147:30b64687e01f 304
<> 147:30b64687e01f 305 typedef enum {
<> 147:30b64687e01f 306 PullNone = 0,
<> 147:30b64687e01f 307 PullUp = 1,
<> 147:30b64687e01f 308 PullDown = 2,
<> 147:30b64687e01f 309 OpenDrain = 3,
<> 147:30b64687e01f 310 PullDefault = PullNone
<> 147:30b64687e01f 311 } PinMode;
<> 147:30b64687e01f 312
<> 147:30b64687e01f 313 #ifdef __cplusplus
<> 147:30b64687e01f 314 }
<> 147:30b64687e01f 315 #endif
<> 147:30b64687e01f 316
<> 147:30b64687e01f 317 #endif