1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Fix missing ADC4 dma mapping for F3.

Fix incorrect count of dma options for F3.

Value was hardcoded to 3, but the F3 has 4 ADCs.

Fix dmaPeripheralMapping for F3.

The dmaPeripheralMapping table was using index numbers and not device
numbers.

This meant all the dma mappings were out by one, eg.

```

```

ADC 1 is on DMA1, channel 1, but the output from dma ADC 2 list shows
the possibilities for ADC 1, not ADC 2 and shows no possibilities for
dma ADC 1 list

Ensure there are defaults for ADC4 on F3.

Always use 4 ADC instances for the ADC PG.

* PG should not be target dependant.
* Add a static assert which will fail if anything is changed.

Fix dmaopt in ADC PG, it should be a int8_t, not uint8_t
This commit is contained in:
Dominic Clifton 2019-08-28 22:58:24 +02:00 committed by mikeller
parent 692bf9c56e
commit 13095343e7
4 changed files with 36 additions and 20 deletions

View file

@ -39,12 +39,17 @@ PG_REGISTER_WITH_RESET_FN(adcConfig_t, adcConfig, PG_ADC_CONFIG, 0);
void pgResetFn_adcConfig(adcConfig_t *adcConfig)
{
STATIC_ASSERT(MAX_ADC_SUPPORTED <= ADC_DEV_TO_CFG(ADCDEV_COUNT) || MAX_ADC_SUPPORTED != 4, adc_count_mismatch);
adcConfig->device = ADC_DEV_TO_CFG(adcDeviceByInstance(ADC_INSTANCE));
adcConfig->dmaopt[ADCDEV_1] = ADC1_DMA_OPT;
#ifndef STM32F1
adcConfig->dmaopt[ADCDEV_2] = ADC2_DMA_OPT;
adcConfig->dmaopt[ADCDEV_3] = ADC3_DMA_OPT;
#endif
#ifdef STM32F3
adcConfig->dmaopt[ADCDEV_4] = ADC4_DMA_OPT;
#endif
#ifdef VBAT_ADC_PIN
adcConfig->vbat.enabled = true;