rusefi-1/firmware/development/wave_analyzer.h

67 lines
1.4 KiB
C
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file wave_analyzer.h
*
*
* @date Jan 7, 2013
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2014-08-29 07:52:33 -07:00
*/
#ifndef WAVE_ANALYZER_H_
#define WAVE_ANALYZER_H_
#include "main.h"
2014-12-23 19:06:10 -08:00
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
2014-08-29 07:52:33 -07:00
#include "datalogging.h"
#include "wave_analyzer_hw.h"
#include "wave_chart.h"
#define WA_CHANNEL_1 "input1"
#define WA_CHANNEL_2 "input2"
2014-08-31 15:02:50 -07:00
#define WA_CHANNEL_3 "input3"
#define WA_CHANNEL_4 "input4"
2014-08-29 07:52:33 -07:00
2014-09-01 06:02:46 -07:00
class WaveReader {
public:
void onFallEvent();
2014-08-29 07:52:33 -07:00
WaveReaderHw hw;
const char *name;
volatile int eventCounter;
2014-09-01 06:02:46 -07:00
int currentRevolutionCounter;
/**
* Total ON time during last engine cycle
*/
uint64_t prevTotalOnTimeUs;
uint64_t totalOnTimeAccumulatorUs;
2014-08-29 07:52:33 -07:00
volatile uint64_t lastActivityTimeUs; // timestamp in microseconds ticks
2014-08-31 17:02:54 -07:00
/**
* time of signal fall event, in microseconds
*/
volatile uint64_t periodEventTimeUs;
2014-08-29 07:52:33 -07:00
volatile uint64_t widthEventTimeUs; // time of signal rise in microseconds
volatile uint32_t signalPeriodUs; // period between two signal rises in microseconds
2014-09-01 17:02:55 -07:00
/**
* offset from engine cycle start in microseconds
*/
volatile uint64_t waveOffsetUs;
2014-08-29 07:52:33 -07:00
volatile uint32_t last_wave_low_widthUs; // time period in systimer ticks
volatile uint64_t last_wave_high_widthUs; // time period in systimer ticks
2014-09-01 06:02:46 -07:00
};
2014-08-29 07:52:33 -07:00
2015-01-14 15:04:00 -08:00
void initWaveAnalyzer(Logging *sharedLogger);
2014-08-29 07:52:33 -07:00
void printWave(Logging *logging);
2014-12-23 19:06:10 -08:00
#endif
2014-08-29 07:52:33 -07:00
#endif /* WAVE_ANALYZER_H_ */
2014-09-01 06:02:46 -07:00