Fix additional DMA conflict with DMA2.

This commit is contained in:
DTF UHF 2016-11-09 13:25:29 -05:00
parent c7ea30d425
commit 760a2b2e67
2 changed files with 8 additions and 0 deletions

View File

@ -40,7 +40,11 @@
const adcDevice_t adcHardware[] = {
{ .ADCx = ADC1, .rccADC = RCC_AHB(ADC12), .DMAy_Channelx = DMA1_Channel1 },
#ifdef ADC24_DMA_REMAP
{ .ADCx = ADC2, .rccADC = RCC_AHB(ADC12), .DMAy_Channelx = DMA2_Channel3 }
#else
{ .ADCx = ADC2, .rccADC = RCC_AHB(ADC12), .DMAy_Channelx = DMA2_Channel1 }
#endif
};
const adcTagMap_t adcTagMap[] = {
@ -134,6 +138,9 @@ void adcInit(drv_adc_config_t *init)
if (device == ADCINVALID)
return;
#ifdef ADC24_DMA_REMAP
SYSCFG_DMAChannelRemapConfig(SYSCFG_DMARemap_ADC2ADC4, ENABLE);
#endif
adcDevice_t adc = adcHardware[device];
for (int i = 0; i < ADC_CHANNEL_COUNT; i++) {

View File

@ -113,6 +113,7 @@
#define BOARD_HAS_VOLTAGE_DIVIDER
#define USE_ADC
#define ADC_INSTANCE ADC2
#define ADC24_DMA_REMAP // moves ADC2 DMA from DMA2ch1 to DMA2ch3.
#define VBAT_ADC_PIN PA4
#define CURRENT_METER_ADC_PIN PA5