Skip to content

Commit 95f8b2d

Browse files
committed
STM32L4 : common file factorisation
1 parent dcc066d commit 95f8b2d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+386
-3319
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2016-2020 STMicroelectronics
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#ifndef MBED_PERIPHERALNAMES_H
19+
#define MBED_PERIPHERALNAMES_H
20+
21+
#include "cmsis.h"
22+
23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif
26+
27+
typedef enum {
28+
ADC_1 = (int)ADC1_BASE,
29+
#if defined ADC2_BASE
30+
ADC_2 = (int)ADC2_BASE,
31+
#endif
32+
#if defined ADC3_BASE
33+
ADC_3 = (int)ADC3_BASE,
34+
#endif
35+
} ADCName;
36+
37+
#if defined DAC_BASE
38+
typedef enum {
39+
DAC_1 = (int)DAC_BASE,
40+
} DACName;
41+
#endif
42+
43+
typedef enum {
44+
UART_1 = (int)USART1_BASE,
45+
UART_2 = (int)USART2_BASE,
46+
#if defined USART3_BASE
47+
UART_3 = (int)USART3_BASE,
48+
#endif
49+
#if defined UART4_BASE
50+
UART_4 = (int)UART4_BASE,
51+
#endif
52+
#if defined UART5_BASE
53+
UART_5 = (int)UART5_BASE,
54+
#endif
55+
LPUART_1 = (int)LPUART1_BASE,
56+
} UARTName;
57+
58+
#define DEVICE_SPI_COUNT 3
59+
typedef enum {
60+
SPI_1 = (int)SPI1_BASE,
61+
#if defined SPI2_BASE
62+
SPI_2 = (int)SPI2_BASE,
63+
#endif
64+
#if defined SPI3_BASE
65+
SPI_3 = (int)SPI3_BASE,
66+
#endif
67+
} SPIName;
68+
69+
typedef enum {
70+
I2C_1 = (int)I2C1_BASE,
71+
#if defined I2C2_BASE
72+
I2C_2 = (int)I2C2_BASE,
73+
#endif
74+
I2C_3 = (int)I2C3_BASE,
75+
#if defined I2C4_BASE
76+
I2C_4 = (int)I2C4_BASE,
77+
#endif
78+
} I2CName;
79+
80+
typedef enum {
81+
PWM_1 = (int)TIM1_BASE,
82+
PWM_2 = (int)TIM2_BASE,
83+
#if defined TIM3_BASE
84+
PWM_3 = (int)TIM3_BASE,
85+
#endif
86+
#if defined TIM4_BASE
87+
PWM_4 = (int)TIM4_BASE,
88+
#endif
89+
#if defined TIM5_BASE
90+
PWM_5 = (int)TIM5_BASE,
91+
#endif
92+
#if defined TIM8_BASE
93+
PWM_8 = (int)TIM8_BASE,
94+
#endif
95+
PWM_15 = (int)TIM15_BASE,
96+
PWM_16 = (int)TIM16_BASE,
97+
#if defined TIM17_BASE
98+
PWM_17 = (int)TIM17_BASE,
99+
#endif
100+
} PWMName;
101+
102+
#if defined CAN1_BASE
103+
typedef enum {
104+
CAN_1 = (int)CAN1_BASE,
105+
#if defined CAN2_BASE
106+
CAN_2 = (int)CAN2_BASE,
107+
#endif
108+
} CANName;
109+
#endif
110+
111+
#if defined QSPI_R_BASE || defined OCTOSPI1_R_BASE
112+
typedef enum {
113+
#if defined QSPI_R_BASE
114+
QSPI_1 = (int)QSPI_R_BASE,
115+
#endif
116+
#if defined OCTOSPI1_R_BASE
117+
QSPI_1 = (int)OCTOSPI1_R_BASE,
118+
#endif
119+
#if defined OCTOSPI2_R_BASE
120+
QSPI_2 = (int)OCTOSPI2_R_BASE,
121+
#endif
122+
} QSPIName;
123+
#endif
124+
125+
#if defined OCTOSPI1_R_BASE
126+
typedef enum {
127+
OSPI_1 = (int)OCTOSPI1_R_BASE,
128+
#if defined OCTOSPI2_R_BASE
129+
OSPI_2 = (int)OCTOSPI2_R_BASE,
130+
#endif
131+
} OSPIName;
132+
#endif
133+
134+
#if defined USB_OTG_FS_PERIPH_BASE || defined USB_BASE
135+
typedef enum {
136+
#if defined USB_OTG_FS_PERIPH_BASE
137+
USB_FS = (int)USB_OTG_FS_PERIPH_BASE,
138+
#endif
139+
#if defined USB_BASE
140+
USB_FS = (int)USB_BASE,
141+
#endif
142+
} USBName;
143+
#endif
144+
145+
#ifdef __cplusplus
146+
}
147+
#endif
148+
149+
#endif

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/PeripheralNames.h

Lines changed: 0 additions & 87 deletions
This file was deleted.

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/objects.h

Lines changed: 0 additions & 67 deletions
This file was deleted.

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/system_clock.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@
4646
#include "stm32l4xx.h"
4747
#include "mbed_error.h"
4848

49-
/*!< Uncomment the following line if you need to relocate your vector Table in
50-
Internal SRAM. */
51-
/* #define VECT_TAB_SRAM */
52-
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
53-
This value must be a multiple of 0x200. */
54-
55-
5649
// clock source is selected with CLOCK_SOURCE in json config
5750
#define USE_PLL_HSE_EXTC 0x8 // Use external clock (ST Link MCO - not enabled by default)
5851
#define USE_PLL_HSE_XTAL 0x4 // Use external xtal (X3 on board - not provided by default)
@@ -123,7 +116,7 @@ void SetSysClock(void)
123116
/******************************************************************************/
124117
/* PLL (clocked by HSE) used as System clock source */
125118
/******************************************************************************/
126-
uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
119+
MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
127120
{
128121
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
129122
RCC_OscInitTypeDef RCC_OscInitStruct = {0};

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L432xC/us_ticker_data.h

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)