mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 16:25: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:
commit
be5f1be1cb
2 changed files with 12 additions and 6 deletions
|
@ -94,10 +94,10 @@ void enableGPIOPowerUsageAndNoiseReductions(void)
|
||||||
RCC_APB1Periph_I2C1 |
|
RCC_APB1Periph_I2C1 |
|
||||||
RCC_APB1Periph_I2C2 |
|
RCC_APB1Periph_I2C2 |
|
||||||
RCC_APB1Periph_I2C3 |
|
RCC_APB1Periph_I2C3 |
|
||||||
RCC_APB1Periph_CAN1 |
|
// RCC_APB1Periph_CAN1 |
|
||||||
RCC_APB1Periph_CAN2 |
|
// RCC_APB1Periph_CAN2 |
|
||||||
RCC_APB1Periph_PWR |
|
RCC_APB1Periph_PWR |
|
||||||
RCC_APB1Periph_DAC |
|
// RCC_APB1Periph_DAC |
|
||||||
0, ENABLE);
|
0, ENABLE);
|
||||||
|
|
||||||
RCC_APB2PeriphClockCmd(
|
RCC_APB2PeriphClockCmd(
|
||||||
|
@ -109,7 +109,7 @@ void enableGPIOPowerUsageAndNoiseReductions(void)
|
||||||
RCC_APB2Periph_ADC1 |
|
RCC_APB2Periph_ADC1 |
|
||||||
RCC_APB2Periph_ADC2 |
|
RCC_APB2Periph_ADC2 |
|
||||||
RCC_APB2Periph_ADC3 |
|
RCC_APB2Periph_ADC3 |
|
||||||
RCC_APB2Periph_SDIO |
|
// RCC_APB2Periph_SDIO |
|
||||||
RCC_APB2Periph_SPI1 |
|
RCC_APB2Periph_SPI1 |
|
||||||
RCC_APB2Periph_SYSCFG |
|
RCC_APB2Periph_SYSCFG |
|
||||||
RCC_APB2Periph_TIM9 |
|
RCC_APB2Periph_TIM9 |
|
||||||
|
@ -119,7 +119,7 @@ void enableGPIOPowerUsageAndNoiseReductions(void)
|
||||||
|
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
GPIO_StructInit(&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_All;
|
||||||
GPIO_InitStructure.GPIO_Pin &= ~(GPIO_Pin_11 | GPIO_Pin_12); // leave USB D+/D- alone
|
GPIO_InitStructure.GPIO_Pin &= ~(GPIO_Pin_11 | GPIO_Pin_12); // leave USB D+/D- alone
|
||||||
|
|
|
@ -188,9 +188,15 @@ void timerInit(void)
|
||||||
/* enable the timer peripherals */
|
/* enable the timer peripherals */
|
||||||
for (int i = 0; i < timerHardwareCount; i++) {
|
for (int i = 0; i < timerHardwareCount; i++) {
|
||||||
unsigned timer = lookupTimerIndex(timerHardware[i].tim);
|
unsigned timer = lookupTimerIndex(timerHardware[i].tim);
|
||||||
|
|
||||||
RCC_ClockCmd(timerDefinitions[timer].rcc, ENABLE);
|
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)
|
const timerHardware_t *timerGetByTag(ioTag_t tag, timerUsageFlag_e flag)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue