mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Jul 01 08:45:08 2015 +0100
Revision:
578:dd2bc6eabbef
Parent:
511:532f83b66a7f
Synchronized with git revision 2f385f32b21bf73d1efd19b9e6f9c81843e3f26a

Full URL: https://github.com/mbedmicro/mbed/commit/2f385f32b21bf73d1efd19b9e6f9c81843e3f26a/

MTS_DRAGONFLY_F411RE - add additional pin names for SPI and I2C?

Who changed what in which revision?

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