rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
trigger_input_adc.h
Go to the documentation of this file.
1/**
2 * @file trigger_input_adc.h
3 * @brief Position sensor hardware layer, Using ADC and software comparator
4 *
5 * @date Jan 27, 2020
6 * @author andreika <prometheus.pcb@gmail.com>
7 * @author Andrey Belomutskiy, (c) 2012-2020
8 */
9
10#pragma once
11#include "global.h"
12#include "trigger_input.h"
13#include "adc_inputs.h"
14
16public:
17 void init();
18 void reset();
19
20 void digitalCallback(efitick_t stamp, bool isPrimary, bool rise);
21 void analogCallback(efitick_t stamp, triggerAdcSample_t value);
22
23 void setWeakSignal(bool isWeak);
24
25public:
29
31
32 float triggerAdcITermCoef = 1600.0f;
33 float triggerAdcITermMin = 3.125e-8f; // corresponds to rpm=25
34
36
39
43
44 // these thresholds allow to switch from ADC mode (low-rpm) to EXTI mode (fast-rpm), indicating the clamping of the signal
49 int prevValue = 0; // not set
50 efitick_t prevStamp = 0;
51
52 // we need to distinguish between weak and strong signals because of different SNR and thresholds.
53 bool isSignalWeak = true;
55
56 // the 'center' of the signal is variable, so we need to adjust the thresholds.
58
59 // this is the number of measurements while we store the counter before we reset to 'isSignalWeak'
61 int integralSum = 0;
63
65};
Low level internal ADC code.
triggerAdcSample_t switchingThresholdHigh
triggerAdcSample_t switchingThresholdLow
triggerAdcSample_t adcMaxThreshold
triggerAdcSample_t adcMinThreshold
void analogCallback(efitick_t stamp, triggerAdcSample_t value)
triggerAdcMode_t curAdcMode
void setWeakSignal(bool isWeak)
efidur_t minDeltaTimeForStableAdcDetectionNt
void digitalCallback(efitick_t stamp, bool isPrimary, bool rise)
triggerAdcSample_t adcDefaultThreshold
efitick_t efidur_t
Position sensor hardware layer.
triggerAdcMode_t
@ TRIGGER_ADC_NONE
adcsample_t triggerAdcSample_t