Skip to content

Commit 25e85f9

Browse files
committed
STM32F3: standard pin names
1 parent 63ce075 commit 25e85f9

File tree

3 files changed

+504
-592
lines changed
  • targets/TARGET_STM/TARGET_STM32F3

3 files changed

+504
-592
lines changed

targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/TARGET_NUCLEO_F303K8/PinNames.h

Lines changed: 64 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,18 @@
11
/* mbed Microcontroller Library
2-
*******************************************************************************
3-
* Copyright (c) 2018, STMicroelectronics
2+
* SPDX-License-Identifier: BSD-3-Clause
3+
******************************************************************************
4+
*
5+
* Copyright (c) 2016-2021 STMicroelectronics.
46
* All rights reserved.
57
*
6-
* Redistribution and use in source and binary forms, with or without
7-
* modification, are permitted provided that the following conditions are met:
8+
* This software component is licensed by ST under BSD 3-Clause license,
9+
* the "License"; You may not use this file except in compliance with the
10+
* License. You may obtain a copy of the License at:
11+
* opensource.org/licenses/BSD-3-Clause
812
*
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.
13+
******************************************************************************
1714
*
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-
*******************************************************************************
15+
* Automatically generated from STM32CubeMX/db/mcu/STM32F303K(6-8)Tx.xml
2916
*/
3017

