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
|
|
|
|
|
|
|
#include "trigger_decoder.h"
|
|
|
|
|
|
|
|
class TriggerStimulatorHelper {
|
|
|
|
public:
|
|
|
|
|
2020-10-05 11:22:59 -07:00
|
|
|
uint32_t findTriggerSyncPoint(
|
|
|
|
TriggerWaveform& shape,
|
|
|
|
const TriggerConfiguration& triggerConfiguration,
|
|
|
|
TriggerState& state);
|
2015-09-23 18:02:33 -07:00
|
|
|
|
2020-10-05 11:22:59 -07:00
|
|
|
void assertSyncPositionAndSetDutyCycle(
|
|
|
|
const TriggerStateCallback triggerCycleCallback,
|
|
|
|
const TriggerConfiguration& triggerConfiguration,
|
|
|
|
const uint32_t index,
|
|
|
|
TriggerState& state,
|
|
|
|
TriggerWaveform& shape
|
2020-08-23 23:23:13 -07:00
|
|
|
);
|
2018-02-05 14:41:05 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
// send next event so that we can see how state reacts
|
2020-08-23 22:21:42 -07:00
|
|
|
void feedSimulatedEvent(const TriggerStateCallback triggerCycleCallback,
|
2020-10-05 11:22:59 -07:00
|
|
|
const TriggerConfiguration& triggerConfiguration,
|
|
|
|
TriggerState& state,
|
|
|
|
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);
|