Skip to content

Commit 829384e

Browse files
FRASTMfpistm
andcommitted
[L5] Update core to support STM32L5xx serie
Signed-off-by: Francois Ramu <[email protected]> Co-authored-by: Frederic.Pillon <[email protected]>
1 parent 4facf26 commit 829384e

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

cores/arduino/stm32/backup.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static inline void setBackupRegister(uint32_t index, uint32_t value)
125125
LL_RTC_BKP_SetRegister(BKP, index, value);
126126
#elif defined(STM32G0xx)
127127
LL_RTC_BKP_SetRegister(TAMP, index, value);
128-
#elif defined(STM32G4xx)
128+
#elif defined(STM32G4xx) || defined(STM32L5xx)
129129
LL_RTC_BKP_SetRegister(RTC, index, value);
130130
#else
131131
#ifdef ENABLE_BACKUP_SUPPORT
@@ -143,7 +143,7 @@ static inline uint32_t getBackupRegister(uint32_t index)
143143
return LL_RTC_BKP_GetRegister(BKP, index);
144144
#elif defined(STM32G0xx)
145145
return LL_RTC_BKP_GetRegister(TAMP, index);
146-
#elif defined(STM32G4xx)
146+
#elif defined(STM32G4xx) || defined(STM32L5xx)
147147
return LL_RTC_BKP_GetRegister(RTC, index);
148148
#else
149149
#ifdef ENABLE_BACKUP_SUPPORT

cores/arduino/stm32/stm32_def.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include "stm32l1xx.h"
4747
#elif defined(STM32L4xx)
4848
#include "stm32l4xx.h"
49+
#elif defined(STM32L5xx)
50+
#include "stm32l5xx.h"
4951
#elif defined(STM32MP1xx)
5052
#include "stm32mp1xx.h"
5153
#elif defined(STM32WBxx)

cores/arduino/stm32/timer.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,24 @@ extern "C" {
5858
#define TIM1_IRQn TIM1_UP_TIM10_IRQn
5959
#define TIM1_IRQHandler TIM1_UP_TIM10_IRQHandler
6060
#endif
61-
#elif defined(STM32H7xx) || defined(STM32MP1xx)
61+
#elif defined(STM32H7xx) || defined(STM32L5xx) || defined(STM32MP1xx)
6262
#define TIM1_IRQn TIM1_UP_IRQn
6363
#define TIM1_IRQHandler TIM1_UP_IRQHandler
6464
#endif
6565
#endif
66+
6667
#if defined(TIM6_BASE) && !defined(TIM6_IRQn)
6768
#if defined(DAC_BASE) || defined(DAC1_BASE)
6869
#if defined(STM32G0xx)
6970
#define TIM6_IRQn TIM6_DAC_LPTIM1_IRQn
7071
#define TIM6_IRQHandler TIM6_DAC_LPTIM1_IRQHandler
71-
#elif !defined(STM32F1xx) && !defined(STM32L1xx) && !defined(STM32MP1xx)
72+
#elif !defined(STM32F1xx) && !defined(STM32L1xx) && !defined(STM32L5xx) && !defined(STM32MP1xx)
7273
#define TIM6_IRQn TIM6_DAC_IRQn
7374
#define TIM6_IRQHandler TIM6_DAC_IRQHandler
7475
#endif
7576
#endif
7677
#endif
78+
7779
#if defined(TIM7_BASE) && !defined(TIM7_IRQn)
7880
#if defined(STM32G0xx) && defined(LPTIM2_BASE)
7981
#define TIM7_IRQn TIM7_LPTIM2_IRQn
@@ -89,11 +91,13 @@ extern "C" {
8991
|| defined(STM32H7xx)
9092
#define TIM8_IRQn TIM8_UP_TIM13_IRQn
9193
#define TIM8_IRQHandler TIM8_UP_TIM13_IRQHandler
92-
#elif defined(STM32F3xx) || defined(STM32G4xx) || defined(STM32L4xx) || defined(STM32MP1xx)
94+
#elif defined(STM32F3xx) || defined(STM32G4xx) || defined(STM32L4xx)\
95+
|| defined(STM32L5xx) || defined(STM32MP1xx)
9396
#define TIM8_IRQn TIM8_UP_IRQn
9497
#define TIM8_IRQHandler TIM8_UP_IRQHandler
9598
#endif
9699
#endif
100+
97101
#if defined(TIM9_BASE) && !defined(TIM9_IRQn)
98102
#if defined(STM32F1xx) || defined(STM32F2xx) ||defined(STM32F4xx) || defined(STM32F7xx)
99103
#define TIM9_IRQn TIM1_BRK_TIM9_IRQn

cores/arduino/stm32/usb/usbd_conf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ extern "C" {
5757
#elif defined(STM32L1xx)
5858
#define USB_IRQn USB_LP_IRQn
5959
#define USB_IRQHandler USB_LP_IRQHandler
60+
#elif defined(STM32L5xx)
61+
#define USB_IRQn USB_FS_IRQn
62+
#define USB_IRQHandler USB_FS_IRQHandler
6063
#endif
6164

6265
#endif /* USB_BASE */

libraries/SrcWrapper/src/stm32/analog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,8 +842,8 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
842842
#endif
843843
#if !defined(STM32F1xx) && !defined(STM32F2xx) && !defined(STM32F3xx) && \
844844
!defined(STM32F4xx) && !defined(STM32F7xx) && !defined(STM32G4xx) && \
845-
!defined(STM32H7xx) && !defined(STM32L4xx) && !defined(STM32MP1xx) && \
846-
!defined(STM32WBxx)
845+
!defined(STM32H7xx) && !defined(STM32L4xx) && !defined(STM32L5xx) && \
846+
!defined(STM32MP1xx) && !defined(STM32WBxx)
847847
AdcHandle.Init.LowPowerAutoPowerOff = DISABLE; /* ADC automatically powers-off after a conversion and automatically wakes-up when a new conversion is triggered */
848848
#endif
849849
#ifdef ADC_CHANNELS_BANK_A
@@ -913,7 +913,7 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
913913

914914
AdcChannelConf.Channel = channel; /* Specifies the channel to configure into ADC */
915915

916-
#if defined(STM32L4xx) || defined(STM32WBxx)
916+
#if defined(STM32L4xx) || defined(STM32L5xx) || defined(STM32WBxx)
917917
if (!IS_ADC_CHANNEL(&AdcHandle, AdcChannelConf.Channel)) {
918918
#elif defined(STM32G4xx)
919919
if (!IS_ADC_CHANNEL(&AdcHandle, AdcChannelConf.Channel)) {

libraries/SrcWrapper/src/stm32/interrupt.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static gpio_irq_conf_str gpio_irq_conf[NB_EXTI] = {
7171
{.irqnb = EXTI4_15_IRQn, .callback = NULL}, //GPIO_PIN_13
7272
{.irqnb = EXTI4_15_IRQn, .callback = NULL}, //GPIO_PIN_14
7373
{.irqnb = EXTI4_15_IRQn, .callback = NULL} //GPIO_PIN_15
74-
#elif defined (STM32MP1xx)
74+
#elif defined (STM32MP1xx) || defined (STM32L5xx)
7575
{.irqnb = EXTI0_IRQn, .callback = NULL}, //GPIO_PIN_0
7676
{.irqnb = EXTI1_IRQn, .callback = NULL}, //GPIO_PIN_1
7777
{.irqnb = EXTI2_IRQn, .callback = NULL}, //GPIO_PIN_2
@@ -246,7 +246,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
246246
}
247247
}
248248

249-
#if defined (STM32G0xx) || defined (STM32MP1xx)
249+
#if defined (STM32G0xx) || defined (STM32MP1xx) || defined (STM32L5xx)
250250
/**
251251
* @brief EXTI line detection callback.
252252
* @param GPIO_Pin Specifies the port pin connected to corresponding EXTI line.
@@ -369,7 +369,7 @@ void EXTI4_IRQHandler(void)
369369
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4);
370370
}
371371

372-
#if !defined(STM32MP1xx)
372+
#if !defined(STM32MP1xx) && !defined(STM32L5xx)
373373
/**
374374
* @brief This function handles external line 5 to 9 interrupt request.
375375
* @param None
@@ -395,7 +395,7 @@ void EXTI15_10_IRQHandler(void)
395395
HAL_GPIO_EXTI_IRQHandler(pin);
396396
}
397397
}
398-
#else /* STM32MP1xx */
398+
#else /* STM32MP1xx && STM32L5xx */
399399

400400
/**
401401
* @brief This function handles external line 5 interrupt request.
@@ -507,7 +507,7 @@ void EXTI15_IRQHandler(void)
507507
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_15);
508508
}
509509

510-
#endif /* !STM32MP1xx */
510+
#endif /* !STM32MP1xx && !STM32L5xx */
511511
#ifdef __cplusplus
512512
}
513513
#endif

0 commit comments

Comments
 (0)