rusefi/firmware/controllers/trigger/trigger_simulator.h

41 lines
1023 B
C
Raw Normal View History

2015-09-23 18:02:33 -07:00
/*
* @file trigger_simulator.h
* @brief This class knows how to produce synthetic shaft signals based on triggerShape
*
* @date Sep 23, 2015
2020-01-07 21:02:40 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2015-09-23 18:02:33 -07:00
*/
#pragma once
2015-09-23 18:02:33 -07:00
#define SIMULATION_CYCLE_PERIOD 720000
2015-09-23 18:02:33 -07:00
#include "trigger_decoder.h"
int getSimulatedEventTime(const TriggerWaveform& shape, int i);
2015-09-23 18:02:33 -07:00
class TriggerStimulatorHelper {
public:
2022-11-05 21:17:24 -07:00
static expected<uint32_t> findTriggerSyncPoint(
TriggerWaveform& shape,
const TriggerConfiguration& triggerConfiguration,
2022-05-10 01:41:39 -07:00
TriggerDecoderBase& state);
2015-09-23 18:02:33 -07:00
2022-11-05 21:17:24 -07:00
static void assertSyncPosition(
const TriggerConfiguration& triggerConfiguration,
const uint32_t index,
2022-05-10 01:41:39 -07:00
TriggerDecoderBase& state,
TriggerWaveform& shape
2020-08-23 23:23:13 -07:00
);
2022-11-05 21:17:24 -07:00
private:
2018-02-05 14:41:05 -08:00
// send next event so that we can see how state reacts
2022-11-05 21:17:24 -07:00
static void feedSimulatedEvent(
const TriggerConfiguration& triggerConfiguration,
2022-05-10 01:41:39 -07:00
TriggerDecoderBase& state,
const TriggerWaveform& shape,
int i);
2015-09-23 18:02:33 -07:00
};
bool isUsefulSignal(trigger_event_e signal, const TriggerWaveform& shape);