Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Bob_Curtain_Sample_0506
PinNames.h
00001 /* mbed Microcontroller Library 00002 ******************************************************************************* 00003 * Copyright (c) 2014, STMicroelectronics 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * 00009 * 1. Redistributions of source code must retain the above copyright notice, 00010 * this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above copyright notice, 00012 * this list of conditions and the following disclaimer in the documentation 00013 * and/or other materials provided with the distribution. 00014 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00015 * may be used to endorse or promote products derived from this software 00016 * without specific prior written permission. 00017 * 00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00020 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00021 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00022 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00023 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00024 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00025 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00026 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00027 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00028 ******************************************************************************* 00029 * 00030 * Modified by Zoltan Hudak 00031 * 00032 */ 00033 #ifndef MBED_PINNAMES_H 00034 #define MBED_PINNAMES_H 00035 00036 #include "cmsis.h" 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 #define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ 00043 ((PUPD & 0x07) << 4) |\ 00044 ((AFNUM & 0x0F) << 7))) 00045 00046 #define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ 00047 ((PUPD & 0x07) << 4) |\ 00048 ((AFNUM & 0x0F) << 7) |\ 00049 ((CHANNEL & 0x0F) << 11) |\ 00050 ((INVERTED & 0x01) << 15))) 00051 00052 #define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) 00053 #define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) 00054 #define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) 00055 #define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x0F) 00056 #define STM_PIN_INVERTED(X) (((X) >> 15) & 0x01) 00057 00058 #define STM_MODE_INPUT (0) 00059 #define STM_MODE_OUTPUT_PP (1) 00060 #define STM_MODE_OUTPUT_OD (2) 00061 #define STM_MODE_AF_PP (3) 00062 #define STM_MODE_AF_OD (4) 00063 #define STM_MODE_ANALOG (5) 00064 #define STM_MODE_IT_RISING (6) 00065 #define STM_MODE_IT_FALLING (7) 00066 #define STM_MODE_IT_RISING_FALLING (8) 00067 #define STM_MODE_EVT_RISING (9) 00068 #define STM_MODE_EVT_FALLING (10) 00069 #define STM_MODE_EVT_RISING_FALLING (11) 00070 #define STM_MODE_IT_EVT_RESET (12) 00071 00072 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) 00073 // Low nibble = pin number 00074 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) 00075 #define STM_PIN(X) ((uint32_t)(X) & 0xF) 00076 00077 typedef enum { 00078 PIN_INPUT, 00079 PIN_OUTPUT 00080 } PinDirection; 00081 00082 typedef enum { 00083 // Not connected 00084 NC = (int)0xFFFFFFFF, 00085 00086 // Ports 00087 PA_0 = 0x00, 00088 PA_1 = 0x01, 00089 PA_2 = 0x02, 00090 PA_3 = 0x03, 00091 PA_4 = 0x04, 00092 PA_5 = 0x05, 00093 PA_6 = 0x06, 00094 PA_7 = 0x07, 00095 PA_8 = 0x08, 00096 PA_9 = 0x09, 00097 PA_10 = 0x0A, 00098 PA_11 = 0x0B, 00099 PA_12 = 0x0C, 00100 PA_13 = NC, 00101 PA_14 = NC, 00102 PA_15 = 0x0F, 00103 00104 PB_0 = 0x10, 00105 PB_1 = 0x11, 00106 PB_2 = NC, 00107 PB_3 = 0x13, 00108 PB_4 = 0x14, 00109 PB_5 = 0x15, 00110 PB_6 = 0x16, 00111 PB_7 = 0x17, 00112 PB_8 = 0x18, 00113 PB_9 = 0x19, 00114 PB_10 = 0x1A, 00115 PB_11 = 0x1B, 00116 PB_12 = 0x1C, 00117 PB_13 = 0x1D, 00118 PB_14 = 0x1E, 00119 PB_15 = 0x1F, 00120 00121 PC_0 = NC, 00122 PC_1 = NC, 00123 PC_2 = NC, 00124 PC_3 = NC, 00125 PC_4 = NC, 00126 PC_5 = NC, 00127 PC_6 = NC, 00128 PC_7 = NC, 00129 PC_8 = NC, 00130 PC_9 = NC, 00131 PC_10 = NC, 00132 PC_11 = NC, 00133 PC_12 = NC, 00134 PC_13 = 0x2D, 00135 PC_14 = 0x2E, 00136 PC_15 = 0x2F, 00137 00138 PD_2 = NC, 00139 00140 // ADC internal channels 00141 ADC_TEMP = 0xF0, 00142 ADC_VREF = 0xF1, 00143 00144 // Arduino connector namings 00145 A0 = PA_0, 00146 A1 = PA_1, 00147 A2 = PA_4, 00148 A3 = PB_0, 00149 A4 = NC, 00150 A5 = NC, 00151 D0 = PA_3, 00152 D1 = PA_2, 00153 D2 = PA_10, 00154 D3 = PB_3, 00155 D4 = PB_5, 00156 D5 = PB_4, 00157 D6 = PB_10, 00158 D7 = PA_8, 00159 D8 = PA_9, 00160 D9 = NC, 00161 D10 = PB_6, 00162 D11 = PA_7, 00163 D12 = PA_6, 00164 D13 = PA_5, 00165 D14 = PB_9, 00166 D15 = PB_8, 00167 00168 // Generic signals namings 00169 LED1 = PC_13, 00170 LED2 = NC, 00171 LED3 = NC, 00172 LED4 = NC, 00173 USER_BUTTON = NC, 00174 SERIAL_TX = PA_2, 00175 SERIAL_RX = PA_3, 00176 USBTX = PA_2, 00177 USBRX = PA_3, 00178 I2C_SCL = PB_8, 00179 I2C_SDA = PB_9, 00180 SPI_MOSI = PA_7, 00181 SPI_MISO = PA_6, 00182 SPI_SCK = PA_5, 00183 SPI_CS = PB_6, 00184 PWM_OUT = PB_3 00185 } PinName; 00186 00187 typedef enum { 00188 PullNone = 0, 00189 PullUp = 1, 00190 PullDown = 2, 00191 OpenDrain = 3, 00192 PullDefault = PullNone 00193 } PinMode; 00194 00195 #ifdef __cplusplus 00196 } 00197 #endif 00198 00199 #endif
Generated on Mon Jul 18 2022 10:34:33 by
1.7.2