From aa8358c4e561107353c875975aee7987926638c1 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Thu, 6 Aug 2020 16:02:14 +0200 Subject: [PATCH] [G0] Fix Timer and USART IRQ definition Signed-off-by: Frederic Pillon --- cores/arduino/stm32/timer.h | 2 +- cores/arduino/stm32/uart.h | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cores/arduino/stm32/timer.h b/cores/arduino/stm32/timer.h index 88f935512a..9275c4820e 100644 --- a/cores/arduino/stm32/timer.h +++ b/cores/arduino/stm32/timer.h @@ -75,7 +75,7 @@ extern "C" { #endif #endif #if defined(TIM7_BASE) && !defined(TIM7_IRQn) -#if defined(STM32G0xx) +#if defined(STM32G0xx) && defined(LPTIM2_BASE) #define TIM7_IRQn TIM7_LPTIM2_IRQn #define TIM7_IRQHandler TIM7_LPTIM2_IRQHandler #elif defined(STM32G4xx) diff --git a/cores/arduino/stm32/uart.h b/cores/arduino/stm32/uart.h index b4f6b115d2..3a530bdb72 100644 --- a/cores/arduino/stm32/uart.h +++ b/cores/arduino/stm32/uart.h @@ -99,9 +99,14 @@ struct serial_s { #endif /* STM32F091xC || STM32F098xx */ #endif /* STM32F0xx */ -#if defined(STM32G0xx) && !defined(STM32G030xx) && !defined(STM32G031xx) && !defined(STM32G041xx) +#if defined(STM32G0xx) +#if defined(LPUART1_BASE) #define USART3_IRQn USART3_4_LPUART1_IRQn #define USART3_IRQHandler USART3_4_LPUART1_IRQHandler +#else +#define USART3_IRQn USART3_4_IRQn +#define USART3_IRQHandler USART3_4_IRQHandler +#endif #endif /* STM32G0xx */ #endif @@ -118,8 +123,12 @@ struct serial_s { #elif defined(STM32L0xx) #define USART4_IRQn USART4_5_IRQn #endif /* STM32F0xx */ -#if defined(STM32G0xx) && !defined(STM32G030xx) && !defined(STM32G031xx) && !defined(STM32G041xx) +#if defined(STM32G0xx) +#if defined(LPUART1_BASE) #define USART4_IRQn USART3_4_LPUART1_IRQn +#else +#define USART4_IRQn USART3_4_IRQn +#endif #endif /* STM32G0xx */ #endif @@ -160,11 +169,12 @@ struct serial_s { #endif #endif /* STM32F0xx */ -#if defined(STM32G0xx) && !defined(STM32G030xx) && !defined(STM32G031xx) && !defined(STM32G041xx) #if defined(LPUART1_BASE) && !defined(LPUART1_IRQn) +#if defined(STM32G0xx) && defined(USART3_BASE) #define LPUART1_IRQn USART3_4_LPUART1_IRQn -#endif #endif /* STM32G0xx */ +#endif + /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */