refactoring: better placement for some ADC code

This commit is contained in:
rusefi 2019-07-05 20:34:41 -04:00
parent 5b8b25d7f4
commit 867fe9ff36
3 changed files with 10 additions and 12 deletions

View File

@ -9,6 +9,13 @@
#if HAL_USE_ADC
#define ADC_MAX_CHANNELS_COUNT 16
// this structure contains one multi-channel ADC state snapshot
typedef struct {
volatile adcsample_t adc_data[ADC_MAX_CHANNELS_COUNT];
} adc_state;
class AdcDevice {
public:
explicit AdcDevice(ADCConversionGroup* hwConfig);

View File

@ -151,6 +151,8 @@ ADC_TwoSamplingDelay_20Cycles, // cr1
AdcDevice slowAdc(&adcgrpcfgSlow);
void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n);
static ADCConversionGroup adcgrpcfg_fast = { FALSE, 0 /* num_channels */, adc_callback_fast, NULL,
/* HW dependent part.*/
ADC_TwoSamplingDelay_5Cycles, // cr1

View File

@ -3,7 +3,7 @@
* @brief Low level internal ADC code
*
* @date Jan 14, 2013
* @author Andrey Belomutskiy, (c) 2012-2017
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef ADC_INPUTS_H_
@ -16,7 +16,6 @@
const char * getAdcMode(adc_channel_e hwChannel);
void initAdcInputs(bool boardTestMode);
void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n);
// deprecated - migrate to 'getAdcChannelBrainPin'
int getAdcChannelPin(adc_channel_e hwChannel);
@ -44,16 +43,6 @@ void removeChannel(const char *name, adc_channel_e setting);
// max(ADC_BUF_DEPTH_SLOW, ADC_BUF_DEPTH_FAST)
#define MAX_ADC_GRP_BUF_DEPTH 8
#define ADC_MAX_CHANNELS_COUNT 16
//typedef struct
// this structure contains one multi-channel ADC state snapshot
typedef struct {
volatile adcsample_t adc_data[ADC_MAX_CHANNELS_COUNT];
// time_t time;
} adc_state;
#define getAdcValue(msg, hwChannel) getInternalAdcValue(msg, hwChannel)
// todo: migrate to adcToVoltageInputDividerCoefficient