Danillo Mangue Baja

Dependents:   STM32_StrainGauge

Committer:
hudakz
Date:
Sun Oct 09 09:25:19 2016 +0000
Revision:
6:e35173aca75e
Parent:
1:0bf5385bbf21
Child:
7:09d8c2eacb4d
Enabled compilation/linking with mbed-dev library.

Who changed what in which revision?

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