Ermanno Brusadin / mbed-src
Committer:
ebrus
Date:
Wed Jul 27 18:35:32 2016 +0000
Revision:
0:0a673c671a56
4

Who changed what in which revision?

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