Skip to content

Commit c1eda08

Browse files
bcostmadbridge
authored andcommitted
Add DISCO_L475VG_IOT specific files
1 parent 253ceee commit c1eda08

File tree

22 files changed

+22601
-0
lines changed

22 files changed

+22601
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2017, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
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.
17+
*
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+
*******************************************************************************
29+
*/
30+
#ifndef MBED_PERIPHERALNAMES_H
31+
#define MBED_PERIPHERALNAMES_H
32+
33+
#include "cmsis.h"
34+
35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
38+
39+
typedef enum {
40+
ADC_1 = (int)ADC1_BASE,
41+
ADC_2 = (int)ADC2_BASE,
42+
ADC_3 = (int)ADC3_BASE
43+
} ADCName;
44+
45+
typedef enum {
46+
DAC_1 = (int)DAC_BASE
47+
} DACName;
48+
49+
typedef enum {
50+
UART_1 = (int)USART1_BASE,
51+
UART_2 = (int)USART2_BASE,
52+
UART_3 = (int)USART3_BASE,
53+
UART_4 = (int)UART4_BASE,
54+
UART_5 = (int)UART5_BASE,
55+
LPUART_1 = (int)LPUART1_BASE
56+
} UARTName;
57+
58+
#define STDIO_UART_TX PB_6
59+
#define STDIO_UART_RX PB_7
60+
#define STDIO_UART UART_1
61+
62+
typedef enum {
63+
SPI_1 = (int)SPI1_BASE,
64+
SPI_2 = (int)SPI2_BASE,
65+
SPI_3 = (int)SPI3_BASE
66+
} SPIName;
67+
68+
typedef enum {
69+
I2C_1 = (int)I2C1_BASE,
70+
I2C_2 = (int)I2C2_BASE,
71+
I2C_3 = (int)I2C3_BASE
72+
} I2CName;
73+
74+
typedef enum {
75+
PWM_1 = (int)TIM1_BASE,
76+
PWM_2 = (int)TIM2_BASE,
77+
PWM_3 = (int)TIM3_BASE,
78+
PWM_4 = (int)TIM4_BASE,
79+
PWM_5 = (int)TIM5_BASE,
80+
PWM_8 = (int)TIM8_BASE,
81+
PWM_15 = (int)TIM15_BASE,
82+
PWM_16 = (int)TIM16_BASE,
83+
PWM_17 = (int)TIM17_BASE
84+
} PWMName;
85+
86+
typedef enum {
87+
CAN_1 = (int)CAN1_BASE
88+
} CANName;
89+
90+
#ifdef __cplusplus
91+
}
92+
#endif
93+
94+
#endif

targets/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L475VG_IOT/PeripheralPins.c

