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
|
|
|
*/
|
|
|
|
|
2019-12-05 22:05:19 -08:00
|
|
|
#pragma once
|
2015-09-23 18:02:33 -07:00
|
|
|
|
2021-06-25 10:19:16 -07:00
|
|
|
#define SIMULATION_CYCLE_PERIOD 720000
|
|
|
|
|
2015-09-23 18:02:33 -07:00
|
|
|
#include "trigger_decoder.h"
|
|
|
|
|
2021-06-25 09:50:19 -07:00
|
|
|
int getSimulatedEventTime(const TriggerWaveform& shape, int i);
|
|
|
|
|
2015-09-23 18:02:33 -07:00
|
|
|
class TriggerStimulatorHelper {
|
|
|
|
public:
|
|
|
|
|
2020-10-05 11:22:59 -07:00
|
|
|
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-05-30 19:39:57 -07:00
|
|
|
void assertSyncPosition(
|
2020-10-05 11:22:59 -07:00
|
|
|
const TriggerConfiguration& triggerConfiguration,
|
|
|
|
const uint32_t index,
|
2022-05-10 01:41:39 -07:00
|
|
|
TriggerDecoderBase& state,
|
2020-10-05 11:22:59 -07:00
|
|
|
TriggerWaveform& shape
|
2020-08-23 23:23:13 -07:00
|
|
|
);
|
2018-02-05 14:41:05 -08:00
|
|
|
|
|
|
|
// send next event so that we can see how state reacts
|
2022-05-30 19:39:57 -07:00
|
|
|
void feedSimulatedEvent(
|
2020-10-05 11:22:59 -07:00
|
|
|
const TriggerConfiguration& triggerConfiguration,
|
2022-05-10 01:41:39 -07:00
|
|
|
TriggerDecoderBase& state,
|
2020-10-05 11:22:59 -07:00
|
|
|
const TriggerWaveform& shape,
|
|
|
|
int i);
|
2015-09-23 18:02:33 -07:00
|
|
|
};
|
|
|
|
|
2020-10-05 11:22:59 -07:00
|
|
|
bool isUsefulSignal(trigger_event_e signal, const TriggerConfiguration& triggerConfiguration);
|