Skip to content

Commit 95ea5a3

Browse files
committed
STM32L0: standard pin names
1 parent 1ec516c commit 95ea5a3

File tree

2 files changed

+208
-282
lines changed
  • targets/TARGET_STM/TARGET_STM32L0
    • TARGET_STM32L072xZ/TARGET_DISCO_L072CZ_LRWAN1
    • TARGET_STM32L073xZ/TARGET_NUCLEO_L073RZ

2 files changed

+208
-282
lines changed

targets/TARGET_STM/TARGET_STM32L0/TARGET_STM32L072xZ/TARGET_DISCO_L072CZ_LRWAN1/PinNames.h

Lines changed: 96 additions & 128 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/STM32L072C(B-Z)Yx.xml
2916
*/
3017

3118
/* MBED TARGET LIST: DISCO_L072CZ_LRWAN1 */
@@ -41,125 +28,100 @@ extern "C" {
4128
#endif
4229

4330
typedef enum {
44-
ALT0 = 0x100,
45-
ALT1 = 0x200,
46-
ALT2 = 0x300,
47-
ALT3 = 0x400
48-
} ALTx;
4931

50-
typedef enum {
51-
PA_0 = 0x00,
52-
PA_1 = 0x01,
53-
PA_2 = 0x02,
54-
PA_2_ALT0 = PA_2 | ALT0,
55-
PA_3 = 0x03,
56-
PA_3_ALT0 = PA_3 | ALT0,
57-
PA_4 = 0x04,
58-
PA_5 = 0x05,
59-
PA_6 = 0x06,
60-
PA_6_ALT0 = PA_6 | ALT0,
61-
PA_7 = 0x07,
62-
PA_7_ALT0 = PA_7 | ALT0,
63-
PA_8 = 0x08,
64-
PA_9 = 0x09,
65-
PA_10 = 0x0A,
66-
PA_11 = 0x0B,
67-
PA_12 = 0x0C,
68-
PA_13 = 0x0D,
69-
PA_14 = 0x0E,
70-
PA_14_ALT0 = PA_14 | ALT0,
71-
PA_15 = 0x0F,
72-
73-
PB_0 = 0x10,
74-
PB_1 = 0x11,
75-
PB_2 = 0x12,
76-
PB_3 = 0x13,
77-
PB_4 = 0x14,
78-
PB_4_ALT0 = PB_4 | ALT0,
79-
PB_5 = 0x15,
80-
PB_5_ALT0 = PB_5 | ALT0,
81-
PB_6 = 0x16,
82-
PB_7 = 0x17,
83-
PB_8 = 0x18,
84-
PB_9 = 0x19,
85-
PB_10 = 0x1A,
86-
PB_11 = 0x1B,
87-
PB_12 = 0x1C,
88-
PB_13 = 0x1D,
89-
PB_14 = 0x1E,
90-
PB_15 = 0x1F,
91-
92-
PC_0 = 0x20,
93-
PC_1 = 0x21,
94-
PC_2 = 0x22,
95-
PC_13 = 0x2D,
96-
PC_14 = 0x2E,
97-
PC_15 = 0x2F,
98-
99-
PH_0 = 0x70,
100-
PH_1 = 0x71,
101-
102-
// ADC internal channels
103-
ADC_TEMP = 0xF0,
104-
ADC_VREF = 0xF1,
32+
PA_0 = 0x00,
33+
PA_1 = 0x01,
34+
PA_2 = 0x02,
35+
PA_2_ALT0 = PA_2 | ALT0, // same pin used for alternate HW
36+
PA_3 = 0x03,
37+
PA_3_ALT0 = PA_3 | ALT0, // same pin used for alternate HW
38+
PA_4 = 0x04,
39+
PA_5 = 0x05,
40+
PA_6 = 0x06,
41+
PA_6_ALT0 = PA_6 | ALT0, // same pin used for alternate HW
42+
PA_7 = 0x07,
43+
PA_7_ALT0 = PA_7 | ALT0, // same pin used for alternate HW
44+
PA_8 = 0x08,
45+
PA_9 = 0x09,
46+
PA_10 = 0x0A,
47+
PA_11 = 0x0B,
48+
PA_12 = 0x0C,
49+
PA_13 = 0x0D,
50+
PA_14 = 0x0E,
51+
PA_14_ALT0 = PA_14 | ALT0, // same pin used for alternate HW
52+
PA_15 = 0x0F,
53+
PB_0 = 0x10,
54+
PB_1 = 0x11,
55+
PB_2 = 0x12,
56+
PB_3 = 0x13,
57+
PB_4 = 0x14,
58+
PB_4_ALT0 = PB_4 | ALT0, // same pin used for alternate HW
59+
PB_5 = 0x15,
60+
PB_5_ALT0 = PB_5 | ALT0, // same pin used for alternate HW
61+
PB_6 = 0x16,
62+
PB_7 = 0x17,
63+
PB_8 = 0x18,
64+
PB_9 = 0x19,
65+
PB_10 = 0x1A,
66+
PB_11 = 0x1B,
67+
PB_12 = 0x1C,
68+
PB_13 = 0x1D,
69+
PB_14 = 0x1E,
70+
PB_15 = 0x1F,
71+
PC_0 = 0x20,
72+
PC_1 = 0x21,
73+
PC_2 = 0x22,
74+
PC_13 = 0x2D,
75+
PC_14 = 0x2E,
76+
PC_15 = 0x2F,
77+
PH_0 = 0x70,
78+
PH_1 = 0x71,
79+
80+
/**** ADC internal channels ****/
81+
82+
ADC_TEMP = 0xF0, // Internal pin virtual value
83+
ADC_VREF = 0xF1, // Internal pin virtual value
10584

10685
// Not connected
10786
NC = (int)0xFFFFFFFF,
10887

109-
// Arduino connector namings
110-
A0 = PA_0,
111-
A1 = NC, // PA_0 if SB7 fitted
112-
A2 = PA_4,
113-
A3 = NC, // PA_4 if SB7 fitted
114-
A4 = NC, // PB_9 if SB11 closed
115-
A5 = NC, // PB_8 if SB12 closed
116-
D0 = PA_3,
117-
D1 = PA_2,
118-
D2 = PA_10,
119-
D3 = PB_13,
120-
D4 = PB_5,
121-
D5 = PB_7,
122-
D6 = PB_2,
123-
D7 = PA_8,
124-
D8 = PA_9,
125-
D9 = PB_12,
126-
D10 = PB_6,
127-
D11 = PB_15,
128-
D12 = PB_14,
129-
D13 = PB_13, // SB2 must be closed
130-
D14 = PB_9,
131-
D15 = PB_8,
88+
// Arduino Uno (Rev3) pins - ARDUINO_UNO not set as form factor as not full compliant with Arduino standard
89+
ARDUINO_UNO_A0 = PA_0,
90+
ARDUINO_UNO_A1 = NC, // PA_0 if SB7 closed
91+
ARDUINO_UNO_A2 = PA_4,
92+
ARDUINO_UNO_A3 = NC, // PA_4 if SB8 closed
93+
ARDUINO_UNO_A4 = NC, // PB_9 if SB11 closed - PH_0 if SB1 closed
94+
ARDUINO_UNO_A5 = NC, // PB_8 if SB12 closed - PH_1 if SB10 closed
95+
96+
ARDUINO_UNO_D0 = PA_3,
97+
ARDUINO_UNO_D1 = PA_2,
98+
ARDUINO_UNO_D2 = PA_10,
99+
ARDUINO_UNO_D3 = PB_13, // SB9 closed
100+
ARDUINO_UNO_D4 = PB_5,
101+
ARDUINO_UNO_D5 = PB_7,
102+
ARDUINO_UNO_D6 = PB_2,
103+
ARDUINO_UNO_D7 = PA_8,
104+
ARDUINO_UNO_D8 = PA_9,
105+
ARDUINO_UNO_D9 = PB_12,
106+
ARDUINO_UNO_D10 = PB_6,
107+
ARDUINO_UNO_D11 = PB_15,
108+
ARDUINO_UNO_D12 = PB_14,
109+
ARDUINO_UNO_D13 = PB_13, // SB2 closed - PA_5 if SB3 closed
110+
ARDUINO_UNO_D14 = PB_9,
111+
ARDUINO_UNO_D15 = PB_8,
132112

133113
// STDIO for console print
134114
#ifdef MBED_CONF_TARGET_STDIO_UART_TX
135-
STDIO_UART_TX = MBED_CONF_TARGET_STDIO_UART_TX,
115+
CONSOLE_TX = MBED_CONF_TARGET_STDIO_UART_TX,
136116
#else
137-
STDIO_UART_TX = PA_2,
117+
CONSOLE_TX = PA_2,
138118
#endif
139119
#ifdef MBED_CONF_TARGET_STDIO_UART_RX
140-
STDIO_UART_RX = MBED_CONF_TARGET_STDIO_UART_RX,
120+
CONSOLE_RX = MBED_CONF_TARGET_STDIO_UART_RX,
141121
#else
142-
STDIO_UART_RX = PA_3,
122+
CONSOLE_RX = PA_3,
143123
#endif
144124

145-
// Generic signals namings
146-
LED1 = PB_5, // Green
147-
LED2 = PA_5, // Red
148-
LED3 = PB_6, // Blue
149-
LED4 = PB_7, // Red
150-
USER_BUTTON = PB_2,
151-
SERIAL_TX = STDIO_UART_TX,
152-
SERIAL_RX = STDIO_UART_RX,
153-
CONSOLE_TX = STDIO_UART_TX,
154-
CONSOLE_RX = STDIO_UART_RX,
155-
I2C_SCL = D15,
156-
I2C_SDA = D14,
157-
SPI_MOSI = D11,
158-
SPI_MISO = D12,
159-
SPI_SCK = D13,
160-
SPI_CS = D10,
161-
PWM_OUT = D13,
162-
163125
/**** USB pins ****/
164126
USB_DM = PA_11,
165127
USB_DP = PA_12,
@@ -181,6 +143,12 @@ typedef enum {
181143
SYS_WKUP2 = PC_13,
182144
} PinName;
183145

146+
// Standardized LED and button names
147+
#define LED1 PB_5 // Green
148+
#define LED2 PA_5 // Red
149+
#define LED3 PB_6 // Blue
150+
#define LED4 PB_7 // Red
151+
184152
#ifdef __cplusplus
185153
}
186154
#endif

0 commit comments

Comments
 (0)