1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 21:35:44 +03:00

Merge pull request #9624 from jflyper/bfdev-adc-remove-MAX_ADC_SUPPORTED

[ADC] Remove MAX_ADC_SUPPORTED and related assertion
This commit is contained in:
Michael Keller 2020-07-05 14:16:21 +12:00 committed by GitHub
commit 8a1e80bf18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -39,17 +39,19 @@ PG_REGISTER_WITH_RESET_FN(adcConfig_t, adcConfig, PG_ADC_CONFIG, 0);
void pgResetFn_adcConfig(adcConfig_t *adcConfig) 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->device = ADC_DEV_TO_CFG(adcDeviceByInstance(ADC_INSTANCE));
adcConfig->dmaopt[ADCDEV_1] = ADC1_DMA_OPT; adcConfig->dmaopt[ADCDEV_1] = ADC1_DMA_OPT;
#ifndef STM32F1 // These conditionals need to match the ones used in 'src/main/drivers/adc.h'.
#if defined(STM32F3) || defined(STM32F4) || defined(STM32F7) || defined(STM32H7) || defined(STM32G4)
adcConfig->dmaopt[ADCDEV_2] = ADC2_DMA_OPT; adcConfig->dmaopt[ADCDEV_2] = ADC2_DMA_OPT;
adcConfig->dmaopt[ADCDEV_3] = ADC3_DMA_OPT; adcConfig->dmaopt[ADCDEV_3] = ADC3_DMA_OPT;
#endif #endif
#ifdef STM32F3 #if defined(STM32F3) || defined(STM32G4)
adcConfig->dmaopt[ADCDEV_4] = ADC4_DMA_OPT; adcConfig->dmaopt[ADCDEV_4] = ADC4_DMA_OPT;
#endif #endif
#if defined(STM32G4)
adcConfig->dmaopt[ADCDEV_5] = ADC5_DMA_OPT;
#endif
#ifdef VBAT_ADC_PIN #ifdef VBAT_ADC_PIN
adcConfig->vbat.enabled = true; adcConfig->vbat.enabled = true;

View file

@ -28,8 +28,6 @@
#include "drivers/io_types.h" #include "drivers/io_types.h"
#include "drivers/dma_reqmap.h" #include "drivers/dma_reqmap.h"
#define MAX_ADC_SUPPORTED 4
typedef struct adcChannelConfig_t { typedef struct adcChannelConfig_t {
bool enabled; bool enabled;
ioTag_t ioTag; ioTag_t ioTag;
@ -46,7 +44,7 @@ typedef struct adcConfig_s {
uint16_t tempSensorCalibration1; uint16_t tempSensorCalibration1;
uint16_t tempSensorCalibration2; uint16_t tempSensorCalibration2;
int8_t dmaopt[MAX_ADC_SUPPORTED]; // One per ADCDEV_x int8_t dmaopt[ADCDEV_COUNT]; // One per ADCDEV_x
} adcConfig_t; } adcConfig_t;
PG_DECLARE(adcConfig_t, adcConfig); PG_DECLARE(adcConfig_t, adcConfig);