rusefi-1/firmware/emulation/wave_analyzer.h

62 lines
1.3 KiB
C
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file wave_analyzer.h
*
*
* @date Jan 7, 2013
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#ifndef WAVE_ANALYZER_H_
#define WAVE_ANALYZER_H_
#include "main.h"
#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
void initWaveAnalyzer(void);
void printWave(Logging *logging);
#endif /* WAVE_ANALYZER_H_ */
2014-09-01 06:02:46 -07:00