Skip to content

Commit

Permalink
platform/technic_hub: use TIM6 for ADC
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dlech committed Nov 13, 2020
1 parent 9b84f4f commit 5e7a3bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/pbio/platform/technic_hub/pbdrvconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/pbio/platform/technic_hub/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5e7a3bf

Please sign in to comment.