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 76 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 82 of file state_sequence.h.

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

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 78 of file state_sequence.h.

78 {
79 return switchTimes[phaseIndex];
80 }

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 90 of file state_sequence.h.

90 {
91 waveCount = 0;
92 }

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 98 of file state_sequence.h.

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

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

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: