Skip to content

Commit aef5dfe

Browse files
committed
cpu/stm32/gpio_ll: make style consistent
This block of code inconsistently made use of else-if statments. The patch makes the use consistent. The change also makes the code a bit simpler to read.
1 parent 1b1fbfe commit aef5dfe

1 file changed

Lines changed: 11 additions & 27 deletions

File tree

cpu/stm32/periph/gpio_ll_irq.c

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,19 @@
4242

4343
#if defined(EXTI_SWIER_SWI0) || defined(EXTI_SWIER_SWIER0)
4444
# define EXTI_REG_SWIER (EXTI->SWIER)
45-
#endif
46-
47-
#if defined(EXTI_SWIER1_SWI0) || defined(EXTI_SWIER1_SWIER0)
45+
#elif defined(EXTI_SWIER1_SWI0) || defined(EXTI_SWIER1_SWIER0)
4846
# define EXTI_REG_SWIER (EXTI->SWIER1)
4947
#endif
5048

5149
#if defined(EXTI_RTSR_RT0) || defined(EXTI_RTSR_TR0)
5250
# define EXTI_REG_RTSR (EXTI->RTSR)
53-
#endif
54-
55-
#if defined(EXTI_RTSR1_RT0) || defined(EXTI_RTSR1_TR0)
51+
#elif defined(EXTI_RTSR1_RT0) || defined(EXTI_RTSR1_TR0)
5652
# define EXTI_REG_RTSR (EXTI->RTSR1)
5753
#endif
5854

5955
#if defined(EXTI_FTSR_FT0) || defined(EXTI_FTSR_TR0)
6056
# define EXTI_REG_FTSR (EXTI->FTSR)
61-
#endif
62-
63-
#if defined(EXTI_FTSR1_FT0) || defined (EXTI_FTSR1_TR0)
57+
#elif defined(EXTI_FTSR1_FT0) || defined (EXTI_FTSR1_TR0)
6458
# define EXTI_REG_FTSR (EXTI->FTSR1)
6559
#endif
6660

@@ -81,40 +75,30 @@
8175
# define EXTI_REG_IMR (EXTI->IMR1)
8276
#endif
8377

84-
#ifdef RCC_APB2ENR_SYSCFGCOMPEN
78+
#if defined(RCC_APB2ENR_SYSCFGCOMPEN)
8579
# define SYSFG_CLOCK APB2
8680
# define SYSFG_ENABLE_MASK RCC_APB2ENR_SYSCFGCOMPEN
8781
#elif defined(RCC_APB2ENR_SYSCFGEN)
8882
# define SYSFG_CLOCK APB2
8983
# define SYSFG_ENABLE_MASK RCC_APB2ENR_SYSCFGEN
90-
#endif
91-
92-
#ifdef RCC_APB3ENR_SYSCFGEN
84+
#elif defined(RCC_APB3ENR_SYSCFGEN)
9385
# define SYSFG_CLOCK APB3
9486
# define SYSFG_ENABLE_MASK RCC_APB3ENR_SYSCFGEN
9587
#endif
9688

97-
#ifdef EXTI_EXTICR1_EXTI0
89+
#if defined(EXTI_EXTICR1_EXTI0)
9890
# define EXTICR_REG(num) (EXTI->EXTICR[(num) >> 2])
99-
#endif
100-
101-
#ifdef SYSCFG_EXTICR1_EXTI0
91+
#elif defined(SYSCFG_EXTICR1_EXTI0)
10292
# define EXTICR_REG(num) (SYSCFG->EXTICR[(num) >> 2])
103-
#endif
104-
105-
#ifdef AFIO_EXTICR1_EXTI0
93+
#elif defined(AFIO_EXTICR1_EXTI0)
10694
# define EXTICR_REG(num) (AFIO->EXTICR[(num) >> 2])
10795
#endif
10896

109-
#ifdef SYSCFG_EXTICR1_EXTI1_Pos
97+
#if defined(SYSCFG_EXTICR1_EXTI1_Pos)
11098
# define EXTICR_FIELD_SIZE SYSCFG_EXTICR1_EXTI1_Pos
111-
#endif
112-
113-
#ifdef EXTI_EXTICR1_EXTI1_Pos
99+
#elif defined(EXTI_EXTICR1_EXTI1_Pos)
114100
# define EXTICR_FIELD_SIZE EXTI_EXTICR1_EXTI1_Pos
115-
#endif
116-
117-
#ifdef AFIO_EXTICR1_EXTI1_Pos
101+
#elif defined(AFIO_EXTICR1_EXTI1_Pos)
118102
# define EXTICR_FIELD_SIZE AFIO_EXTICR1_EXTI1_Pos
119103
#endif
120104

0 commit comments

Comments
 (0)