mbed library with additional peripherals for ST F401 board

Fork of mbed-src by mbed official

This mbed LIB has additional peripherals for ST F401 board

  • UART2 : PA_3 rx, PA_2 tx
  • UART3 : PC_7 rx, PC_6 tx
  • I2C2 : PB_3 SDA, PB_10 SCL
  • I2C3 : PB_4 SDA, PA_8 SCL
Committer:
mbed_official
Date:
Mon Jan 27 14:30:07 2014 +0000
Revision:
76:aeb1df146756
Child:
105:e200768883d5
Synchronized with git revision a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd

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

Add NUCLEO_L152RE

Who changed what in which revision?

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