1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 08:15:26 +03:00

Merge pull request #3673 from iNavFlight/de_timer_fixes

Initialize timer pins in a backward-compatible way.
This commit is contained in:
Konstantin Sharlaimov 2018-08-01 19:52:19 +02:00 committed by GitHub
commit be5f1be1cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View file

@ -94,10 +94,10 @@ void enableGPIOPowerUsageAndNoiseReductions(void)
RCC_APB1Periph_I2C1 |
RCC_APB1Periph_I2C2 |
RCC_APB1Periph_I2C3 |
RCC_APB1Periph_CAN1 |
RCC_APB1Periph_CAN2 |
// RCC_APB1Periph_CAN1 |
// RCC_APB1Periph_CAN2 |
RCC_APB1Periph_PWR |
RCC_APB1Periph_DAC |
// RCC_APB1Periph_DAC |
0, ENABLE);
RCC_APB2PeriphClockCmd(
@ -109,7 +109,7 @@ void enableGPIOPowerUsageAndNoiseReductions(void)
RCC_APB2Periph_ADC1 |
RCC_APB2Periph_ADC2 |
RCC_APB2Periph_ADC3 |
RCC_APB2Periph_SDIO |
// RCC_APB2Periph_SDIO |
RCC_APB2Periph_SPI1 |
RCC_APB2Periph_SYSCFG |
RCC_APB2Periph_TIM9 |
@ -119,7 +119,7 @@ void enableGPIOPowerUsageAndNoiseReductions(void)
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; // default is un-pulled input
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Pin &= ~(GPIO_Pin_11 | GPIO_Pin_12); // leave USB D+/D- alone

View file

@ -188,9 +188,15 @@ void timerInit(void)
/* enable the timer peripherals */
for (int i = 0; i < timerHardwareCount; i++) {
unsigned timer = lookupTimerIndex(timerHardware[i].tim);
RCC_ClockCmd(timerDefinitions[timer].rcc, ENABLE);
}
/* Before 2.0 timer outputs were initialized to IOCFG_AF_PP_PD even if not used */
/* To keep compatibility make sure all timer output pins are mapped to INPUT with weak pull-down */
for (int i = 0; i < timerHardwareCount; i++) {
const timerHardware_t *timerHardwarePtr = &timerHardware[i];
IOConfigGPIO(IOGetByTag(timerHardwarePtr->tag), IOCFG_IPD);
}
}
const timerHardware_t *timerGetByTag(ioTag_t tag, timerUsageFlag_e flag)