From 5e7a3bf88b5e5b436d4d37d3e0654205866e8f1b Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 13 Nov 2020 14:47:27 -0600 Subject: [PATCH] platform/technic_hub: use TIM6 for ADC This replaces TIM2 with TIM6 to trigger the ADC on Technic hub. TIM2 is a more advanced timer, so we would like to reserve it for another use. --- lib/pbio/platform/technic_hub/pbdrvconfig.h | 4 ++-- lib/pbio/platform/technic_hub/platform.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pbio/platform/technic_hub/pbdrvconfig.h b/lib/pbio/platform/technic_hub/pbdrvconfig.h index 2c95da53c..4f2296394 100644 --- a/lib/pbio/platform/technic_hub/pbdrvconfig.h +++ b/lib/pbio/platform/technic_hub/pbdrvconfig.h @@ -11,8 +11,8 @@ #define PBDRV_CONFIG_ADC_STM32_HAL_DMA_INSTANCE DMA1_Channel1 #define PBDRV_CONFIG_ADC_STM32_HAL_DMA_REQUEST DMA_REQUEST_0 #define PBDRV_CONFIG_ADC_STM32_HAL_DMA_IRQ DMA1_Channel1_IRQn -#define PBDRV_CONFIG_ADC_STM32_HAL_TIMER_INSTANCE TIM2 -#define PBDRV_CONFIG_ADC_STM32_HAL_TIMER_TRIGGER ADC_EXTERNALTRIG_T2_TRGO +#define PBDRV_CONFIG_ADC_STM32_HAL_TIMER_INSTANCE TIM6 +#define PBDRV_CONFIG_ADC_STM32_HAL_TIMER_TRIGGER ADC_EXTERNALTRIG_T6_TRGO #define PBDRV_CONFIG_BATTERY (1) #define PBDRV_CONFIG_BATTERY_ADC (1) diff --git a/lib/pbio/platform/technic_hub/platform.c b/lib/pbio/platform/technic_hub/platform.c index aa2216891..7b4e98bc3 100644 --- a/lib/pbio/platform/technic_hub/platform.c +++ b/lib/pbio/platform/technic_hub/platform.c @@ -435,8 +435,8 @@ void SystemInit(void) { RCC_AHB1ENR_CRCEN; RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN | RCC_AHB2ENR_GPIOBEN | RCC_AHB2ENR_GPIOCEN | RCC_AHB2ENR_GPIODEN | RCC_AHB2ENR_GPIOHEN | RCC_AHB2ENR_ADCEN; - RCC->APB1ENR1 |= RCC_APB1ENR1_TIM2EN | RCC_APB1ENR1_WWDGEN | RCC_APB1ENR1_USART2EN | - RCC_APB1ENR1_USART3EN | RCC_APB1ENR1_I2C1EN | RCC_APB1ENR1_PWREN; + RCC->APB1ENR1 |= RCC_APB1ENR1_TIM2EN | RCC_APB1ENR1_TIM6EN | RCC_APB1ENR1_WWDGEN | + RCC_APB1ENR1_USART2EN | RCC_APB1ENR1_USART3EN | RCC_APB1ENR1_I2C1EN | RCC_APB1ENR1_PWREN; RCC->APB1ENR2 |= RCC_APB1ENR2_LPUART1EN; RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN | RCC_APB2ENR_TIM1EN | RCC_APB2ENR_SPI1EN | RCC_APB2ENR_USART1EN | RCC_APB2ENR_TIM15EN | RCC_APB2ENR_TIM16EN;