1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-12 19:10:32 +03:00

ADC DEVICE correction and comment.

This commit is contained in:
blckmn 2025-07-08 09:01:30 +10:00
parent dd1e59d6ae
commit 3b4de9d09f
5 changed files with 10 additions and 20 deletions

View file

@ -59,10 +59,10 @@ typedef enum {
#if PLATFORM_TRAIT_ADC_INTERNAL
// On H7 and G4, internal sensors are treated in the similar fashion as regular ADC inputs
ADC_CHANNEL_INTERNAL_FIRST_ID = 4,
ADC_TEMPSENSOR = 4,
ADC_VREFINT = 5,
#if PLATFORM_TRAIT_ADC_INTERNAL_VBAT4
ADC_VBAT4 = 6,
ADC_TEMPSENSOR = ADC_CHANNEL_INTERNAL_FIRST_ID,
ADC_VREFINT,
#if ADC_INTERNAL_VBAT4_ENABLED
ADC_VBAT4,
#endif
#endif
ADC_CHANNEL_COUNT
@ -73,11 +73,7 @@ typedef struct adcOperatingConfig_s {
#if PLATFORM_TRAIT_ADC_DEVICE
ADCDevice adcDevice; // ADCDEV_x for this input
#endif
#if PLATFORM_TRAIT_ADC_CHANNEL_32BIT
uint32_t adcChannel; // Channel number for this input. Note that H7 and G4 HAL requires this to be 32-bit encoded number.
#else
uint8_t adcChannel; // ADCy_INxx channel number for this input (XXX May be consolidated with uint32_t case)
#endif
uint8_t dmaIndex; // index into DMA buffer in case of sparse channels
bool enabled;
uint8_t sampleTime;

View file

@ -31,7 +31,7 @@
typedef struct adcChannelConfig_t {
bool enabled;
ioTag_t ioTag;
#if defined(STM32H7)
#if PLATFORM_TRAIT_ADC_DEVICE
int8_t device; // ADCDevice
#endif
} adcChannelConfig_t;

View file

@ -70,10 +70,10 @@ typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
#define PLATFORM_TRAIT_ADC_INTERNAL 1
#define PLATFORM_TRAIT_ADC_INTERNAL_VBAT4 0
#define ADC_INTERNAL_VBAT4_ENABLED 0
/* AT32F4 we need to specify the ADC device for each channel */
#define PLATFORM_TRAIT_ADC_DEVICE 1
#define PLATFORM_TRAIT_ADC_CHANNEL_32BIT 1
#endif
#define USE_USB_MSC

View file

@ -468,14 +468,9 @@ extern uint8_t _dmaram_end__;
#define DMA_CHANREQ_STRING "Request"
#define PLATFORM_TRAIT_ADC_INTERNAL 1
#define PLATFORM_TRAIT_ADC_INTERNAL_VBAT4 1
#define ADC_INTERNAL_VBAT4_ENABLED 1
/* H7 and G4 we need to specify the ADC device for each channel */
#define PLATFORM_TRAIT_ADC_DEVICE 1
#define PLATFORM_TRAIT_ADC_CHANNEL_32BIT 1
#if defined(STM32H7)
#define PLATFORM_TRAIT_ADC_DEVICE 1
#endif
#endif
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)

View file

@ -162,6 +162,5 @@ void adcGetChannelValues(void);
#define TEMPSENSOR_CAL_VREFANALOG (3300U)
#define TEMPSENSOR_CAL1_TEMP (25U)
#define TEMPSENSOR_CAL1_V (1.27f)
// mV/C
#define TEMPSENSOR_SLOPE (-4.13f)
#define TEMPSENSOR_SLOPE (-4.13f /* mV/C */)
#endif