diff --git a/cores/arduino/stm32/backup.h b/cores/arduino/stm32/backup.h index 7940c35ce7..525153368c 100644 --- a/cores/arduino/stm32/backup.h +++ b/cores/arduino/stm32/backup.h @@ -125,7 +125,7 @@ static inline void setBackupRegister(uint32_t index, uint32_t value) LL_RTC_BKP_SetRegister(BKP, index, value); #elif defined(STM32G0xx) LL_RTC_BKP_SetRegister(TAMP, index, value); -#elif defined(STM32G4xx) +#elif defined(STM32G4xx) || defined(STM32L5xx) LL_RTC_BKP_SetRegister(RTC, index, value); #else #ifdef ENABLE_BACKUP_SUPPORT @@ -143,7 +143,7 @@ static inline uint32_t getBackupRegister(uint32_t index) return LL_RTC_BKP_GetRegister(BKP, index); #elif defined(STM32G0xx) return LL_RTC_BKP_GetRegister(TAMP, index); -#elif defined(STM32G4xx) +#elif defined(STM32G4xx) || defined(STM32L5xx) return LL_RTC_BKP_GetRegister(RTC, index); #else #ifdef ENABLE_BACKUP_SUPPORT diff --git a/cores/arduino/stm32/stm32_def.h b/cores/arduino/stm32/stm32_def.h index 5df75353b4..f9de262101 100644 --- a/cores/arduino/stm32/stm32_def.h +++ b/cores/arduino/stm32/stm32_def.h @@ -46,6 +46,8 @@ #include "stm32l1xx.h" #elif defined(STM32L4xx) #include "stm32l4xx.h" +#elif defined(STM32L5xx) + #include "stm32l5xx.h" #elif defined(STM32MP1xx) #include "stm32mp1xx.h" #elif defined(STM32WBxx) diff --git a/cores/arduino/stm32/timer.h b/cores/arduino/stm32/timer.h index 9275c4820e..e536708635 100644 --- a/cores/arduino/stm32/timer.h +++ b/cores/arduino/stm32/timer.h @@ -37,7 +37,10 @@ extern "C" { #endif #if defined(TIM1_BASE) && !defined(TIM1_IRQn) -#if defined(STM32F0xx) || defined(STM32G0xx) +#if defined(STM32L5xx) +#define TIM1_IRQn TIM1_UP_IRQn +#define TIM1_IRQHandler TIM1_UP_IRQHandler +#elif defined(STM32F0xx) || defined(STM32G0xx) #define TIM1_IRQn TIM1_BRK_UP_TRG_COM_IRQn #define TIM1_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler #elif defined(STM32F1xx) ||defined(STM32G4xx) @@ -63,19 +66,45 @@ extern "C" { #define TIM1_IRQHandler TIM1_UP_IRQHandler #endif #endif + +#if defined(STM32L5xx) +#if defined(TIM3_BASE) && !defined(TIM3_IRQn) +#define TIM3_IRQn TIM3_IRQn +#define TIM3_IRQHandler TIM3_IRQHandler +#endif +#if defined(TIM4_BASE) && !defined(TIM4_IRQn) +#define TIM4_IRQn TIM4_IRQn +#define TIM4_IRQHandler TIM4_IRQHandler +#endif +#if defined(TIM5_BASE) && !defined(TIM5_IRQn) +#define TIM5_IRQn TIM5_IRQn +#define TIM5_IRQHandler TIM5_IRQHandler +#endif +#endif + #if defined(TIM6_BASE) && !defined(TIM6_IRQn) +#if defined(STM32L5xx) +#define TIM6_IRQn TIM6_IRQn +#define TIM6_IRQHandler TIM6_IRQHandler +#else #if defined(DAC_BASE) || defined(DAC1_BASE) #if defined(STM32G0xx) #define TIM6_IRQn TIM6_DAC_LPTIM1_IRQn #define TIM6_IRQHandler TIM6_DAC_LPTIM1_IRQHandler #elif !defined(STM32F1xx) && !defined(STM32L1xx) && !defined(STM32MP1xx) #define TIM6_IRQn TIM6_DAC_IRQn -#define TIM6_IRQHandler TIM6_DAC_IRQHandler +#define TIM6_IRQHandler TIM2_DAC_IRQHandler +#endif +#else #endif #endif #endif + #if defined(TIM7_BASE) && !defined(TIM7_IRQn) -#if defined(STM32G0xx) && defined(LPTIM2_BASE) +#if defined(STM32L5xx) +#define TIM7_IRQn TIM7_IRQn +#define TIM7_IRQHandler TIM7_IRQHandler +#elif defined(STM32G0xx) && defined(LPTIM2_BASE) #define TIM7_IRQn TIM7_LPTIM2_IRQn #define TIM7_IRQHandler TIM7_LPTIM2_IRQHandler #elif defined(STM32G4xx) @@ -89,11 +118,13 @@ extern "C" { || defined(STM32H7xx) #define TIM8_IRQn TIM8_UP_TIM13_IRQn #define TIM8_IRQHandler TIM8_UP_TIM13_IRQHandler -#elif defined(STM32F3xx) || defined(STM32G4xx) || defined(STM32L4xx) || defined(STM32MP1xx) +#elif defined(STM32F3xx) || defined(STM32G4xx) || defined(STM32L4xx)\ + || defined(STM32L5xx) || defined(STM32MP1xx) #define TIM8_IRQn TIM8_UP_IRQn #define TIM8_IRQHandler TIM8_UP_IRQHandler #endif #endif + #if defined(TIM9_BASE) && !defined(TIM9_IRQn) #if defined(STM32F1xx) || defined(STM32F2xx) ||defined(STM32F4xx) || defined(STM32F7xx) #define TIM9_IRQn TIM1_BRK_TIM9_IRQn diff --git a/libraries/SrcWrapper/src/stm32/analog.cpp b/libraries/SrcWrapper/src/stm32/analog.cpp index ea8d0998b1..852b99d8de 100644 --- a/libraries/SrcWrapper/src/stm32/analog.cpp +++ b/libraries/SrcWrapper/src/stm32/analog.cpp @@ -842,8 +842,8 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution) #endif #if !defined(STM32F1xx) && !defined(STM32F2xx) && !defined(STM32F3xx) && \ !defined(STM32F4xx) && !defined(STM32F7xx) && !defined(STM32G4xx) && \ - !defined(STM32H7xx) && !defined(STM32L4xx) && !defined(STM32MP1xx) && \ - !defined(STM32WBxx) + !defined(STM32H7xx) && !defined(STM32L4xx) && !defined(STM32L5xx) && \ + !defined(STM32MP1xx) && !defined(STM32WBxx) AdcHandle.Init.LowPowerAutoPowerOff = DISABLE; /* ADC automatically powers-off after a conversion and automatically wakes-up when a new conversion is triggered */ #endif #ifdef ADC_CHANNELS_BANK_A @@ -913,7 +913,7 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution) AdcChannelConf.Channel = channel; /* Specifies the channel to configure into ADC */ -#if defined(STM32L4xx) || defined(STM32WBxx) +#if defined(STM32L4xx) || defined(STM32L5xx) || defined(STM32WBxx) if (!IS_ADC_CHANNEL(&AdcHandle, AdcChannelConf.Channel)) { #elif defined(STM32G4xx) if (!IS_ADC_CHANNEL(&AdcHandle, AdcChannelConf.Channel)) { diff --git a/libraries/SrcWrapper/src/stm32/interrupt.cpp b/libraries/SrcWrapper/src/stm32/interrupt.cpp index 5a3d01f6da..1c568330cd 100644 --- a/libraries/SrcWrapper/src/stm32/interrupt.cpp +++ b/libraries/SrcWrapper/src/stm32/interrupt.cpp @@ -71,7 +71,7 @@ static gpio_irq_conf_str gpio_irq_conf[NB_EXTI] = { {.irqnb = EXTI4_15_IRQn, .callback = NULL}, //GPIO_PIN_13 {.irqnb = EXTI4_15_IRQn, .callback = NULL}, //GPIO_PIN_14 {.irqnb = EXTI4_15_IRQn, .callback = NULL} //GPIO_PIN_15 -#elif defined (STM32MP1xx) +#elif defined (STM32MP1xx) || defined (STM32L5xx) {.irqnb = EXTI0_IRQn, .callback = NULL}, //GPIO_PIN_0 {.irqnb = EXTI1_IRQn, .callback = NULL}, //GPIO_PIN_1 {.irqnb = EXTI2_IRQn, .callback = NULL}, //GPIO_PIN_2 diff --git a/libraries/SrcWrapper/src/stm32/system_stm32yyxx.c b/libraries/SrcWrapper/src/stm32/system_stm32yyxx.c index 89da3e7ae0..1725d9c251 100644 --- a/libraries/SrcWrapper/src/stm32/system_stm32yyxx.c +++ b/libraries/SrcWrapper/src/stm32/system_stm32yyxx.c @@ -36,6 +36,9 @@ #ifdef STM32L4xx #include "system_stm32l4xx.c" #endif +#ifdef STM32L5xx + #include "system_stm32l5xx.c" +#endif #ifdef STM32MP1xx #include "system_stm32mp1xx.c" #endif