mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 17:25:18 +03:00
h7: add adc implementation
This commit is contained in:
parent
4712352889
commit
d42fb4314e
5 changed files with 262 additions and 21 deletions
|
@ -22,19 +22,27 @@
|
|||
|
||||
#if defined(STM32F4) || defined(STM32F7)
|
||||
#define ADC_TAG_MAP_COUNT 16
|
||||
#elif defined(STM32H7)
|
||||
#define ADC_TAG_MAP_COUNT 28
|
||||
#elif defined(STM32F3)
|
||||
#define ADC_TAG_MAP_COUNT 39
|
||||
#else
|
||||
#define ADC_TAG_MAP_COUNT 10
|
||||
#endif
|
||||
|
||||
#if defined(STM32H7)
|
||||
#define ADC_VALUES_ALIGNMENT(def) def __attribute__ ((aligned (32)))
|
||||
#else
|
||||
#define ADC_VALUES_ALIGNMENT(def) def
|
||||
#endif
|
||||
|
||||
typedef enum ADCDevice {
|
||||
ADCINVALID = -1,
|
||||
ADCDEV_1 = 0,
|
||||
#if defined(STM32F3)
|
||||
ADCDEV_2,
|
||||
ADCDEV_MAX = ADCDEV_2,
|
||||
#elif defined(STM32F4) || defined(STM32F7)
|
||||
#elif defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
|
||||
ADCDEV_2,
|
||||
ADCDEV_3,
|
||||
ADCDEV_MAX = ADCDEV_3,
|
||||
|
@ -53,13 +61,13 @@ typedef struct adcDevice_s {
|
|||
ADC_TypeDef* ADCx;
|
||||
rccPeriphTag_t rccADC;
|
||||
rccPeriphTag_t rccDMA;
|
||||
#if defined(STM32F4) || defined(STM32F7)
|
||||
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
|
||||
DMA_Stream_TypeDef* DMAy_Streamx;
|
||||
uint32_t channel;
|
||||
#else
|
||||
DMA_Channel_TypeDef* DMAy_Channelx;
|
||||
#endif
|
||||
#if defined(STM32F7)
|
||||
#if defined(STM32F7) || defined(STM32H7)
|
||||
ADC_HandleTypeDef ADCHandle;
|
||||
DMA_HandleTypeDef DmaHandle;
|
||||
#endif
|
||||
|
@ -78,7 +86,7 @@ typedef struct adc_config_s {
|
|||
|
||||
extern const adcTagMap_t adcTagMap[ADC_TAG_MAP_COUNT];
|
||||
extern adc_config_t adcConfig[ADC_CHN_COUNT];
|
||||
extern volatile uint16_t adcValues[ADCDEV_COUNT][ADC_CHN_COUNT * ADC_AVERAGE_N_SAMPLES];
|
||||
extern volatile ADC_VALUES_ALIGNMENT(uint16_t adcValues[ADCDEV_COUNT][ADC_CHN_COUNT * ADC_AVERAGE_N_SAMPLES]);
|
||||
|
||||
void adcHardwareInit(drv_adc_config_t *init);
|
||||
ADCDevice adcDeviceByInstance(ADC_TypeDef *instance);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue