From 55d693e9a520c682466a70ab50ea782d05c43d31 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Mon, 26 Oct 2020 12:53:45 -0700 Subject: [PATCH] analog works --- firmware/analog_input.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/firmware/analog_input.cpp b/firmware/analog_input.cpp index cb2b2fa..77e1e22 100644 --- a/firmware/analog_input.cpp +++ b/firmware/analog_input.cpp @@ -2,14 +2,18 @@ #include "hal.h" +#define ADC_CHANNEL_COUNT 3 #define ADC_OVERSAMPLE 8 -static adcsample_t adcBuffer[3 * ADC_OVERSAMPLE]; +static adcsample_t adcBuffer[ADC_CHANNEL_COUNT * ADC_OVERSAMPLE]; ADCConversionGroup convGroup = { - false, 3, nullptr, nullptr, - 0, // CFGR1 + false, + ADC_CHANNEL_COUNT, + nullptr, + nullptr, + ADC_CFGR1_CONT | ADC_CFGR1_RES_12BIT, // CFGR1 ADC_TR(0, 0), // TR ADC_SMPR_SMP_28P5, // SMPR ADC_CHSELR_CHSEL0 | ADC_CHSELR_CHSEL1 | ADC_CHSELR_CHSEL2