From 58ae4d494a15c591ada0cc71a0a3abed7fcbdecd Mon Sep 17 00:00:00 2001 From: jflyper Date: Tue, 29 Aug 2017 00:22:24 +0900 Subject: [PATCH] Avoid initializing TIM_USE_NONE pins --- src/main/drivers/timer.c | 3 +++ src/main/drivers/timer_hal.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/main/drivers/timer.c b/src/main/drivers/timer.c index a53128bbdd..d51aa743eb 100755 --- a/src/main/drivers/timer.c +++ b/src/main/drivers/timer.c @@ -709,6 +709,9 @@ void timerInit(void) #if defined(STM32F3) || defined(STM32F4) for (int timerIndex = 0; timerIndex < USABLE_TIMER_CHANNEL_COUNT; timerIndex++) { const timerHardware_t *timerHardwarePtr = &timerHardware[timerIndex]; + if (timerHardwarePtr->usageFlags == TIM_USE_NONE) { + continue; + } IOConfigGPIOAF(IOGetByTag(timerHardwarePtr->tag), IOCFG_AF_PP, timerHardwarePtr->alternateFunction); } #endif diff --git a/src/main/drivers/timer_hal.c b/src/main/drivers/timer_hal.c index 95653b4517..4aeb43ca44 100644 --- a/src/main/drivers/timer_hal.c +++ b/src/main/drivers/timer_hal.c @@ -807,6 +807,9 @@ void timerInit(void) #if defined(STM32F3) || defined(STM32F4) || defined(STM32F7) for (int timerIndex = 0; timerIndex < USABLE_TIMER_CHANNEL_COUNT; timerIndex++) { const timerHardware_t *timerHardwarePtr = &timerHardware[timerIndex]; + if (timerHardwarePtr->usageFlags == TIM_USE_NONE) { + continue; + } IOConfigGPIOAF(IOGetByTag(timerHardwarePtr->tag), IOCFG_AF_PP, timerHardwarePtr->alternateFunction); } #endif