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

Fork of mbed by mbed official

Committer:
emilmont
Date:
Fri Feb 14 14:36:43 2014 +0000
Revision:
77:869cf507173a
Parent:
76:824293ae5e43
Child:
81:7d30d6019079
Release 77 of the mbed library

Main changes:
* Add target NUCLEO_F030R8
* Add target NUCLEO_F401RE
* Add target NUCLEO_F103RB
* Add target NUCLEO_L152RE

Who changed what in which revision?

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