1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Fix incorrect DMA index for RSSI and Current.

The result was that RSSI and Current were transposed when both were used
together.
This commit is contained in:
Dominic Clifton 2015-08-05 04:42:46 +01:00
parent 5b236a8133
commit 56010f2da7

View file

@ -64,19 +64,6 @@ void adcInit(drv_adc_config_t *init)
} }
#endif #endif
#ifdef CURRENT_METER_ADC_GPIO
if (init->enableCurrentMeter) {
GPIO_InitStructure.GPIO_Pin = CURRENT_METER_ADC_GPIO_PIN;
GPIO_Init(CURRENT_METER_ADC_GPIO, &GPIO_InitStructure);
adcConfig[ADC_CURRENT].adcChannel = CURRENT_METER_ADC_CHANNEL;
adcConfig[ADC_CURRENT].dmaIndex = adcChannelCount;
adcConfig[ADC_CURRENT].sampleTime = ADC_SampleTime_601Cycles5;
adcConfig[ADC_CURRENT].enabled = true;
adcChannelCount++;
}
#endif
#ifdef RSSI_ADC_GPIO #ifdef RSSI_ADC_GPIO
if (init->enableRSSI) { if (init->enableRSSI) {
GPIO_InitStructure.GPIO_Pin = RSSI_ADC_GPIO_PIN; GPIO_InitStructure.GPIO_Pin = RSSI_ADC_GPIO_PIN;
@ -90,6 +77,19 @@ void adcInit(drv_adc_config_t *init)
} }
#endif #endif
#ifdef CURRENT_METER_ADC_GPIO
if (init->enableCurrentMeter) {
GPIO_InitStructure.GPIO_Pin = CURRENT_METER_ADC_GPIO_PIN;
GPIO_Init(CURRENT_METER_ADC_GPIO, &GPIO_InitStructure);
adcConfig[ADC_CURRENT].adcChannel = CURRENT_METER_ADC_CHANNEL;
adcConfig[ADC_CURRENT].dmaIndex = adcChannelCount;
adcConfig[ADC_CURRENT].sampleTime = ADC_SampleTime_601Cycles5;
adcConfig[ADC_CURRENT].enabled = true;
adcChannelCount++;
}
#endif
#ifdef EXTERNAL1_ADC_GPIO #ifdef EXTERNAL1_ADC_GPIO
GPIO_InitStructure.GPIO_Pin = EXTERNAL1_ADC_GPIO_PIN; GPIO_InitStructure.GPIO_Pin = EXTERNAL1_ADC_GPIO_PIN;
GPIO_Init(EXTERNAL1_ADC_GPIO, &GPIO_InitStructure); GPIO_Init(EXTERNAL1_ADC_GPIO, &GPIO_InitStructure);