mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Thu Apr 09 12:15:08 2015 +0100
Revision:
511:532f83b66a7f
Parent:
498:b3c41e21851c
Synchronized with git revision 5a81e89daabb57e88c45a1c1979735071b85fa00

Full URL: https://github.com/mbedmicro/mbed/commit/5a81e89daabb57e88c45a1c1979735071b85fa00/

TARGET_STMF4 - reorg hal

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 429:cc5da43e7bf6 1 /* mbed Microcontroller Library
mbed_official 429:cc5da43e7bf6 2 *******************************************************************************
mbed_official 429:cc5da43e7bf6 3 * Copyright (c) 2014, STMicroelectronics
mbed_official 429:cc5da43e7bf6 4 * All rights reserved.
mbed_official 429:cc5da43e7bf6 5 *
mbed_official 429:cc5da43e7bf6 6 * Redistribution and use in source and binary forms, with or without
mbed_official 429:cc5da43e7bf6 7 * modification, are permitted provided that the following conditions are met:
mbed_official 429:cc5da43e7bf6 8 *
mbed_official 429:cc5da43e7bf6 9 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 429:cc5da43e7bf6 10 * this list of conditions and the following disclaimer.
mbed_official 429:cc5da43e7bf6 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 429:cc5da43e7bf6 12 * this list of conditions and the following disclaimer in the documentation
mbed_official 429:cc5da43e7bf6 13 * and/or other materials provided with the distribution.
mbed_official 429:cc5da43e7bf6 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 429:cc5da43e7bf6 15 * may be used to endorse or promote products derived from this software
mbed_official 429:cc5da43e7bf6 16 * without specific prior written permission.
mbed_official 429:cc5da43e7bf6 17 *
mbed_official 429:cc5da43e7bf6 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 429:cc5da43e7bf6 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 429:cc5da43e7bf6 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 429:cc5da43e7bf6 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 429:cc5da43e7bf6 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 429:cc5da43e7bf6 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 429:cc5da43e7bf6 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 429:cc5da43e7bf6 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 429:cc5da43e7bf6 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 429:cc5da43e7bf6 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 429:cc5da43e7bf6 28 *******************************************************************************
mbed_official 429:cc5da43e7bf6 29 */
mbed_official 429:cc5da43e7bf6 30 #ifndef MBED_PINNAMES_H
mbed_official 429:cc5da43e7bf6 31 #define MBED_PINNAMES_H
mbed_official 429:cc5da43e7bf6 32
mbed_official 429:cc5da43e7bf6 33 #include "cmsis.h"
mbed_official 429:cc5da43e7bf6 34
mbed_official 429:cc5da43e7bf6 35 #ifdef __cplusplus
mbed_official 429:cc5da43e7bf6 36 extern "C" {
mbed_official 429:cc5da43e7bf6 37 #endif
mbed_official 429:cc5da43e7bf6 38
mbed_official 429:cc5da43e7bf6 39 // See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM
mbed_official 429:cc5da43e7bf6 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 429:cc5da43e7bf6 42 #define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
mbed_official 429:cc5da43e7bf6 43 #define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
mbed_official 429:cc5da43e7bf6 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 429:cc5da43e7bf6 47 #define STM_MODE_INPUT (0)
mbed_official 429:cc5da43e7bf6 48 #define STM_MODE_OUTPUT_PP (1)
mbed_official 429:cc5da43e7bf6 49 #define STM_MODE_OUTPUT_OD (2)
mbed_official 429:cc5da43e7bf6 50 #define STM_MODE_AF_PP (3)
mbed_official 429:cc5da43e7bf6 51 #define STM_MODE_AF_OD (4)
mbed_official 429:cc5da43e7bf6 52 #define STM_MODE_ANALOG (5)
mbed_official 429:cc5da43e7bf6 53 #define STM_MODE_IT_RISING (6)
mbed_official 429:cc5da43e7bf6 54 #define STM_MODE_IT_FALLING (7)
mbed_official 429:cc5da43e7bf6 55 #define STM_MODE_IT_RISING_FALLING (8)
mbed_official 429:cc5da43e7bf6 56 #define STM_MODE_EVT_RISING (9)
mbed_official 429:cc5da43e7bf6 57 #define STM_MODE_EVT_FALLING (10)
mbed_official 429:cc5da43e7bf6 58 #define STM_MODE_EVT_RISING_FALLING (11)
mbed_official 429:cc5da43e7bf6 59 #define STM_MODE_IT_EVT_RESET (12)
mbed_official 429:cc5da43e7bf6 60
mbed_official 429:cc5da43e7bf6 61 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
mbed_official 429:cc5da43e7bf6 62 // Low nibble = pin number
mbed_official 429:cc5da43e7bf6 63 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
mbed_official 429:cc5da43e7bf6 64 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
mbed_official 429:cc5da43e7bf6 65
mbed_official 429:cc5da43e7bf6 66 typedef enum {
mbed_official 429:cc5da43e7bf6 67 PIN_INPUT,
mbed_official 429:cc5da43e7bf6 68 PIN_OUTPUT
mbed_official 429:cc5da43e7bf6 69 } PinDirection;
mbed_official 429:cc5da43e7bf6 70
mbed_official 429:cc5da43e7bf6 71 typedef enum {
mbed_official 429:cc5da43e7bf6 72 PA_0 = 0x00,
mbed_official 429:cc5da43e7bf6 73 PA_1 = 0x01,
mbed_official 429:cc5da43e7bf6 74 PA_2 = 0x02,
mbed_official 429:cc5da43e7bf6 75 PA_3 = 0x03,
mbed_official 429:cc5da43e7bf6 76 PA_4 = 0x04,
mbed_official 429:cc5da43e7bf6 77 PA_5 = 0x05,
mbed_official 429:cc5da43e7bf6 78 PA_6 = 0x06,
mbed_official 429:cc5da43e7bf6 79 PA_7 = 0x07,
mbed_official 429:cc5da43e7bf6 80 PA_8 = 0x08,
mbed_official 429:cc5da43e7bf6 81 PA_9 = 0x09,
mbed_official 429:cc5da43e7bf6 82 PA_10 = 0x0A,
mbed_official 429:cc5da43e7bf6 83 PA_11 = 0x0B,
mbed_official 429:cc5da43e7bf6 84 PA_12 = 0x0C,
mbed_official 429:cc5da43e7bf6 85 PA_13 = 0x0D,
mbed_official 429:cc5da43e7bf6 86 PA_14 = 0x0E,
mbed_official 429:cc5da43e7bf6 87 PA_15 = 0x0F,
mbed_official 429:cc5da43e7bf6 88
mbed_official 429:cc5da43e7bf6 89 PB_0 = 0x10,
mbed_official 429:cc5da43e7bf6 90 PB_1 = 0x11,
mbed_official 429:cc5da43e7bf6 91 PB_2 = 0x12,
mbed_official 429:cc5da43e7bf6 92 PB_3 = 0x13,
mbed_official 429:cc5da43e7bf6 93 PB_4 = 0x14,
mbed_official 429:cc5da43e7bf6 94 PB_5 = 0x15,
mbed_official 429:cc5da43e7bf6 95 PB_6 = 0x16,
mbed_official 429:cc5da43e7bf6 96 PB_7 = 0x17,
mbed_official 429:cc5da43e7bf6 97 PB_8 = 0x18,
mbed_official 429:cc5da43e7bf6 98 PB_9 = 0x19,
mbed_official 429:cc5da43e7bf6 99 PB_10 = 0x1A,
mbed_official 429:cc5da43e7bf6 100 PB_12 = 0x1C,
mbed_official 429:cc5da43e7bf6 101 PB_13 = 0x1D,
mbed_official 429:cc5da43e7bf6 102 PB_14 = 0x1E,
mbed_official 429:cc5da43e7bf6 103 PB_15 = 0x1F,
mbed_official 429:cc5da43e7bf6 104
mbed_official 429:cc5da43e7bf6 105 PC_0 = 0x20,
mbed_official 429:cc5da43e7bf6 106 PC_1 = 0x21,
mbed_official 429:cc5da43e7bf6 107 PC_2 = 0x22,
mbed_official 429:cc5da43e7bf6 108 PC_3 = 0x23,
mbed_official 429:cc5da43e7bf6 109 PC_4 = 0x24,
mbed_official 429:cc5da43e7bf6 110 PC_5 = 0x25,
mbed_official 429:cc5da43e7bf6 111 PC_6 = 0x26,
mbed_official 429:cc5da43e7bf6 112 PC_7 = 0x27,
mbed_official 429:cc5da43e7bf6 113 PC_8 = 0x28,
mbed_official 429:cc5da43e7bf6 114 PC_9 = 0x29,
mbed_official 429:cc5da43e7bf6 115 PC_10 = 0x2A,
mbed_official 429:cc5da43e7bf6 116 PC_11 = 0x2B,
mbed_official 429:cc5da43e7bf6 117 PC_12 = 0x2C,
mbed_official 429:cc5da43e7bf6 118 PC_13 = 0x2D,
mbed_official 429:cc5da43e7bf6 119 PC_14 = 0x2E,
mbed_official 429:cc5da43e7bf6 120 PC_15 = 0x2F,
mbed_official 429:cc5da43e7bf6 121
mbed_official 429:cc5da43e7bf6 122 PD_2 = 0x32,
mbed_official 429:cc5da43e7bf6 123
mbed_official 429:cc5da43e7bf6 124 PH_0 = 0x70,
mbed_official 429:cc5da43e7bf6 125 PH_1 = 0x71,
mbed_official 429:cc5da43e7bf6 126
mbed_official 429:cc5da43e7bf6 127 // Generic signals namings
mbed_official 498:b3c41e21851c 128 XBEE_DOUT = PA_2,
mbed_official 498:b3c41e21851c 129 XBEE_DIN = PA_3,
mbed_official 498:b3c41e21851c 130 XBEE_AD0 = PB_1,
mbed_official 498:b3c41e21851c 131 XBEE_AD1 = PB_0,
mbed_official 498:b3c41e21851c 132 XBEE_AD2 = PA_5,
mbed_official 498:b3c41e21851c 133 XBEE_AD3 = PA_4,
mbed_official 498:b3c41e21851c 134 XBEE_AD4 = PA_7,
mbed_official 498:b3c41e21851c 135 XBEE_AD5 = PC_1,
mbed_official 498:b3c41e21851c 136 XBEE_AD6 = PA_1,
mbed_official 498:b3c41e21851c 137 XBEE_DIO0 = PB_1,
mbed_official 498:b3c41e21851c 138 XBEE_DIO1 = PB_0,
mbed_official 498:b3c41e21851c 139 XBEE_DIO2 = PA_5,
mbed_official 498:b3c41e21851c 140 XBEE_DIO3 = PA_4,
mbed_official 498:b3c41e21851c 141 XBEE_DIO4 = PA_7,
mbed_official 498:b3c41e21851c 142 XBEE_DIO5 = PC_1,
mbed_official 498:b3c41e21851c 143 XBEE_DIO6 = PA_1,
mbed_official 498:b3c41e21851c 144 XBEE_DO8 = PA_6,
mbed_official 498:b3c41e21851c 145 XBEE_DI8 = PA_11,
mbed_official 498:b3c41e21851c 146 XBEE_PWM0 = PA_8,
mbed_official 498:b3c41e21851c 147 XBEE_PWM1 = PC_9,
mbed_official 498:b3c41e21851c 148 XBEE_CTS = PA_0,
mbed_official 498:b3c41e21851c 149 XBEE_RTS = PA_1,
mbed_official 498:b3c41e21851c 150 XBEE_DTR = PA_11,
mbed_official 498:b3c41e21851c 151 XBEE_RSSI = PA_8,
mbed_official 498:b3c41e21851c 152 XBEE_SLEEPRQ = PA_11,
mbed_official 498:b3c41e21851c 153 XBEE_ON_SLEEP = PC_13,
mbed_official 498:b3c41e21851c 154 XBEE_ASSOCIATE = PC_1,
mbed_official 498:b3c41e21851c 155 XBEE_USB_RES = PA_12,
mbed_official 429:cc5da43e7bf6 156
mbed_official 498:b3c41e21851c 157 // needed for mbed to build tests
mbed_official 498:b3c41e21851c 158 LED1 = PA_0,
mbed_official 498:b3c41e21851c 159
mbed_official 498:b3c41e21851c 160 // XBEE_DOUT/DIN, RS232 port on UDK board
mbed_official 498:b3c41e21851c 161 SERIAL_TX = PA_2,
mbed_official 498:b3c41e21851c 162 SERIAL_RX = PA_3,
mbed_official 498:b3c41e21851c 163
mbed_official 498:b3c41e21851c 164 // DB_TX/RX, USB port on UDK board
mbed_official 498:b3c41e21851c 165 DB_TX = PA_9,
mbed_official 498:b3c41e21851c 166 DB_RX = PA_10,
mbed_official 498:b3c41e21851c 167 USBTX = PA_9,
mbed_official 498:b3c41e21851c 168 USBRX = PA_10,
mbed_official 498:b3c41e21851c 169
mbed_official 498:b3c41e21851c 170 // Multiplexed with XBEE pins
mbed_official 429:cc5da43e7bf6 171 I2C_SCL = PA_8,
mbed_official 429:cc5da43e7bf6 172 I2C_SDA = PC_9,
mbed_official 498:b3c41e21851c 173 SPI1_MOSI = PA_7,
mbed_official 498:b3c41e21851c 174 SPI1_MISO = PA_6,
mbed_official 498:b3c41e21851c 175 SPI1_SCK = PA_5,
mbed_official 498:b3c41e21851c 176 SPI1_CS = PA_4,
mbed_official 498:b3c41e21851c 177
mbed_official 498:b3c41e21851c 178 // SPI flash
mbed_official 498:b3c41e21851c 179 SPI3_MOSI = PC_12,
mbed_official 498:b3c41e21851c 180 SPI3_MISO = PC_11,
mbed_official 498:b3c41e21851c 181 SPI3_SCK = PC_10,
mbed_official 498:b3c41e21851c 182 SPI3_CS = PC_6,
mbed_official 498:b3c41e21851c 183 FLASH_HOLD = PC_7,
mbed_official 498:b3c41e21851c 184 FLASH_WP = PC_8,
mbed_official 498:b3c41e21851c 185
mbed_official 498:b3c41e21851c 186 // LoRa
mbed_official 498:b3c41e21851c 187 LORA_RESET = PC_0,
mbed_official 498:b3c41e21851c 188 LORA_RXCTL = PC_2,
mbed_official 498:b3c41e21851c 189 LORA_TXCTL = PC_3,
mbed_official 498:b3c41e21851c 190 LORA_DIO0 = PB_5,
mbed_official 498:b3c41e21851c 191 LORA_DIO1 = PB_6,
mbed_official 498:b3c41e21851c 192 LORA_DIO2 = PB_7,
mbed_official 498:b3c41e21851c 193 LORA_DIO3 = PB_8,
mbed_official 498:b3c41e21851c 194 LORA_DIO4 = PB_9,
mbed_official 498:b3c41e21851c 195 LORA_DIO5 = PB_10,
mbed_official 498:b3c41e21851c 196 // LoRa/SPI2
mbed_official 498:b3c41e21851c 197 LORA_NSS = PB_12,
mbed_official 498:b3c41e21851c 198 LORA_SCK = PB_13,
mbed_official 498:b3c41e21851c 199 LORA_MISO = PB_14,
mbed_official 498:b3c41e21851c 200 LORA_MOSI = PB_15,
mbed_official 429:cc5da43e7bf6 201
mbed_official 429:cc5da43e7bf6 202 // Not connected
mbed_official 429:cc5da43e7bf6 203 NC = (int)0xFFFFFFFF
mbed_official 429:cc5da43e7bf6 204 } PinName;
mbed_official 429:cc5da43e7bf6 205
mbed_official 429:cc5da43e7bf6 206 typedef enum {
mbed_official 429:cc5da43e7bf6 207 PullNone = 0,
mbed_official 429:cc5da43e7bf6 208 PullUp = 1,
mbed_official 429:cc5da43e7bf6 209 PullDown = 2,
mbed_official 429:cc5da43e7bf6 210 OpenDrain = 3,
mbed_official 429:cc5da43e7bf6 211 PullDefault = PullNone
mbed_official 429:cc5da43e7bf6 212 } PinMode;
mbed_official 429:cc5da43e7bf6 213
mbed_official 429:cc5da43e7bf6 214 #ifdef __cplusplus
mbed_official 429:cc5da43e7bf6 215 }
mbed_official 429:cc5da43e7bf6 216 #endif
mbed_official 429:cc5da43e7bf6 217
mbed_official 429:cc5da43e7bf6 218 #endif