Consistent naming of tag versus pin. Updates based on feedback.
This commit is contained in:
parent
258e9c26b1
commit
c764b0a919
|
@ -33,11 +33,11 @@
|
|||
adc_config_t adcConfig[ADC_CHANNEL_COUNT];
|
||||
volatile uint16_t adcValues[ADC_CHANNEL_COUNT];
|
||||
|
||||
uint8_t adcChannelByPin(ioTag_t pin)
|
||||
uint8_t adcChannelByTag(ioTag_t ioTag)
|
||||
{
|
||||
for (uint8_t i = 0; i < ARRAYLEN(adcPinMap); i++) {
|
||||
if (pin == adcPinMap[i].pin)
|
||||
return adcPinMap[i].channel;
|
||||
for (uint8_t i = 0; i < ARRAYLEN(adcTagMap); i++) {
|
||||
if (ioTag == adcTagMap[i].tag)
|
||||
return adcTagMap[i].channel;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
#include "rcc.h"
|
||||
|
||||
#if defined(STM32F4)
|
||||
#define ADC_PIN_MAP_COUNT 16
|
||||
#define ADC_TAG_MAP_COUNT 16
|
||||
#elif defined(STM32F3)
|
||||
#define ADC_PIN_MAP_COUNT 39
|
||||
#define ADC_TAG_MAP_COUNT 39
|
||||
#else
|
||||
#define ADC_PIN_MAP_COUNT 10
|
||||
#define ADC_TAG_MAP_COUNT 10
|
||||
#endif
|
||||
|
||||
typedef enum ADCDevice {
|
||||
|
@ -43,10 +43,10 @@ typedef enum ADCDevice {
|
|||
#endif
|
||||
} ADCDevice;
|
||||
|
||||
typedef struct adcPinMap_s {
|
||||
ioTag_t pin;
|
||||
typedef struct adcTagMap_s {
|
||||
ioTag_t tag;
|
||||
uint8_t channel;
|
||||
} adcPinMap_t;
|
||||
} adcTagMap_t;
|
||||
|
||||
typedef struct adcDevice_s {
|
||||
ADC_TypeDef* ADCx;
|
||||
|
@ -61,8 +61,8 @@ typedef struct adcDevice_s {
|
|||
} adcDevice_t;
|
||||
|
||||
extern const adcDevice_t adcHardware[];
|
||||
extern const adcPinMap_t adcPinMap[ADC_PIN_MAP_COUNT];
|
||||
extern const adcTagMap_t adcTagMap[ADC_TAG_MAP_COUNT];
|
||||
extern adc_config_t adcConfig[ADC_CHANNEL_COUNT];
|
||||
extern volatile uint16_t adcValues[ADC_CHANNEL_COUNT];
|
||||
|
||||
uint8_t adcChannelByPin(ioTag_t pin);
|
||||
uint8_t adcChannelByTag(ioTag_t ioTag);
|
|
@ -54,17 +54,17 @@ ADCDevice adcDeviceByInstance(ADC_TypeDef *instance)
|
|||
return ADCINVALID;
|
||||
}
|
||||
|
||||
const adcPinMap_t adcPinMap[] = {
|
||||
{ .pin = DEFIO_TAG_E__PA0, .channel = ADC_Channel_0 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PA1, .channel = ADC_Channel_1 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PA2, .channel = ADC_Channel_2 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PA3, .channel = ADC_Channel_3 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PA4, .channel = ADC_Channel_4 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PA5, .channel = ADC_Channel_5 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PA6, .channel = ADC_Channel_6 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PA7, .channel = ADC_Channel_7 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PB0, .channel = ADC_Channel_8 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PB1, .channel = ADC_Channel_9 }, // ADC12
|
||||
const adcTagMap_t adcTagMap[] = {
|
||||
{ DEFIO_TAG_E__PA0, ADC_Channel_0 }, // ADC12
|
||||
{ DEFIO_TAG_E__PA1, ADC_Channel_1 }, // ADC12
|
||||
{ DEFIO_TAG_E__PA2, ADC_Channel_2 }, // ADC12
|
||||
{ DEFIO_TAG_E__PA3, ADC_Channel_3 }, // ADC12
|
||||
{ DEFIO_TAG_E__PA4, ADC_Channel_4 }, // ADC12
|
||||
{ DEFIO_TAG_E__PA5, ADC_Channel_5 }, // ADC12
|
||||
{ DEFIO_TAG_E__PA6, ADC_Channel_6 }, // ADC12
|
||||
{ DEFIO_TAG_E__PA7, ADC_Channel_7 }, // ADC12
|
||||
{ DEFIO_TAG_E__PB0, ADC_Channel_8 }, // ADC12
|
||||
{ DEFIO_TAG_E__PB1, ADC_Channel_9 }, // ADC12
|
||||
};
|
||||
|
||||
// Driver for STM32F103CB onboard ADC
|
||||
|
@ -93,7 +93,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
if (init->enableVBat) {
|
||||
IOInit(IOGetByTag(IO_TAG(VBAT_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(VBAT_ADC_PIN)), IO_CONFIG(GPIO_Mode_AIN, 0));
|
||||
adcConfig[ADC_BATTERY].adcChannel = adcChannelByPin(IO_TAG(VBAT_ADC_PIN));
|
||||
adcConfig[ADC_BATTERY].adcChannel = adcChannelByTag(IO_TAG(VBAT_ADC_PIN));
|
||||
adcConfig[ADC_BATTERY].dmaIndex = configuredAdcChannels++;
|
||||
adcConfig[ADC_BATTERY].enabled = true;
|
||||
adcConfig[ADC_BATTERY].sampleTime = ADC_SampleTime_239Cycles5;
|
||||
|
@ -104,7 +104,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
if (init->enableRSSI) {
|
||||
IOInit(IOGetByTag(IO_TAG(RSSI_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(RSSI_ADC_PIN)), IO_CONFIG(GPIO_Mode_AIN, 0));
|
||||
adcConfig[ADC_RSSI].adcChannel = adcChannelByPin(IO_TAG(RSSI_ADC_PIN));
|
||||
adcConfig[ADC_RSSI].adcChannel = adcChannelByTag(IO_TAG(RSSI_ADC_PIN));
|
||||
adcConfig[ADC_RSSI].dmaIndex = configuredAdcChannels++;
|
||||
adcConfig[ADC_RSSI].enabled = true;
|
||||
adcConfig[ADC_RSSI].sampleTime = ADC_SampleTime_239Cycles5;
|
||||
|
@ -115,7 +115,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
if (init->enableExternal1) {
|
||||
IOInit(IOGetByTag(IO_TAG(EXTERNAL1_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(EXTERNAL1_ADC_PIN)), IO_CONFIG(GPIO_Mode_AIN, 0));
|
||||
adcConfig[ADC_EXTERNAL1].adcChannel = adcChannelByPin(IO_TAG(EXTERNAL1_ADC_PIN));
|
||||
adcConfig[ADC_EXTERNAL1].adcChannel = adcChannelByTag(IO_TAG(EXTERNAL1_ADC_PIN));
|
||||
adcConfig[ADC_EXTERNAL1].dmaIndex = configuredAdcChannels++;
|
||||
adcConfig[ADC_EXTERNAL1].enabled = true;
|
||||
adcConfig[ADC_EXTERNAL1].sampleTime = ADC_SampleTime_239Cycles5;
|
||||
|
@ -126,7 +126,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
if (init->enableCurrentMeter) {
|
||||
IOInit(IOGetByTag(IO_TAG(CURRENT_METER_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(CURRENT_METER_ADC_PIN)), IO_CONFIG(GPIO_Mode_AIN, 0));
|
||||
adcConfig[ADC_CURRENT].adcChannel = adcChannelByPin(IO_TAG(CURRENT_METER_ADC_PIN));
|
||||
adcConfig[ADC_CURRENT].adcChannel = adcChannelByTag(IO_TAG(CURRENT_METER_ADC_PIN));
|
||||
adcConfig[ADC_CURRENT].dmaIndex = configuredAdcChannels++;
|
||||
adcConfig[ADC_CURRENT].enabled = true;
|
||||
adcConfig[ADC_CURRENT].sampleTime = ADC_SampleTime_239Cycles5;
|
||||
|
|
|
@ -41,46 +41,46 @@ const adcDevice_t adcHardware[] = {
|
|||
{ .ADCx = ADC2, .rccADC = RCC_AHB(ADC12), .rccDMA = RCC_AHB(DMA2), .DMAy_Channelx = DMA2_Channel1 }
|
||||
};
|
||||
|
||||
const adcPinMap_t adcPinMap[] = {
|
||||
{ .pin = DEFIO_TAG_E__PA0, .channel = ADC_Channel_1 }, // ADC1
|
||||
{ .pin = DEFIO_TAG_E__PA1, .channel = ADC_Channel_2 }, // ADC1
|
||||
{ .pin = DEFIO_TAG_E__PA2, .channel = ADC_Channel_3 }, // ADC1
|
||||
{ .pin = DEFIO_TAG_E__PA3, .channel = ADC_Channel_4 }, // ADC1
|
||||
{ .pin = DEFIO_TAG_E__PA4, .channel = ADC_Channel_1 }, // ADC2
|
||||
{ .pin = DEFIO_TAG_E__PA5, .channel = ADC_Channel_2 }, // ADC2
|
||||
{ .pin = DEFIO_TAG_E__PA6, .channel = ADC_Channel_3 }, // ADC2
|
||||
{ .pin = DEFIO_TAG_E__PA7, .channel = ADC_Channel_4 }, // ADC2
|
||||
{ .pin = DEFIO_TAG_E__PB0, .channel = ADC_Channel_12 }, // ADC3
|
||||
{ .pin = DEFIO_TAG_E__PB1, .channel = ADC_Channel_1 }, // ADC3
|
||||
{ .pin = DEFIO_TAG_E__PB2, .channel = ADC_Channel_12 }, // ADC2
|
||||
{ .pin = DEFIO_TAG_E__PB12, .channel = ADC_Channel_3 }, // ADC4
|
||||
{ .pin = DEFIO_TAG_E__PB13, .channel = ADC_Channel_5 }, // ADC3
|
||||
{ .pin = DEFIO_TAG_E__PB14, .channel = ADC_Channel_4 }, // ADC4
|
||||
{ .pin = DEFIO_TAG_E__PB15, .channel = ADC_Channel_5 }, // ADC4
|
||||
{ .pin = DEFIO_TAG_E__PC0, .channel = ADC_Channel_6 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PC1, .channel = ADC_Channel_7 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PC2, .channel = ADC_Channel_8 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PC3, .channel = ADC_Channel_9 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PC4, .channel = ADC_Channel_5 }, // ADC2
|
||||
{ .pin = DEFIO_TAG_E__PC5, .channel = ADC_Channel_11 }, // ADC2
|
||||
{ .pin = DEFIO_TAG_E__PD8, .channel = ADC_Channel_12 }, // ADC4
|
||||
{ .pin = DEFIO_TAG_E__PD9, .channel = ADC_Channel_13 }, // ADC4
|
||||
{ .pin = DEFIO_TAG_E__PD10, .channel = ADC_Channel_7 }, // ADC34
|
||||
{ .pin = DEFIO_TAG_E__PD11, .channel = ADC_Channel_8 }, // ADC34
|
||||
{ .pin = DEFIO_TAG_E__PD12, .channel = ADC_Channel_9 }, // ADC34
|
||||
{ .pin = DEFIO_TAG_E__PD13, .channel = ADC_Channel_10 }, // ADC34
|
||||
{ .pin = DEFIO_TAG_E__PD14, .channel = ADC_Channel_11 }, // ADC34
|
||||
{ .pin = DEFIO_TAG_E__PE7, .channel = ADC_Channel_13 }, // ADC3
|
||||
{ .pin = DEFIO_TAG_E__PE8, .channel = ADC_Channel_6 }, // ADC34
|
||||
{ .pin = DEFIO_TAG_E__PE9, .channel = ADC_Channel_2 }, // ADC3
|
||||
{ .pin = DEFIO_TAG_E__PE10, .channel = ADC_Channel_14 }, // ADC3
|
||||
{ .pin = DEFIO_TAG_E__PE11, .channel = ADC_Channel_15 }, // ADC3
|
||||
{ .pin = DEFIO_TAG_E__PE12, .channel = ADC_Channel_16 }, // ADC3
|
||||
{ .pin = DEFIO_TAG_E__PE13, .channel = ADC_Channel_3 }, // ADC3
|
||||
{ .pin = DEFIO_TAG_E__PE14, .channel = ADC_Channel_1 }, // ADC4
|
||||
{ .pin = DEFIO_TAG_E__PE15, .channel = ADC_Channel_2 }, // ADC4
|
||||
{ .pin = DEFIO_TAG_E__PF2, .channel = ADC_Channel_10 }, // ADC12
|
||||
{ .pin = DEFIO_TAG_E__PF4, .channel = ADC_Channel_5 }, // ADC1
|
||||
const adcTagMap_t adcTagMap[] = {
|
||||
{ DEFIO_TAG_E__PA0, ADC_Channel_1 }, // ADC1
|
||||
{ DEFIO_TAG_E__PA1, ADC_Channel_2 }, // ADC1
|
||||
{ DEFIO_TAG_E__PA2, ADC_Channel_3 }, // ADC1
|
||||
{ DEFIO_TAG_E__PA3, ADC_Channel_4 }, // ADC1
|
||||
{ DEFIO_TAG_E__PA4, ADC_Channel_1 }, // ADC2
|
||||
{ DEFIO_TAG_E__PA5, ADC_Channel_2 }, // ADC2
|
||||
{ DEFIO_TAG_E__PA6, ADC_Channel_3 }, // ADC2
|
||||
{ DEFIO_TAG_E__PA7, ADC_Channel_4 }, // ADC2
|
||||
{ DEFIO_TAG_E__PB0, ADC_Channel_12 }, // ADC3
|
||||
{ DEFIO_TAG_E__PB1, ADC_Channel_1 }, // ADC3
|
||||
{ DEFIO_TAG_E__PB2, ADC_Channel_12 }, // ADC2
|
||||
{ DEFIO_TAG_E__PB12, ADC_Channel_3 }, // ADC4
|
||||
{ DEFIO_TAG_E__PB13, ADC_Channel_5 }, // ADC3
|
||||
{ DEFIO_TAG_E__PB14, ADC_Channel_4 }, // ADC4
|
||||
{ DEFIO_TAG_E__PB15, ADC_Channel_5 }, // ADC4
|
||||
{ DEFIO_TAG_E__PC0, ADC_Channel_6 }, // ADC12
|
||||
{ DEFIO_TAG_E__PC1, ADC_Channel_7 }, // ADC12
|
||||
{ DEFIO_TAG_E__PC2, ADC_Channel_8 }, // ADC12
|
||||
{ DEFIO_TAG_E__PC3, ADC_Channel_9 }, // ADC12
|
||||
{ DEFIO_TAG_E__PC4, ADC_Channel_5 }, // ADC2
|
||||
{ DEFIO_TAG_E__PC5, ADC_Channel_11 }, // ADC2
|
||||
{ DEFIO_TAG_E__PD8, ADC_Channel_12 }, // ADC4
|
||||
{ DEFIO_TAG_E__PD9, ADC_Channel_13 }, // ADC4
|
||||
{ DEFIO_TAG_E__PD10, ADC_Channel_7 }, // ADC34
|
||||
{ DEFIO_TAG_E__PD11, ADC_Channel_8 }, // ADC34
|
||||
{ DEFIO_TAG_E__PD12, ADC_Channel_9 }, // ADC34
|
||||
{ DEFIO_TAG_E__PD13, ADC_Channel_10 }, // ADC34
|
||||
{ DEFIO_TAG_E__PD14, ADC_Channel_11 }, // ADC34
|
||||
{ DEFIO_TAG_E__PE7, ADC_Channel_13 }, // ADC3
|
||||
{ DEFIO_TAG_E__PE8, ADC_Channel_6 }, // ADC34
|
||||
{ DEFIO_TAG_E__PE9, ADC_Channel_2 }, // ADC3
|
||||
{ DEFIO_TAG_E__PE10, ADC_Channel_14 }, // ADC3
|
||||
{ DEFIO_TAG_E__PE11, ADC_Channel_15 }, // ADC3
|
||||
{ DEFIO_TAG_E__PE12, ADC_Channel_16 }, // ADC3
|
||||
{ DEFIO_TAG_E__PE13, ADC_Channel_3 }, // ADC3
|
||||
{ DEFIO_TAG_E__PE14, ADC_Channel_1 }, // ADC4
|
||||
{ DEFIO_TAG_E__PE15, ADC_Channel_2 }, // ADC4
|
||||
{ DEFIO_TAG_E__PF2, ADC_Channel_10 }, // ADC12
|
||||
{ DEFIO_TAG_E__PF4, ADC_Channel_5 }, // ADC1
|
||||
};
|
||||
|
||||
ADCDevice adcDeviceByInstance(ADC_TypeDef *instance)
|
||||
|
@ -110,7 +110,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
IOInit(IOGetByTag(IO_TAG(VBAT_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(VBAT_ADC_PIN)), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
|
||||
|
||||
adcConfig[ADC_BATTERY].adcChannel = adcChannelByPin(IO_TAG(VBAT_ADC_PIN));
|
||||
adcConfig[ADC_BATTERY].adcChannel = adcChannelByTag(IO_TAG(VBAT_ADC_PIN));
|
||||
adcConfig[ADC_BATTERY].dmaIndex = adcChannelCount;
|
||||
adcConfig[ADC_BATTERY].sampleTime = ADC_SampleTime_601Cycles5;
|
||||
adcConfig[ADC_BATTERY].enabled = true;
|
||||
|
@ -123,7 +123,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
IOInit(IOGetByTag(IO_TAG(RSSI_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(RSSI_ADC_PIN)), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
|
||||
|
||||
adcConfig[ADC_RSSI].adcChannel = adcChannelByPin(IO_TAG(RSSI_ADC_PIN));
|
||||
adcConfig[ADC_RSSI].adcChannel = adcChannelByTag(IO_TAG(RSSI_ADC_PIN));
|
||||
adcConfig[ADC_RSSI].dmaIndex = adcChannelCount;
|
||||
adcConfig[ADC_RSSI].sampleTime = ADC_SampleTime_601Cycles5;
|
||||
adcConfig[ADC_RSSI].enabled = true;
|
||||
|
@ -136,7 +136,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
IOInit(IOGetByTag(IO_TAG(CURRENT_METER_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(CURRENT_METER_ADC_PIN)), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
|
||||
|
||||
adcConfig[ADC_CURRENT].adcChannel = adcChannelByPin(IO_TAG(CURRENT_METER_ADC_PIN));
|
||||
adcConfig[ADC_CURRENT].adcChannel = adcChannelByTag(IO_TAG(CURRENT_METER_ADC_PIN));
|
||||
adcConfig[ADC_CURRENT].dmaIndex = adcChannelCount;
|
||||
adcConfig[ADC_CURRENT].sampleTime = ADC_SampleTime_601Cycles5;
|
||||
adcConfig[ADC_CURRENT].enabled = true;
|
||||
|
@ -149,7 +149,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
IOInit(IOGetByTag(IO_TAG(EXTERNAL1_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(EXTERNAL1_ADC_PIN)), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
|
||||
|
||||
adcConfig[ADC_EXTERNAL1].adcChannel = adcChannelByPin(IO_TAG(EXTERNAL1_ADC_PIN));
|
||||
adcConfig[ADC_EXTERNAL1].adcChannel = adcChannelByTag(IO_TAG(EXTERNAL1_ADC_PIN));
|
||||
adcConfig[ADC_EXTERNAL1].dmaIndex = adcChannelCount;
|
||||
adcConfig[ADC_EXTERNAL1].sampleTime = ADC_SampleTime_601Cycles5;
|
||||
adcConfig[ADC_EXTERNAL1].enabled = true;
|
||||
|
|
|
@ -44,33 +44,33 @@ const adcDevice_t adcHardware[] = {
|
|||
};
|
||||
|
||||
/* note these could be packed up for saving space */
|
||||
const adcPinMap_t adcPinMap[] = {
|
||||
const adcTagMap_t adcTagMap[] = {
|
||||
/*
|
||||
{ .pin = DEFIO_TAG_E__PF3, .channel = ADC_Channel_9 },
|
||||
{ .pin = DEFIO_TAG_E__PF4, .channel = ADC_Channel_14 },
|
||||
{ .pin = DEFIO_TAG_E__PF5, .channel = ADC_Channel_15 },
|
||||
{ .pin = DEFIO_TAG_E__PF6, .channel = ADC_Channel_4 },
|
||||
{ .pin = DEFIO_TAG_E__PF7, .channel = ADC_Channel_5 },
|
||||
{ .pin = DEFIO_TAG_E__PF8, .channel = ADC_Channel_6 },
|
||||
{ .pin = DEFIO_TAG_E__PF9, .channel = ADC_Channel_7 },
|
||||
{ .pin = DEFIO_TAG_E__PF10, .channel = ADC_Channel_8 },
|
||||
{ DEFIO_TAG_E__PF3, ADC_Channel_9 },
|
||||
{ DEFIO_TAG_E__PF4, ADC_Channel_14 },
|
||||
{ DEFIO_TAG_E__PF5, ADC_Channel_15 },
|
||||
{ DEFIO_TAG_E__PF6, ADC_Channel_4 },
|
||||
{ DEFIO_TAG_E__PF7, ADC_Channel_5 },
|
||||
{ DEFIO_TAG_E__PF8, ADC_Channel_6 },
|
||||
{ DEFIO_TAG_E__PF9, ADC_Channel_7 },
|
||||
{ DEFIO_TAG_E__PF10, ADC_Channel_8 },
|
||||
*/
|
||||
{ .pin = DEFIO_TAG_E__PC0, .channel = ADC_Channel_10 },
|
||||
{ .pin = DEFIO_TAG_E__PC1, .channel = ADC_Channel_11 },
|
||||
{ .pin = DEFIO_TAG_E__PC2, .channel = ADC_Channel_12 },
|
||||
{ .pin = DEFIO_TAG_E__PC3, .channel = ADC_Channel_13 },
|
||||
{ .pin = DEFIO_TAG_E__PC4, .channel = ADC_Channel_14 },
|
||||
{ .pin = DEFIO_TAG_E__PC5, .channel = ADC_Channel_15 },
|
||||
{ .pin = DEFIO_TAG_E__PB0, .channel = ADC_Channel_8 },
|
||||
{ .pin = DEFIO_TAG_E__PB1, .channel = ADC_Channel_9 },
|
||||
{ .pin = DEFIO_TAG_E__PA0, .channel = ADC_Channel_0 },
|
||||
{ .pin = DEFIO_TAG_E__PA1, .channel = ADC_Channel_1 },
|
||||
{ .pin = DEFIO_TAG_E__PA2, .channel = ADC_Channel_2 },
|
||||
{ .pin = DEFIO_TAG_E__PA3, .channel = ADC_Channel_3 },
|
||||
{ .pin = DEFIO_TAG_E__PA4, .channel = ADC_Channel_4 },
|
||||
{ .pin = DEFIO_TAG_E__PA5, .channel = ADC_Channel_5 },
|
||||
{ .pin = DEFIO_TAG_E__PA6, .channel = ADC_Channel_6 },
|
||||
{ .pin = DEFIO_TAG_E__PA7, .channel = ADC_Channel_7 },
|
||||
{ DEFIO_TAG_E__PC0, ADC_Channel_10 },
|
||||
{ DEFIO_TAG_E__PC1, ADC_Channel_11 },
|
||||
{ DEFIO_TAG_E__PC2, ADC_Channel_12 },
|
||||
{ DEFIO_TAG_E__PC3, ADC_Channel_13 },
|
||||
{ DEFIO_TAG_E__PC4, ADC_Channel_14 },
|
||||
{ DEFIO_TAG_E__PC5, ADC_Channel_15 },
|
||||
{ DEFIO_TAG_E__PB0, ADC_Channel_8 },
|
||||
{ DEFIO_TAG_E__PB1, ADC_Channel_9 },
|
||||
{ DEFIO_TAG_E__PA0, ADC_Channel_0 },
|
||||
{ DEFIO_TAG_E__PA1, ADC_Channel_1 },
|
||||
{ DEFIO_TAG_E__PA2, ADC_Channel_2 },
|
||||
{ DEFIO_TAG_E__PA3, ADC_Channel_3 },
|
||||
{ DEFIO_TAG_E__PA4, ADC_Channel_4 },
|
||||
{ DEFIO_TAG_E__PA5, ADC_Channel_5 },
|
||||
{ DEFIO_TAG_E__PA6, ADC_Channel_6 },
|
||||
{ DEFIO_TAG_E__PA7, ADC_Channel_7 },
|
||||
};
|
||||
|
||||
ADCDevice adcDeviceByInstance(ADC_TypeDef *instance)
|
||||
|
@ -102,7 +102,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
if (init->enableVBat) {
|
||||
IOInit(IOGetByTag(IO_TAG(VBAT_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(VBAT_ADC_PIN)), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
|
||||
adcConfig[ADC_BATTERY].adcChannel = adcChannelByPin(IO_TAG(VBAT_ADC_PIN)); //VBAT_ADC_CHANNEL;
|
||||
adcConfig[ADC_BATTERY].adcChannel = adcChannelByTag(IO_TAG(VBAT_ADC_PIN)); //VBAT_ADC_CHANNEL;
|
||||
adcConfig[ADC_BATTERY].dmaIndex = configuredAdcChannels++;
|
||||
adcConfig[ADC_BATTERY].enabled = true;
|
||||
adcConfig[ADC_BATTERY].sampleTime = ADC_SampleTime_480Cycles;
|
||||
|
@ -113,7 +113,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
if (init->enableExternal1) {
|
||||
IOInit(IOGetByTag(IO_TAG(EXTERNAL1_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(EXTERNAL1_ADC_PIN)), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
|
||||
adcConfig[ADC_EXTERNAL1].adcChannel = adcChannelByPin(IO_TAG(EXTERNAL1_ADC_PIN)); //EXTERNAL1_ADC_CHANNEL;
|
||||
adcConfig[ADC_EXTERNAL1].adcChannel = adcChannelByTag(IO_TAG(EXTERNAL1_ADC_PIN)); //EXTERNAL1_ADC_CHANNEL;
|
||||
adcConfig[ADC_EXTERNAL1].dmaIndex = configuredAdcChannels++;
|
||||
adcConfig[ADC_EXTERNAL1].enabled = true;
|
||||
adcConfig[ADC_EXTERNAL1].sampleTime = ADC_SampleTime_480Cycles;
|
||||
|
@ -124,7 +124,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
if (init->enableRSSI) {
|
||||
IOInit(IOGetByTag(IO_TAG(RSSI_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(RSSI_ADC_PIN)), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
|
||||
adcConfig[ADC_RSSI].adcChannel = adcChannelByPin(IO_TAG(RSSI_ADC_PIN)); //RSSI_ADC_CHANNEL;
|
||||
adcConfig[ADC_RSSI].adcChannel = adcChannelByTag(IO_TAG(RSSI_ADC_PIN)); //RSSI_ADC_CHANNEL;
|
||||
adcConfig[ADC_RSSI].dmaIndex = configuredAdcChannels++;
|
||||
adcConfig[ADC_RSSI].enabled = true;
|
||||
adcConfig[ADC_RSSI].sampleTime = ADC_SampleTime_480Cycles;
|
||||
|
@ -135,7 +135,7 @@ void adcInit(drv_adc_config_t *init)
|
|||
if (init->enableCurrentMeter) {
|
||||
IOInit(IOGetByTag(IO_TAG(CURRENT_METER_ADC_PIN)), OWNER_SYSTEM, RESOURCE_ADC);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(CURRENT_METER_ADC_PIN)), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
|
||||
adcConfig[ADC_CURRENT].adcChannel = adcChannelByPin(IO_TAG(CURRENT_METER_ADC_PIN)); //CURRENT_METER_ADC_CHANNEL;
|
||||
adcConfig[ADC_CURRENT].adcChannel = adcChannelByTag(IO_TAG(CURRENT_METER_ADC_PIN)); //CURRENT_METER_ADC_CHANNEL;
|
||||
adcConfig[ADC_CURRENT].dmaIndex = configuredAdcChannels++;
|
||||
adcConfig[ADC_CURRENT].enabled = true;
|
||||
adcConfig[ADC_CURRENT].sampleTime = ADC_SampleTime_480Cycles;
|
||||
|
|
Loading…
Reference in New Issue