mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
ADC DEVICE correction and comment.
This commit is contained in:
parent
dd1e59d6ae
commit
3b4de9d09f
5 changed files with 10 additions and 20 deletions
|
@ -59,10 +59,10 @@ typedef enum {
|
||||||
#if PLATFORM_TRAIT_ADC_INTERNAL
|
#if PLATFORM_TRAIT_ADC_INTERNAL
|
||||||
// On H7 and G4, internal sensors are treated in the similar fashion as regular ADC inputs
|
// On H7 and G4, internal sensors are treated in the similar fashion as regular ADC inputs
|
||||||
ADC_CHANNEL_INTERNAL_FIRST_ID = 4,
|
ADC_CHANNEL_INTERNAL_FIRST_ID = 4,
|
||||||
ADC_TEMPSENSOR = 4,
|
ADC_TEMPSENSOR = ADC_CHANNEL_INTERNAL_FIRST_ID,
|
||||||
ADC_VREFINT = 5,
|
ADC_VREFINT,
|
||||||
#if PLATFORM_TRAIT_ADC_INTERNAL_VBAT4
|
#if ADC_INTERNAL_VBAT4_ENABLED
|
||||||
ADC_VBAT4 = 6,
|
ADC_VBAT4,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
ADC_CHANNEL_COUNT
|
ADC_CHANNEL_COUNT
|
||||||
|
@ -73,11 +73,7 @@ typedef struct adcOperatingConfig_s {
|
||||||
#if PLATFORM_TRAIT_ADC_DEVICE
|
#if PLATFORM_TRAIT_ADC_DEVICE
|
||||||
ADCDevice adcDevice; // ADCDEV_x for this input
|
ADCDevice adcDevice; // ADCDEV_x for this input
|
||||||
#endif
|
#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.
|
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
|
uint8_t dmaIndex; // index into DMA buffer in case of sparse channels
|
||||||
bool enabled;
|
bool enabled;
|
||||||
uint8_t sampleTime;
|
uint8_t sampleTime;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
typedef struct adcChannelConfig_t {
|
typedef struct adcChannelConfig_t {
|
||||||
bool enabled;
|
bool enabled;
|
||||||
ioTag_t ioTag;
|
ioTag_t ioTag;
|
||||||
#if defined(STM32H7)
|
#if PLATFORM_TRAIT_ADC_DEVICE
|
||||||
int8_t device; // ADCDevice
|
int8_t device; // ADCDevice
|
||||||
#endif
|
#endif
|
||||||
} adcChannelConfig_t;
|
} adcChannelConfig_t;
|
||||||
|
|
|
@ -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 MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
|
||||||
|
|
||||||
#define PLATFORM_TRAIT_ADC_INTERNAL 1
|
#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_DEVICE 1
|
||||||
#define PLATFORM_TRAIT_ADC_CHANNEL_32BIT 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_USB_MSC
|
#define USE_USB_MSC
|
||||||
|
|
|
@ -468,14 +468,9 @@ extern uint8_t _dmaram_end__;
|
||||||
#define DMA_CHANREQ_STRING "Request"
|
#define DMA_CHANREQ_STRING "Request"
|
||||||
|
|
||||||
#define PLATFORM_TRAIT_ADC_INTERNAL 1
|
#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_DEVICE 1
|
||||||
#define PLATFORM_TRAIT_ADC_CHANNEL_32BIT 1
|
|
||||||
|
|
||||||
#if defined(STM32H7)
|
|
||||||
#define PLATFORM_TRAIT_ADC_DEVICE 1
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
|
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
|
||||||
|
|
|
@ -162,6 +162,5 @@ void adcGetChannelValues(void);
|
||||||
#define TEMPSENSOR_CAL_VREFANALOG (3300U)
|
#define TEMPSENSOR_CAL_VREFANALOG (3300U)
|
||||||
#define TEMPSENSOR_CAL1_TEMP (25U)
|
#define TEMPSENSOR_CAL1_TEMP (25U)
|
||||||
#define TEMPSENSOR_CAL1_V (1.27f)
|
#define TEMPSENSOR_CAL1_V (1.27f)
|
||||||
// mV/C
|
#define TEMPSENSOR_SLOPE (-4.13f /* mV/C */)
|
||||||
#define TEMPSENSOR_SLOPE (-4.13f)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue