Danillo Mangue Baja

Dependents:   STM32_StrainGauge

Committer:
hudakz
Date:
Wed Nov 23 14:31:39 2016 +0000
Revision:
7:09d8c2eacb4d
Parent:
6:e35173aca75e
Child:
9:0340d6204caf
Added pin names for ACD internal channels: ACD_TEMP (chip temperature) and ADC_VREF (reference voltage).

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 7:09d8c2eacb4d 29 *
hudakz 7:09d8c2eacb4d 30 * Modified by Zoltan Hudak
hudakz 7:09d8c2eacb4d 31 *
hudakz 0:1d18653e7c94 32 */
hudakz 0:1d18653e7c94 33 #ifndef MBED_PINNAMES_H
hudakz 0:1d18653e7c94 34 #define MBED_PINNAMES_H
hudakz 0:1d18653e7c94 35
hudakz 0:1d18653e7c94 36 #include "cmsis.h"
hudakz 0:1d18653e7c94 37
hudakz 0:1d18653e7c94 38 #ifdef __cplusplus
hudakz 0:1d18653e7c94 39 extern "C" {
hudakz 0:1d18653e7c94 40 #endif
hudakz 0:1d18653e7c94 41
hudakz 6:e35173aca75e 42 #define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\
hudakz 6:e35173aca75e 43 ((PUPD & 0x07) << 4) |\
hudakz 6:e35173aca75e 44 ((AFNUM & 0x0F) << 7)))
hudakz 6:e35173aca75e 45
hudakz 6:e35173aca75e 46 #define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\
hudakz 6:e35173aca75e 47 ((PUPD & 0x07) << 4) |\
hudakz 6:e35173aca75e 48 ((AFNUM & 0x0F) << 7) |\
hudakz 6:e35173aca75e 49 ((CHANNEL & 0x0F) << 11) |\
hudakz 6:e35173aca75e 50 ((INVERTED & 0x01) << 15)))
hudakz 6:e35173aca75e 51
hudakz 0:1d18653e7c94 52 #define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
hudakz 0:1d18653e7c94 53 #define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
hudakz 0:1d18653e7c94 54 #define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F)
hudakz 6:e35173aca75e 55 #define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x0F)
hudakz 6:e35173aca75e 56 #define STM_PIN_INVERTED(X) (((X) >> 15) & 0x01)
hudakz 6:e35173aca75e 57
hudakz 0:1d18653e7c94 58 #define STM_MODE_INPUT (0)
hudakz 0:1d18653e7c94 59 #define STM_MODE_OUTPUT_PP (1)
hudakz 0:1d18653e7c94 60 #define STM_MODE_OUTPUT_OD (2)
hudakz 0:1d18653e7c94 61 #define STM_MODE_AF_PP (3)
hudakz 0:1d18653e7c94 62 #define STM_MODE_AF_OD (4)
hudakz 0:1d18653e7c94 63 #define STM_MODE_ANALOG (5)
hudakz 0:1d18653e7c94 64 #define STM_MODE_IT_RISING (6)
hudakz 0:1d18653e7c94 65 #define STM_MODE_IT_FALLING (7)
hudakz 0:1d18653e7c94 66 #define STM_MODE_IT_RISING_FALLING (8)
hudakz 0:1d18653e7c94 67 #define STM_MODE_EVT_RISING (9)
hudakz 0:1d18653e7c94 68 #define STM_MODE_EVT_FALLING (10)
hudakz 0:1d18653e7c94 69 #define STM_MODE_EVT_RISING_FALLING (11)
hudakz 0:1d18653e7c94 70 #define STM_MODE_IT_EVT_RESET (12)
hudakz 0:1d18653e7c94 71
hudakz 0:1d18653e7c94 72 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
hudakz 0:1d18653e7c94 73 // Low nibble = pin number
hudakz 0:1d18653e7c94 74 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
hudakz 0:1d18653e7c94 75 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
hudakz 0:1d18653e7c94 76
hudakz 0:1d18653e7c94 77 typedef enum {
hudakz 0:1d18653e7c94 78 PIN_INPUT,
hudakz 0:1d18653e7c94 79 PIN_OUTPUT
hudakz 0:1d18653e7c94 80 } PinDirection;
hudakz 0:1d18653e7c94 81
hudakz 0:1d18653e7c94 82 typedef enum {
hudakz 6:e35173aca75e 83 // Not connected
hudakz 6:e35173aca75e 84 NC = (int)0xFFFFFFFF,
hudakz 6:e35173aca75e 85
hudakz 6:e35173aca75e 86 // Ports
hudakz 0:1d18653e7c94 87 PA_0 = 0x00,
hudakz 0:1d18653e7c94 88 PA_1 = 0x01,
hudakz 0:1d18653e7c94 89 PA_2 = 0x02,
hudakz 0:1d18653e7c94 90 PA_3 = 0x03,
hudakz 0:1d18653e7c94 91 PA_4 = 0x04,
hudakz 0:1d18653e7c94 92 PA_5 = 0x05,
hudakz 0:1d18653e7c94 93 PA_6 = 0x06,
hudakz 0:1d18653e7c94 94 PA_7 = 0x07,
hudakz 0:1d18653e7c94 95 PA_8 = 0x08,
hudakz 0:1d18653e7c94 96 PA_9 = 0x09,
hudakz 0:1d18653e7c94 97 PA_10 = 0x0A,
hudakz 0:1d18653e7c94 98 PA_11 = 0x0B,
hudakz 0:1d18653e7c94 99 PA_12 = 0x0C,
hudakz 6:e35173aca75e 100 PA_13 = NC,
hudakz 6:e35173aca75e 101 PA_14 = NC,
hudakz 0:1d18653e7c94 102 PA_15 = 0x0F,
hudakz 0:1d18653e7c94 103
hudakz 0:1d18653e7c94 104 PB_0 = 0x10,
hudakz 0:1d18653e7c94 105 PB_1 = 0x11,
hudakz 6:e35173aca75e 106 PB_2 = NC,
hudakz 0:1d18653e7c94 107 PB_3 = 0x13,
hudakz 0:1d18653e7c94 108 PB_4 = 0x14,
hudakz 0:1d18653e7c94 109 PB_5 = 0x15,
hudakz 0:1d18653e7c94 110 PB_6 = 0x16,
hudakz 0:1d18653e7c94 111 PB_7 = 0x17,
hudakz 0:1d18653e7c94 112 PB_8 = 0x18,
hudakz 0:1d18653e7c94 113 PB_9 = 0x19,
hudakz 0:1d18653e7c94 114 PB_10 = 0x1A,
hudakz 0:1d18653e7c94 115 PB_11 = 0x1B,
hudakz 0:1d18653e7c94 116 PB_12 = 0x1C,
hudakz 0:1d18653e7c94 117 PB_13 = 0x1D,
hudakz 0:1d18653e7c94 118 PB_14 = 0x1E,
hudakz 0:1d18653e7c94 119 PB_15 = 0x1F,
hudakz 0:1d18653e7c94 120
hudakz 6:e35173aca75e 121 PC_0 = NC,
hudakz 6:e35173aca75e 122 PC_1 = NC,
hudakz 6:e35173aca75e 123 PC_2 = NC,
hudakz 6:e35173aca75e 124 PC_3 = NC,
hudakz 6:e35173aca75e 125 PC_4 = NC,
hudakz 6:e35173aca75e 126 PC_5 = NC,
hudakz 6:e35173aca75e 127 PC_6 = NC,
hudakz 6:e35173aca75e 128 PC_7 = NC,
hudakz 6:e35173aca75e 129 PC_8 = NC,
hudakz 6:e35173aca75e 130 PC_9 = NC,
hudakz 6:e35173aca75e 131 PC_10 = NC,
hudakz 6:e35173aca75e 132 PC_11 = NC,
hudakz 6:e35173aca75e 133 PC_12 = NC,
hudakz 0:1d18653e7c94 134 PC_13 = 0x2D,
hudakz 0:1d18653e7c94 135 PC_14 = 0x2E,
hudakz 0:1d18653e7c94 136 PC_15 = 0x2F,
hudakz 0:1d18653e7c94 137
hudakz 6:e35173aca75e 138 PD_2 = NC,
hudakz 0:1d18653e7c94 139
hudakz 7:09d8c2eacb4d 140 // ADC internal channels
hudakz 7:09d8c2eacb4d 141 ADC_TEMP = 0xF0,
hudakz 7:09d8c2eacb4d 142 ADC_VREF = 0xF1,
hudakz 7:09d8c2eacb4d 143
hudakz 0:1d18653e7c94 144 // Arduino connector namings
hudakz 0:1d18653e7c94 145 A0 = PA_0,
hudakz 0:1d18653e7c94 146 A1 = PA_1,
hudakz 0:1d18653e7c94 147 A2 = PA_4,
hudakz 0:1d18653e7c94 148 A3 = PB_0,
hudakz 6:e35173aca75e 149 A4 = NC,
hudakz 6:e35173aca75e 150 A5 = NC,
hudakz 0:1d18653e7c94 151 D0 = PA_3,
hudakz 0:1d18653e7c94 152 D1 = PA_2,
hudakz 0:1d18653e7c94 153 D2 = PA_10,
hudakz 0:1d18653e7c94 154 D3 = PB_3,
hudakz 0:1d18653e7c94 155 D4 = PB_5,
hudakz 0:1d18653e7c94 156 D5 = PB_4,
hudakz 0:1d18653e7c94 157 D6 = PB_10,
hudakz 0:1d18653e7c94 158 D7 = PA_8,
hudakz 0:1d18653e7c94 159 D8 = PA_9,
hudakz 6:e35173aca75e 160 D9 = NC,
hudakz 0:1d18653e7c94 161 D10 = PB_6,
hudakz 0:1d18653e7c94 162 D11 = PA_7,
hudakz 0:1d18653e7c94 163 D12 = PA_6,
hudakz 0:1d18653e7c94 164 D13 = PA_5,
hudakz 0:1d18653e7c94 165 D14 = PB_9,
hudakz 0:1d18653e7c94 166 D15 = PB_8,
hudakz 0:1d18653e7c94 167
hudakz 0:1d18653e7c94 168 // Generic signals namings
hudakz 0:1d18653e7c94 169 LED1 = PC_13,
hudakz 6:e35173aca75e 170 LED2 = NC,
hudakz 6:e35173aca75e 171 LED3 = NC,
hudakz 6:e35173aca75e 172 LED4 = NC,
hudakz 6:e35173aca75e 173 USER_BUTTON = NC,
hudakz 0:1d18653e7c94 174 SERIAL_TX = PA_2,
hudakz 0:1d18653e7c94 175 SERIAL_RX = PA_3,
hudakz 0:1d18653e7c94 176 USBTX = PA_2,
hudakz 0:1d18653e7c94 177 USBRX = PA_3,
hudakz 0:1d18653e7c94 178 I2C_SCL = PB_8,
hudakz 0:1d18653e7c94 179 I2C_SDA = PB_9,
hudakz 0:1d18653e7c94 180 SPI_MOSI = PA_7,
hudakz 0:1d18653e7c94 181 SPI_MISO = PA_6,
hudakz 0:1d18653e7c94 182 SPI_SCK = PA_5,
hudakz 0:1d18653e7c94 183 SPI_CS = PB_6,
hudakz 6:e35173aca75e 184 PWM_OUT = PB_3
hudakz 0:1d18653e7c94 185 } PinName;
hudakz 0:1d18653e7c94 186
hudakz 0:1d18653e7c94 187 typedef enum {
hudakz 0:1d18653e7c94 188 PullNone = 0,
hudakz 0:1d18653e7c94 189 PullUp = 1,
hudakz 0:1d18653e7c94 190 PullDown = 2,
hudakz 0:1d18653e7c94 191 OpenDrain = 3,
hudakz 0:1d18653e7c94 192 PullDefault = PullNone
hudakz 0:1d18653e7c94 193 } PinMode;
hudakz 0:1d18653e7c94 194
hudakz 0:1d18653e7c94 195 #ifdef __cplusplus
hudakz 0:1d18653e7c94 196 }
hudakz 0:1d18653e7c94 197 #endif
hudakz 0:1d18653e7c94 198
hudakz 0:1d18653e7c94 199 #endif