rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
MultiChannelStateSequenceWithData< max_phase > Class Template Reference

#include <state_sequence.h>

Inheritance diagram for MultiChannelStateSequenceWithData< max_phase >:
Inheritance graph
[legend]
Collaboration diagram for MultiChannelStateSequenceWithData< max_phase >:
Collaboration graph
[legend]

Public Member Functions

float getSwitchTime (int phaseIndex) const override
 
pin_state_t getChannelState (int channelIndex, int phaseIndex) const override
 
void reset ()
 
void setSwitchTime (const int phaseIndex, const float value)
 
void setChannelState (const int channelIndex, const int phaseIndex, pin_state_t state)
 
- Public Member Functions inherited from MultiChannelStateSequence
void checkSwitchTimes (float scale) const
 
expected< int > findAngleMatch (float angle) const
 
int findInsertionAngle (float angle) const
 

Private Attributes

float switchTimes [max_phase]
 
uint8_t waveForm [max_phase]
 

Additional Inherited Members

- Data Fields inherited from MultiChannelStateSequence
uint16_t phaseCount = 0
 
uint16_t waveCount = 0
 

Detailed Description

template<unsigned max_phase>
class MultiChannelStateSequenceWithData< max_phase >

Definition at line 77 of file state_sequence.h.

Member Function Documentation

◆ getChannelState()

template<unsigned max_phase>
pin_state_t MultiChannelStateSequenceWithData< max_phase >::getChannelState ( int  channelIndex,
int  phaseIndex 
) const
inlineoverridevirtual

Implements MultiChannelStateSequence.

Definition at line 83 of file state_sequence.h.

83 {
84 if (channelIndex >= waveCount) {
85 // todo: would be nice to get this asserting working
86 //criticalError("channel index %d/%d", channelIndex, waveCount);
87 }
88 return ((waveForm[phaseIndex] >> channelIndex) & 1) ? TriggerValue::RISE : TriggerValue::FALL;
89 }

Referenced by TriggerWaveform::addEvent().

Here is the caller graph for this function:

◆ getSwitchTime()

template<unsigned max_phase>
float MultiChannelStateSequenceWithData< max_phase >::getSwitchTime ( int  phaseIndex) const
inlineoverridevirtual

values in the (0..1] range which refer to points within the period at at which pin state should be changed So, in the simplest case we turn pin off at 0.3 and turn it on at 1 - that would give us a 70% duty cycle PWM

Implements MultiChannelStateSequence.

Definition at line 79 of file state_sequence.h.

79 {
80 return switchTimes[phaseIndex];
81 }

Referenced by getSimulatedEventTime(), and TriggerWaveform::getSwitchAngle().

Here is the caller graph for this function:

◆ reset()

template<unsigned max_phase>
void MultiChannelStateSequenceWithData< max_phase >::reset ( )
inline

Definition at line 91 of file state_sequence.h.

91 {
92 waveCount = 0;
93 }

Referenced by TriggerWaveform::initialize().

Here is the caller graph for this function:

◆ setChannelState()

template<unsigned max_phase>
void MultiChannelStateSequenceWithData< max_phase >::setChannelState ( const int  channelIndex,
const int  phaseIndex,
pin_state_t  state 
)
inline

Definition at line 99 of file state_sequence.h.

99 {
100 if (channelIndex >= waveCount) {
101 // todo: would be nice to get this asserting working
102 //criticalError("channel index %d/%d", channelIndex, waveCount);
103 }
104 uint8_t & ref = waveForm[phaseIndex];
105 ref = (ref & ~(1U << channelIndex)) | ((state == TriggerValue::RISE ? 1 : 0) << channelIndex);
106 }
state("state", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1878, 1.0, -1.0, -1.0, "")

Referenced by TriggerWaveform::addEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSwitchTime()

template<unsigned max_phase>
void MultiChannelStateSequenceWithData< max_phase >::setSwitchTime ( const int  phaseIndex,
const float  value 
)
inline

Definition at line 95 of file state_sequence.h.

95 {
96 switchTimes[phaseIndex] = value;
97 }

Referenced by TriggerWaveform::addEvent(), and SimplePwm::setSimplePwmDutyCycle().

Here is the caller graph for this function:

Field Documentation

◆ switchTimes

template<unsigned max_phase>
float MultiChannelStateSequenceWithData< max_phase >::switchTimes[max_phase]
private

◆ waveForm

template<unsigned max_phase>
uint8_t MultiChannelStateSequenceWithData< max_phase >::waveForm[max_phase]
private

The documentation for this class was generated from the following file: