From c4c0d14ea4ef81601de95d811a7093976f1e47f1 Mon Sep 17 00:00:00 2001 From: Guillaume Revaillot Date: Wed, 23 Jan 2019 18:54:19 +0100 Subject: [PATCH] stm32: exti: stm32g0 have enhanced EXTI_[FR]PR regs instead of EXTIR_PR, use them if defined. Make exti_get_flag_status and exti_reset_request use EXTI_RPR and EXTI_FPR if present instead of EXTI_PR. This is less precise than offered by the RPR/FPR registers, but makes for a consistent experience in the common API. Reviewed-by: Karl Palsson --- lib/stm32/common/exti_common_all.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/stm32/common/exti_common_all.c b/lib/stm32/common/exti_common_all.c index 4ba64b02..5a88b232 100644 --- a/lib/stm32/common/exti_common_all.c +++ b/lib/stm32/common/exti_common_all.c @@ -80,7 +80,12 @@ void exti_disable_request(uint32_t extis) */ void exti_reset_request(uint32_t extis) { +#if defined(EXTI_RPR1) && defined(EXTI_FPR1) + EXTI_RPR1 = extis; + EXTI_FPR1 = extis; +#else EXTI_PR = extis; +#endif } /* @@ -88,7 +93,11 @@ void exti_reset_request(uint32_t extis) * */ uint32_t exti_get_flag_status(uint32_t exti) { +#if defined(EXTI_RPR1) && defined(EXTI_FPR1) + return (EXTI_RPR1 & exti) | (EXTI_FPR1 & exti); +#else return EXTI_PR & exti; +#endif } /*