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:
Wed Sep 30 17:00:09 2015 +0100
Revision:
635:a11c0372f0ba
Parent:
625:6502bcae5f2c
Synchronized with git revision d29c98dae61be0946ddf3a3c641c7726056f9452

Full URL: https://github.com/mbedmicro/mbed/commit/d29c98dae61be0946ddf3a3c641c7726056f9452/

Added support for SAMW25

Who changed what in which revision?

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