2015-07-10 06:01:56 -07:00
|
|
|
/**
|
2019-12-03 22:11:10 -08:00
|
|
|
* @file logic_analyzer.h
|
2015-07-10 06:01:56 -07:00
|
|
|
*
|
|
|
|
* @date Jan 7, 2013
|
2019-12-03 21:22:34 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2019
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2019-12-03 21:22:34 -08:00
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2018-09-16 19:26:57 -07:00
|
|
|
#include "global.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-12-03 22:11:10 -08:00
|
|
|
#if EFI_LOGIC_ANALYZER
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-11-11 20:32:09 -08:00
|
|
|
#include "digital_input_icu.h"
|
2015-07-15 18:01:45 -07:00
|
|
|
#include "engine_sniffer.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
class WaveReader {
|
|
|
|
public:
|
|
|
|
WaveReader();
|
|
|
|
void onFallEvent();
|
|
|
|
|
|
|
|
digital_input_s *hw;
|
2019-11-03 19:02:52 -08:00
|
|
|
const char *name = nullptr;
|
|
|
|
volatile int fallEventCounter = 0;
|
|
|
|
volatile int riseEventCounter = 0;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-11-03 19:02:52 -08:00
|
|
|
int currentRevolutionCounter = 0;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Total ON time during last engine cycle
|
|
|
|
*/
|
2019-11-03 19:02:52 -08:00
|
|
|
efitimeus_t prevTotalOnTimeUs = 0;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-11-03 19:02:52 -08:00
|
|
|
efitimeus_t totalOnTimeAccumulatorUs = 0;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-11-03 19:02:52 -08:00
|
|
|
volatile efitimeus_t lastActivityTimeUs = 0; // timestamp in microseconds ticks
|
2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* time of signal fall event, in microseconds
|
|
|
|
*/
|
2019-11-03 19:02:52 -08:00
|
|
|
volatile efitimeus_t periodEventTimeUs = 0;
|
|
|
|
volatile efitimeus_t widthEventTimeUs = 0; // time of signal rise in microseconds
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-11-03 19:02:52 -08:00
|
|
|
volatile efitimeus_t signalPeriodUs = 0; // period between two signal rises in microseconds
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* offset from engine cycle start in microseconds
|
|
|
|
*/
|
2019-11-03 19:02:52 -08:00
|
|
|
volatile efitimeus_t waveOffsetUs = 0;
|
|
|
|
volatile efitimeus_t last_wave_low_widthUs = 0; // time period in systimer ticks
|
|
|
|
volatile efitimeus_t last_wave_high_widthUs = 0; // time period in systimer ticks
|
2015-07-10 06:01:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
void initWaveAnalyzer(Logging *sharedLogger);
|
|
|
|
void printWave(Logging *logging);
|
2017-01-12 06:02:19 -08:00
|
|
|
void showWaveInfo(void);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-12-03 22:11:10 -08:00
|
|
|
#endif /* EFI_LOGIC_ANALYZER */
|
2015-07-10 06:01:56 -07:00
|
|
|
|