From 09943127827b3efc5eba9d3d0d8f4a1d7c42301c Mon Sep 17 00:00:00 2001 From: bsongis Date: Mon, 11 Mar 2013 16:36:26 +0000 Subject: [PATCH] [X9D] REV3 pots assignation (regression) --- src/x9d/adc_driver.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/x9d/adc_driver.cpp b/src/x9d/adc_driver.cpp index 662cfb08a..fd7a2ad7e 100644 --- a/src/x9d/adc_driver.cpp +++ b/src/x9d/adc_driver.cpp @@ -68,10 +68,20 @@ void adcInit() RCC->APB2ENR |= RCC_APB2ENR_ADC1EN ; // Enable clock RCC->AHB1ENR |= RCC_AHB1Periph_GPIOADC ; // Enable ports A&C clocks RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN ; // Enable DMA2 clock - configure_pins( PIN_STK_J1 | PIN_STK_J2 | PIN_STK_J3 | PIN_STK_J4 | - PIN_FLP_J1, PIN_ANALOG | PIN_PORTA ) ; - configure_pins( PIN_SLD_J1 | PIN_SLD_J2 | PIN_MVOLT, PIN_ANALOG | PIN_PORTC ) ; + +#if defined(REV3) + configure_pins(PIN_STK_J1 | PIN_STK_J2 | PIN_STK_J3 | PIN_STK_J4 | + PIN_FLP_J1 | PIN_FLP_J2, PIN_ANALOG | PIN_PORTA) ; +#else + configure_pins(PIN_STK_J1 | PIN_STK_J2 | PIN_STK_J3 | PIN_STK_J4 | + PIN_FLP_J1, PIN_ANALOG | PIN_PORTA) ; +#endif + +#if !defined(REV3) configure_pins(PIN_FLP_J2, PIN_ANALOG|PIN_PORTB); +#endif + + configure_pins(PIN_SLD_J1 | PIN_SLD_J2 | PIN_MVOLT, PIN_ANALOG | PIN_PORTC) ; ADC1->CR1 = ADC_CR1_SCAN ; ADC1->CR2 = ADC_CR2_ADON | ADC_CR2_DMA | ADC_CR2_DDS ;