Skip to content

Commit

Permalink
boards/common/stm32: simplify ifdef logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Enoch247 committed Apr 23, 2024
1 parent 3ae63a1 commit 3152301
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
5 changes: 2 additions & 3 deletions boards/common/stm32/include/cfg_timer_tim2.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ static const timer_conf_t timer_config[] = {
#else
.max = 0xffffffff,
#endif
#if defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32WB) || \
defined(CPU_FAM_STM32WL) || defined(CPU_FAM_STM32G4)
#if defined(RCC_APB1ENR1_TIM2EN)
.rcc_mask = RCC_APB1ENR1_TIM2EN,
#elif CPU_FAM_STM32MP1
#elif defined(RCC_MC_APB1ENSETR_TIM2EN)
.rcc_mask = RCC_MC_APB1ENSETR_TIM2EN,
#else
.rcc_mask = RCC_APB1ENR_TIM2EN,
Expand Down
3 changes: 1 addition & 2 deletions boards/common/stm32/include/cfg_timer_tim5.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ static const timer_conf_t timer_config[] = {
{
.dev = TIM5,
.max = 0xffffffff,
#if defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32L5) || \
defined(CPU_FAM_STM32U5)
#if defined(RCC_APB1ENR1_TIM5EN)
.rcc_mask = RCC_APB1ENR1_TIM5EN,
#else
.rcc_mask = RCC_APB1ENR_TIM5EN,
Expand Down
8 changes: 3 additions & 5 deletions boards/common/stm32/include/cfg_timer_tim5_and_tim2.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ static const timer_conf_t timer_config[] = {
{
.dev = TIM5,
.max = 0xffffffff,
#if defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32L5) || \
defined(CPU_FAM_STM32U5)
#if defined(RCC_APB1ENR1_TIM5EN)
.rcc_mask = RCC_APB1ENR1_TIM5EN,
#else
.rcc_mask = RCC_APB1ENR_TIM5EN,
Expand All @@ -53,10 +52,9 @@ static const timer_conf_t timer_config[] = {
#else
.max = 0xffffffff,
#endif
#if defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32WB) || \
defined(CPU_FAM_STM32WL) || defined(CPU_FAM_STM32G4)
#if defined(RCC_APB1ENR1_TIM2EN)
.rcc_mask = RCC_APB1ENR1_TIM2EN,
#elif CPU_FAM_STM32MP1
#elif defined(RCC_MC_APB1ENSETR_TIM2EN)
.rcc_mask = RCC_MC_APB1ENSETR_TIM2EN,
#else
.rcc_mask = RCC_APB1ENR_TIM2EN,
Expand Down

0 comments on commit 3152301

Please sign in to comment.