diff --git a/flight/targets/boards/revonano/firmware/pios_board.c b/flight/targets/boards/revonano/firmware/pios_board.c index 367175dd9..c4050a59a 100644 --- a/flight/targets/boards/revonano/firmware/pios_board.c +++ b/flight/targets/boards/revonano/firmware/pios_board.c @@ -729,8 +729,17 @@ void PIOS_Board_Init(void) if (ws2811_pin_settings != HWSETTINGS_WS2811LED_OUT_DISABLED && ws2811_pin_settings < NELEMENTS(pios_ws2811_pin_cfg)) { PIOS_WS2811_Init(&pios_ws2811_cfg, &pios_ws2811_pin_cfg[ws2811_pin_settings]); } - #endif // PIOS_INCLUDE_WS2811 + +#ifdef PIOS_INCLUDE_ADC + uint8_t adc_config[HWSETTINGS_ADCROUTING_NUMELEM]; + HwSettingsADCRoutingArrayGet(adc_config); + for(uint32_t i = 0; i < HWSETTINGS_ADCROUTING_NUMELEM; i++){ + if(adc_config[i] != HWSETTINGS_ADCROUTING_DISABLED){ + PIOS_ADC_PinSetup(i); + } + } +#endif } /** diff --git a/flight/targets/boards/revonano/pios_board.h b/flight/targets/boards/revonano/pios_board.h index 616d24883..9b7dc64c8 100644 --- a/flight/targets/boards/revonano/pios_board.h +++ b/flight/targets/boards/revonano/pios_board.h @@ -282,23 +282,30 @@ extern uint32_t pios_packet_handler; // PIOS_ADC_PinGet(4) = VREF // PIOS_ADC_PinGet(5) = Temperature sensor // ------------------------- -#define PIOS_DMA_PIN_CONFIG \ - { \ - { GPIOC, GPIO_Pin_1, ADC_Channel_11 }, \ - { GPIOC, GPIO_Pin_2, ADC_Channel_12 }, \ - { NULL, 0, ADC_Channel_Vrefint }, /* Voltage reference */ \ - { NULL, 0, ADC_Channel_TempSensor }, /* Temperature sensor */ \ +#define PIOS_DMA_PIN_CONFIG \ + { \ + { GPIOB, GPIO_Pin_1, ADC_Channel_9, false},/* FLEXI-IO PIN 4 */ \ + { GPIOB, GPIO_Pin_0, ADC_Channel_8, false},/* FLEXI-IO PIN 5 */ \ + { GPIOA, GPIO_Pin_7, ADC_Channel_7, false},/* FLEXI-IO PIN 6 */ \ + { GPIOA, GPIO_Pin_6, ADC_Channel_6, false},/* FLEXI-IO PIN 7 */ \ + { GPIOA, GPIO_Pin_5, ADC_Channel_5, false},/* FLEXI-IO PIN 8 */ \ + \ + { GPIOA, GPIO_Pin_0, ADC_Channel_0, false},/* SERVO PIN 5 */ \ + { GPIOA, GPIO_Pin_1, ADC_Channel_1, false},/* SERVO PIN 6 */ \ + \ + { NULL, 0, ADC_Channel_Vrefint, false}, /* Voltage reference */ \ + { NULL, 0, ADC_Channel_TempSensor, false}, /* Temperature sensor */ \ } /* we have to do all this to satisfy the PIOS_ADC_MAX_SAMPLES define in pios_adc.h */ /* which is annoying because this then determines the rate at which we generate buffer turnover events */ /* the objective here is to get enough buffer space to support 100Hz averaging rate */ -#define PIOS_ADC_NUM_CHANNELS 4 +#define PIOS_ADC_NUM_CHANNELS 9 #define PIOS_ADC_MAX_OVERSAMPLING 2 #define PIOS_ADC_USE_ADC2 0 #define PIOS_ADC_USE_TEMP_SENSOR -#define PIOS_ADC_TEMPERATURE_PIN 3 +#define PIOS_ADC_TEMPERATURE_PIN 8 // ------------------------- // USB