3118
/* MBED TARGET LIST: NUCLEO_F303K8 */
@@ -43,58 +30,55 @@ extern "C" {
4330
typedef enum {
4431
ALT0 = 0x100,
4532
ALT1 = 0x200,
46-
ALT2 = 0x300,
47-
ALT3 = 0x400
4833
} ALTx;
4934

5035
typedef enum {
51-
PA_0 = 0x00,
52-
PA_1 = 0x01,
53-
PA_2 = 0x02,
54-
PA_3 = 0x03,
55-
PA_4 = 0x04,
56-
PA_5 = 0x05,
57-
PA_6 = 0x06,
58-
PA_6_ALT0 = PA_6 | ALT0,
59-
PA_7 = 0x07,
60-
PA_7_ALT0 = PA_7 | ALT0,
61-
PA_7_ALT1 = PA_7 | ALT1,
62-
PA_8 = 0x08,
63-
PA_9 = 0x09,
64-
PA_10 = 0x0A,
65-
PA_11 = 0x0B,
66-
PA_11_ALT0 = PA_11 | ALT0,
67-
PA_12 = 0x0C,
68-
PA_12_ALT0 = PA_12 | ALT0,
69-
PA_13 = 0x0D,
70-
PA_14 = 0x0E,
71-
PA_15 = 0x0F,
72-
73-
PB_0 = 0x10,
74-
PB_0_ALT0 = PB_0 | ALT0,
75-
PB_1 = 0x11,
76-
PB_1_ALT0 = PB_1 | ALT0,
77-
PB_3 = 0x13,
78-
PB_4 = 0x14,
79-
PB_4_ALT0 = PB_4 | ALT0,
80-
PB_5 = 0x15,
81-
PB_5_ALT0 = PB_5 | ALT0,
82-
PB_6 = 0x16,
83-
PB_7 = 0x17,
84-
PB_7_ALT0 = PB_7 | ALT0,
85-
86-
PF_0 = 0x50,
87-
PF_1 = 0x51,
88-
89-
// ADC internal channels
90-
ADC_TEMP = 0xF0,
91-
ADC_VREF1 = 0xF1,
92-
ADC_VREF2 = 0xF2,
93-
ADC_VREF = ADC_VREF1,
94-
ADC_VBAT = 0xF3,
95-
ADC_VOPAMP2 = 0xF4,
96-
97-
// Arduino connector namings
36+
PA_0 = 0x00,
37+
PA_1 = 0x01,
38+
PA_2 = 0x02,
39+
PA_3 = 0x03,
40+
PA_4 = 0x04,
41+
PA_5 = 0x05,
42+
PA_6 = 0x06,
43+
PA_6_ALT0 = PA_6 | ALT0, // same pin used for alternate HW
44+
PA_7 = 0x07,
45+
PA_7_ALT0 = PA_7 | ALT0, // same pin used for alternate HW
46+
PA_7_ALT1 = PA_7 | ALT1, // same pin used for alternate HW
47+
PA_8 = 0x08,
48+
PA_9 = 0x09,
49+
PA_10 = 0x0A,
50+
PA_11 = 0x0B,
51+
PA_11_ALT0 = PA_11 | ALT0, // same pin used for alternate HW
52+
PA_12 = 0x0C,
53+
PA_12_ALT0 = PA_12 | ALT0, // same pin used for alternate HW
54+
PA_13 = 0x0D,
55+
PA_14 = 0x0E,
56+
PA_15 = 0x0F,
57+
PB_0 = 0x10,
58+
PB_0_ALT0 = PB_0 | ALT0, // same pin used for alternate HW
59+
PB_1 = 0x11,
60+
PB_1_ALT0 = PB_1 | ALT0, // same pin used for alternate HW
61+
PB_3 = 0x13,
62+
PB_4 = 0x14,
63+
PB_4_ALT0 = PB_4 | ALT0, // same pin used for alternate HW
64+
PB_5 = 0x15,
65+
PB_5_ALT0 = PB_5 | ALT0, // same pin used for alternate HW
66+
PB_6 = 0x16,
67+
PB_7 = 0x17,
68+
PB_7_ALT0 = PB_7 | ALT0, // same pin used for alternate HW
69+
PF_0 = 0x50,
70+
PF_1 = 0x51,
71+
72+
/**** ADC internal channels ****/
73+
74+
ADC_TEMP = 0xF0, // Internal pin virtual value
75+
ADC_VREF1 = 0xF1, // Internal pin virtual value
76+
ADC_VREF2 = 0xF2, // Internal pin virtual value
77+
ADC_VREF = ADC_VREF1, // Internal pin virtual value
78+
ADC_VBAT = 0xF3, // Internal pin virtual value
79+
ADC_VOPAMP2 = 0xF4, // Internal pin virtual value
80+
81+
// Arduino Nano pins
9882
A0 = PA_0,
9983
A1 = PA_1,
10084
A2 = PA_3,
@@ -103,6 +87,7 @@ typedef enum {
10387
A5 = PA_6,
10488
A6 = PA_7,
10589
A7 = PA_2,
90+
10691
D0 = PA_10,
10792
D1 = PA_9,
10893
D2 = PA_12,
@@ -120,36 +105,16 @@ typedef enum {
120105

121106
// STDIO for console print
122107
#ifdef MBED_CONF_TARGET_STDIO_UART_TX
123-
STDIO_UART_TX = MBED_CONF_TARGET_STDIO_UART_TX,
108+
CONSOLE_TX = MBED_CONF_TARGET_STDIO_UART_TX,
124109
#else
125-
STDIO_UART_TX = PA_2,
110+
CONSOLE_TX = PA_2,
126111
#endif
127112
#ifdef MBED_CONF_TARGET_STDIO_UART_RX
128-
STDIO_UART_RX = MBED_CONF_TARGET_STDIO_UART_RX,
113+
CONSOLE_RX = MBED_CONF_TARGET_STDIO_UART_RX,
129114
#else
130-
STDIO_UART_RX = PA_15,
115+
CONSOLE_RX = PA_15,
131116
#endif
132117

133-
// Generic signals namings
134-
LED1 = PB_3,
135-
LED2 = PB_3,
136-
LED3 = PB_3,
137-
LED4 = PB_3,
138-
USER_BUTTON = 0x20, // no user button on the board
139-
// Standardized button names
140-
BUTTON1 = USER_BUTTON,
141-
SERIAL_TX = STDIO_UART_TX,
142-
SERIAL_RX = STDIO_UART_RX,
143-
CONSOLE_TX = STDIO_UART_TX,
144-
CONSOLE_RX = STDIO_UART_RX,
145-
I2C_SCL = PB_6,
146-
I2C_SDA = PB_7,
147-
SPI_MOSI = PB_5,
148-
SPI_MISO = PB_4,
149-
SPI_SCK = PB_3,
150-
SPI_CS = PA_11,
151-
PWM_OUT = PA_8,
152-
153118
/**** OSCILLATOR pins ****/
154119
RCC_OSC_IN = PF_0,
155120
RCC_OSC_OUT = PF_1,
@@ -166,6 +131,9 @@ typedef enum {
166131
NC = (int)0xFFFFFFFF
167132
} PinName;
168133

134+
// Standardized LED and button names
135+
#define LED1 PB_3
136+
169137
#ifdef __cplusplus
170138
}
171139
#endif

0 commit comments

Comments
 (0)