Lines changed: 324 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2017, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
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.
17+
*
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+
*******************************************************************************
29+
*/
30+
#ifndef MBED_PINNAMES_H
31+
#define MBED_PINNAMES_H
32+
33+
#include "cmsis.h"
34+
35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
38+
39+
#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\
40+
((PUPD & 0x07) << 4) |\
41+
((AFNUM & 0x0F) << 7)))
42+
43+
#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\
44+
((PUPD & 0x07) << 4) |\
45+
((AFNUM & 0x0F) << 7) |\
46+
((CHANNEL & 0x1F) << 11) |\
47+
((INVERTED & 0x01) << 16)))
48+
49+
#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
50+
#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
51+
#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F)
52+
#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F)
53+
#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01)
54+
55+
#define STM_MODE_INPUT (0)
56+
#define STM_MODE_OUTPUT_PP (1)
57+
#define STM_MODE_OUTPUT_OD (2)
58+
#define STM_MODE_AF_PP (3)
59+
#define STM_MODE_AF_OD (4)
60+
#define STM_MODE_ANALOG (5)
61+
#define STM_MODE_ANALOG_ADC_CONTROL (6)
62+
#define STM_MODE_IT_RISING (7)
63+
#define STM_MODE_IT_FALLING (8)
64+
#define STM_MODE_IT_RISING_FALLING (9)
65+
#define STM_MODE_EVT_RISING (10)
66+
#define STM_MODE_EVT_FALLING (11)
67+
#define STM_MODE_EVT_RISING_FALLING (12)
68+
#define STM_MODE_IT_EVT_RESET (13)
69+
70+
// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
71+
// Low nibble = pin number
72+
#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
73+
#define STM_PIN(X) ((uint32_t)(X) & 0xF)
74+
75+
typedef enum {
76+
PIN_INPUT,
77+
PIN_OUTPUT
78+
} PinDirection;
79+
80+
typedef enum {
81+
PA_0 = 0x00,
82+
PA_1 = 0x01,
83+
PA_2 = 0x02,
84+
PA_3 = 0x03,
85+
PA_4 = 0x04,
86+
PA_5 = 0x05,
87+
PA_6 = 0x06,
88+
PA_7 = 0x07,
89+
PA_8 = 0x08,
90+
PA_9 = 0x09,
91+
PA_10 = 0x0A,
92+
PA_11 = 0x0B,
93+
PA_12 = 0x0C,
94+
PA_13 = 0x0D,
95+
PA_14 = 0x0E,
96+
PA_15 = 0x0F,
97+
98+
PB_0 = 0x10,
99+
PB_1 = 0x11,
100+
PB_2 = 0x12,
101+
PB_3 = 0x13,
102+
PB_4 = 0x14,
103+
PB_5 = 0x15,
104+
PB_6 = 0x16,
105+
PB_7 = 0x17,
106+
PB_8 = 0x18,
107+
PB_9 = 0x19,
108+
PB_10 = 0x1A,
109+
PB_11 = 0x1B,
110+
PB_12 = 0x1C,
111+
PB_13 = 0x1D,
112+
PB_14 = 0x1E,
113+
PB_15 = 0x1F,
114+
115+
PC_0 = 0x20,
116+
PC_1 = 0x21,
117+
PC_2 = 0x22,
118+
PC_3 = 0x23,
119+
PC_4 = 0x24,
120+
PC_5 = 0x25,
121+
PC_6 = 0x26,
122+
PC_7 = 0x27,
123+
PC_8 = 0x28,
124+
PC_9 = 0x29,
125+
PC_10 = 0x2A,
126+
PC_11 = 0x2B,
127+
PC_12 = 0x2C,
128+
PC_13 = 0x2D,
129+
PC_14 = 0x2E,
130+
PC_15 = 0x2F,
131+
132+
PD_0 = 0x30,
133+
PD_1 = 0x31,
134+
PD_2 = 0x32,
135+
PD_3 = 0x33,
136+
PD_4 = 0x34,
137+
PD_5 = 0x35,
138+
PD_6 = 0x36,
139+
PD_7 = 0x37,
140+
PD_8 = 0x38,
141+
PD_9 = 0x39,
142+
PD_10 = 0x3A,
143+
PD_11 = 0x3B,
144+
PD_12 = 0x3C,
145+
PD_13 = 0x3D,
146+
PD_14 = 0x3E,
147+
PD_15 = 0x3F,
148+
149+
PE_0 = 0x40,
150+
PE_1 = 0x41,
151+
PE_2 = 0x42,
152+
PE_3 = 0x43,
153+
PE_4 = 0x44,
154+
PE_5 = 0x45,
155+
PE_6 = 0x46,
156+
PE_7 = 0x47,
157+
PE_8 = 0x48,
158+
PE_9 = 0x49,
159+
PE_10 = 0x4A,
160+
PE_11 = 0x4B,
161+
PE_12 = 0x4C,
162+
PE_13 = 0x4D,
163+
PE_14 = 0x4E,
164+
PE_15 = 0x4F,
165+
166+
PH_0 = 0x70,
167+
PH_1 = 0x71,
168+
169+
// ADC internal channels
170+
ADC_TEMP = 0xF0,
171+
ADC_VREF = 0xF1,
172+
ADC_VBAT = 0xF2,
173+
174+
// Arduino connector namings
175+
A0 = PC_5,
176+
A1 = PC_4,
177+
A2 = PC_3,
178+
A3 = PC_2,
179+
A4 = PC_1,
180+
A5 = PC_0,
181+
D0 = PA_1,
182+
D1 = PA_0,
183+
D2 = PD_14,
184+
D3 = PB_0,
185+
D4 = PA_3,
186+
D5 = PB_4,
187+
D6 = PB_1,
188+
D7 = PA_4,
189+
D8 = PB_2,
190+
D9 = PA_15,
191+
D10 = PA_2,
192+
D11 = PA_7,
193+
D12 = PA_6,
194+
D13 = PA_5,
195+
D14 = PB_9,
196+
D15 = PB_8,
197+
198+
// Generic signals namings
199+
LED1 = D13, // Green LED (LD1)
200+
LED2 = PB_14, // Green LED (LD2)
201+
LED3 = PC_9, // Yellow LED (LD3 WIFI) / Blue LED (LD4 BLE)
202+
LED4 = LED1,
203+
USER_BUTTON = PC_13,
204+
SERIAL_TX = PB_6,
205+
SERIAL_RX = PB_7,
206+
USBTX = SERIAL_TX,
207+
USBRX = SERIAL_RX,
208+
I2C_SCL = D15,
209+
I2C_SDA = D14,
210+
SPI_MOSI = D11,
211+
SPI_MISO = D12,
212+
SPI_SCK = D13,
213+
SPI_CS = D10,
214+
PWM_OUT = D9,
215+
216+
// Not connected
217+
NC = (int)0xFFFFFFFF
218+
} PinName;
219+
220+
typedef enum {
221+
PullNone = 0,
222+
PullUp = 1,
223+
PullDown = 2,
224+
OpenDrain = 3,
225+
PullDefault = PullNone
226+
} PinMode;
227+
228+
#ifdef __cplusplus
229+
}
230+
#endif
231+
232+
#endif
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2017, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
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.
17+
*
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+
*******************************************************************************
29+
*/
30+
#ifndef MBED_PORTNAMES_H
31+
#define MBED_PORTNAMES_H
32+
33+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif
36+
37+
typedef enum {
38+
PortA = 0,
39+
PortB = 1,
40+
PortC = 2,
41+
PortD = 3,
42+
PortE = 4,
43+
PortH = 7
44+
} PortName;
45+
46+
#ifdef __cplusplus
47+
}
48+
#endif
49+
#endif

0 commit comments

Comments
 (0)