1 /* mbed Microcontroller Library
2 *******************************************************************************
3 * Copyright (c) 2014, STMicroelectronics
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *******************************************************************************
30 #ifndef MBED_PINNAMES_H
31 #define MBED_PINNAMES_H
39 // See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM
40 #define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM) << 7) | ((PUPD) << 4) | ((MODE) << 0)))
41 #define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 15) | ((CHANNEL & 0x0F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0)))
42 #define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
43 #define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
44 #define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F)
45 #define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x0F)
46 #define STM_PIN_INVERTED(X) (((X) >> 15) & 0x01)
47 #define STM_MODE_INPUT (0)
48 #define STM_MODE_OUTPUT_PP (1)
49 #define STM_MODE_OUTPUT_OD (2)
50 #define STM_MODE_AF_PP (3)
51 #define STM_MODE_AF_OD (4)
52 #define STM_MODE_ANALOG (5)
53 #define STM_MODE_IT_RISING (6)
54 #define STM_MODE_IT_FALLING (7)
55 #define STM_MODE_IT_RISING_FALLING (8)
56 #define STM_MODE_EVT_RISING (9)
57 #define STM_MODE_EVT_FALLING (10)
58 #define STM_MODE_EVT_RISING_FALLING (11)
59 #define STM_MODE_IT_EVT_RESET (12)
61 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
62 // Low nibble = pin number
63 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
64 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
226 // Arduino connector namings
252 // Generic signals namings
257 USBTX = PC_6, /* USART6 */
259 I2C_SCL = PB_8, /* I2C1 */
279 PullDefault = PullNone