mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Merge pull request #11014 from mikeller/fix_h7_adc
This commit is contained in:
parent
8b95d65e3b
commit
e341107e79
8 changed files with 6 additions and 42 deletions
|
@ -42,17 +42,6 @@
|
||||||
|
|
||||||
#include "pg/adc.h"
|
#include "pg/adc.h"
|
||||||
|
|
||||||
// XXX Instance and DMA stream defs will be gone in unified target
|
|
||||||
|
|
||||||
#ifndef ADC1_INSTANCE
|
|
||||||
#define ADC1_INSTANCE NULL
|
|
||||||
#endif
|
|
||||||
#ifndef ADC2_INSTANCE
|
|
||||||
#define ADC2_INSTANCE NULL
|
|
||||||
#endif
|
|
||||||
#ifndef ADC3_INSTANCE
|
|
||||||
#define ADC3_INSTANCE NULL
|
|
||||||
#endif
|
|
||||||
#ifndef ADC1_DMA_STREAM
|
#ifndef ADC1_DMA_STREAM
|
||||||
#define ADC1_DMA_STREAM NULL
|
#define ADC1_DMA_STREAM NULL
|
||||||
#endif
|
#endif
|
||||||
|
@ -65,25 +54,25 @@
|
||||||
|
|
||||||
const adcDevice_t adcHardware[ADCDEV_COUNT] = {
|
const adcDevice_t adcHardware[ADCDEV_COUNT] = {
|
||||||
{
|
{
|
||||||
.ADCx = ADC1_INSTANCE,
|
.ADCx = ADC1,
|
||||||
.rccADC = RCC_AHB1(ADC12),
|
.rccADC = RCC_AHB1(ADC12),
|
||||||
#if !defined(USE_DMA_SPEC)
|
#if !defined(USE_DMA_SPEC)
|
||||||
.dmaResource = (dmaResource_t *)ADC1_DMA_STREAM,
|
.dmaResource = (dmaResource_t *)ADC1_DMA_STREAM,
|
||||||
.channel = DMA_REQUEST_ADC1,
|
.channel = DMA_REQUEST_ADC1,
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
{ .ADCx = ADC2_INSTANCE,
|
{ .ADCx = ADC2,
|
||||||
.rccADC = RCC_AHB1(ADC12),
|
.rccADC = RCC_AHB1(ADC12),
|
||||||
#if !defined(USE_DMA_SPEC)
|
#if !defined(USE_DMA_SPEC)
|
||||||
.dmaResource = (dmaResource_t *)ADC2_DMA_STREAM,
|
.dmaResource = (dmaResource_t *)ADC2_DMA_STREAM,
|
||||||
.channel = DMA_REQUEST_ADC2,
|
.channel = DMA_REQUEST_ADC2,
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
#if defined(ADC3)
|
#if !(defined(STM32H7A3xx) || defined(STM32H7A3xxQ))
|
||||||
// ADC3 is not available on all H7 MCUs, e.g. H7A3
|
// ADC3 is not available on all H7 MCUs, e.g. H7A3
|
||||||
// On H743 and H750, ADC3 can be serviced by BDMA also, but we settle for DMA1 or 2 (for now).
|
// On H743 and H750, ADC3 can be serviced by BDMA also, but we settle for DMA1 or 2 (for now).
|
||||||
{
|
{
|
||||||
.ADCx = ADC3_INSTANCE,
|
.ADCx = ADC3,
|
||||||
.rccADC = RCC_AHB4(ADC3),
|
.rccADC = RCC_AHB4(ADC3),
|
||||||
#if !defined(USE_DMA_SPEC)
|
#if !defined(USE_DMA_SPEC)
|
||||||
.dmaResource = (dmaResource_t *)ADC3_DMA_STREAM,
|
.dmaResource = (dmaResource_t *)ADC3_DMA_STREAM,
|
||||||
|
@ -348,7 +337,7 @@ void adcInit(const adcConfig_t *config)
|
||||||
for (int dev = 0; dev < ADCDEV_COUNT; dev++) {
|
for (int dev = 0; dev < ADCDEV_COUNT; dev++) {
|
||||||
adcDevice_t *adc = &adcDevice[dev];
|
adcDevice_t *adc = &adcDevice[dev];
|
||||||
|
|
||||||
if (!(adc->ADCx && adc->channelBits)) {
|
if (!adc->channelBits) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,7 +452,7 @@ void adcInit(const adcConfig_t *config)
|
||||||
|
|
||||||
adcDevice_t *adc = &adcDevice[dev];
|
adcDevice_t *adc = &adcDevice[dev];
|
||||||
|
|
||||||
if (!(adc->ADCx && adc->channelBits)) {
|
if (!adc->channelBits) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,10 +171,6 @@
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
#define USE_ADC_INTERNAL
|
#define USE_ADC_INTERNAL
|
||||||
|
|
||||||
#define ADC1_INSTANCE ADC1
|
|
||||||
#define ADC2_INSTANCE ADC2
|
|
||||||
#define ADC3_INSTANCE ADC3
|
|
||||||
|
|
||||||
#define RSSI_ADC_PIN PC5
|
#define RSSI_ADC_PIN PC5
|
||||||
#define VBAT_ADC_PIN PC3
|
#define VBAT_ADC_PIN PC3
|
||||||
#define CURRENT_METER_ADC_PIN PC2
|
#define CURRENT_METER_ADC_PIN PC2
|
||||||
|
|
|
@ -168,10 +168,6 @@
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
#define USE_ADC_INTERNAL
|
#define USE_ADC_INTERNAL
|
||||||
|
|
||||||
#define ADC1_INSTANCE ADC1
|
|
||||||
#define ADC2_INSTANCE ADC2
|
|
||||||
#define ADC3_INSTANCE ADC3
|
|
||||||
|
|
||||||
#define RSSI_ADC_PIN PC5
|
#define RSSI_ADC_PIN PC5
|
||||||
#define VBAT_ADC_PIN PC3
|
#define VBAT_ADC_PIN PC3
|
||||||
#define CURRENT_METER_ADC_PIN PC2
|
#define CURRENT_METER_ADC_PIN PC2
|
||||||
|
|
|
@ -246,10 +246,6 @@
|
||||||
|
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
|
|
||||||
#define ADC1_INSTANCE ADC1
|
|
||||||
#define ADC2_INSTANCE ADC2
|
|
||||||
#define ADC3_INSTANCE ADC3
|
|
||||||
|
|
||||||
// DMA stream assignmnets
|
// DMA stream assignmnets
|
||||||
#define VBAT_ADC_PIN PB1 // ADC1
|
#define VBAT_ADC_PIN PB1 // ADC1
|
||||||
#define CURRENT_METER_ADC_PIN PC0 // ADC1
|
#define CURRENT_METER_ADC_PIN PC0 // ADC1
|
||||||
|
|
|
@ -218,10 +218,6 @@
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
#define USE_ADC_INTERNAL // ADC3
|
#define USE_ADC_INTERNAL // ADC3
|
||||||
|
|
||||||
#define ADC1_INSTANCE ADC1
|
|
||||||
#define ADC2_INSTANCE ADC2 // ADC2 not used
|
|
||||||
#define ADC3_INSTANCE ADC3 // ADC3 only for core temp and vrefint
|
|
||||||
|
|
||||||
#define RSSI_ADC_PIN PC4 // ADC123
|
#define RSSI_ADC_PIN PC4 // ADC123
|
||||||
#define VBAT_ADC_PIN PC1 // ADC12
|
#define VBAT_ADC_PIN PC1 // ADC12
|
||||||
#define CURRENT_METER_ADC_PIN PC0 // ADC123
|
#define CURRENT_METER_ADC_PIN PC0 // ADC123
|
||||||
|
|
|
@ -211,10 +211,6 @@
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
#define USE_ADC_INTERNAL // ADC3
|
#define USE_ADC_INTERNAL // ADC3
|
||||||
|
|
||||||
#define ADC1_INSTANCE ADC1
|
|
||||||
#define ADC2_INSTANCE ADC2 // ADC2 not used
|
|
||||||
#define ADC3_INSTANCE ADC3 // ADC3 only for core temp and vrefint
|
|
||||||
|
|
||||||
#define RSSI_ADC_PIN PC4 // ADC123
|
#define RSSI_ADC_PIN PC4 // ADC123
|
||||||
#define VBAT_ADC_PIN PC1 // ADC12
|
#define VBAT_ADC_PIN PC1 // ADC12
|
||||||
#define CURRENT_METER_ADC_PIN PC0 // ADC123
|
#define CURRENT_METER_ADC_PIN PC0 // ADC123
|
||||||
|
|
|
@ -213,10 +213,6 @@
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
#define USE_ADC_INTERNAL // ADC3
|
#define USE_ADC_INTERNAL // ADC3
|
||||||
|
|
||||||
#define ADC1_INSTANCE ADC1
|
|
||||||
#define ADC2_INSTANCE ADC2 // ADC2 not used
|
|
||||||
#define ADC3_INSTANCE ADC3 // ADC3 only for core temp and vrefint
|
|
||||||
|
|
||||||
#define RSSI_ADC_PIN PC0 // ADC123
|
#define RSSI_ADC_PIN PC0 // ADC123
|
||||||
#define VBAT_ADC_PIN PC4 // ADC123
|
#define VBAT_ADC_PIN PC4 // ADC123
|
||||||
#define CURRENT_METER_ADC_PIN PC1 // ADC12
|
#define CURRENT_METER_ADC_PIN PC1 // ADC12
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
#define USE_DYN_IDLE
|
#define USE_DYN_IDLE
|
||||||
#define I2C3_OVERCLOCK true
|
#define I2C3_OVERCLOCK true
|
||||||
#define USE_GYRO_DATA_ANALYSE
|
#define USE_GYRO_DATA_ANALYSE
|
||||||
#define USE_ADC
|
|
||||||
#define USE_ADC_INTERNAL
|
#define USE_ADC_INTERNAL
|
||||||
#define USE_USB_CDC_HID
|
#define USE_USB_CDC_HID
|
||||||
#define USE_USB_MSC
|
#define USE_USB_MSC
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue