Plaquette
 
Loading...
Searching...
No Matches
pq::MovingFilter Class Referenceabstract
Inheritance diagram for pq::MovingFilter:
Collaboration diagram for pq::MovingFilter:

Public Member Functions

virtual void infiniteTimeWindow ()=0
 Sets time window to infinite.
 
virtual void timeWindow (float seconds)=0
 Changes the time window (expressed in seconds).
 
virtual float timeWindow () const =0
 Returns the time window (expressed in seconds).
 
virtual bool timeWindowIsInfinite () const =0
 Returns true if time window is infinite.
 
virtual void cutoff (float hz)
 Changes the time window cutoff frequency (expressed in Hz).
 
virtual float cutoff () const
 Returns the time window cutoff frequency (expressed in Hz).
 
virtual void reset ()
 Resets the moving filter.
 
virtual void resumeCalibrating ()
 Switches to calibration mode (default).
 
virtual void pauseCalibrating ()
 Switches to non-calibration mode: calls to put(value) will return filtered value without updating the normalization statistics.
 
virtual void toggleCalibrating ()
 Toggles calibration mode.
 
virtual bool isCalibrating () const
 Returns true iff the moving filter is in calibration mode.
 
virtual float get ()
 Returns value in [0, 1].
 
virtual float mapTo (float toLow, float toHigh)
 Maps value to new range.
 
virtual void clearEvents ()
 
float seconds () const
 Returns engine time in seconds.
 
uint32_t milliSeconds () const
 Returns engine time in milliseconds.
 
uint64_t microSeconds () const
 Returns engine time in microseconds.
 
unsigned long nSteps () const
 Returns number of engine steps.
 
float sampleRate () const
 Returns engine sample rate.
 
float samplePeriod () const
 Returns enginesample period.
 
 operator float ()
 Object can be used directly to access its value.
 
virtual float put (float value)
 Pushes value into the unit.
 
 operator bool ()
 Operator that allows usage in conditional expressions.
 

Static Public Member Functions

static bool analogToDigital (float f)
 Converts analog (float) value to digital (bool) value.
 
static float digitalToAnalog (bool b)
 Converts digital (bool) value to analog (float) value.
 

Protected Member Functions

 MovingFilter (Engine &engine=Engine::primary())
 Constructor.
 
virtual void begin ()
 
virtual void step ()
 
virtual bool eventTriggered (EventType eventType)
 Returns true iff an event of a certain type has been triggered.
 
virtual void onEvent (EventCallback callback, EventType eventType)
 Registers event callback.
 
Engineengine () const
 Returns the engine that owns this unit.
 

Protected Attributes

bool _isCalibrating: 1
 
uint8_t _nValuesStep: 7
 
float _value
 

Constructor & Destructor Documentation

◆ MovingFilter()

pq::MovingFilter::MovingFilter ( Engine engine = Engine::primary())
protected

Constructor.

Parameters
enginethe engine running this unit

Member Function Documentation

◆ eventTriggered()

virtual bool pq::Unit::eventTriggered ( EventType  eventType)
inlineprotectedvirtualinherited

Returns true iff an event of a certain type has been triggered.

Reimplemented in pq::AbstractWave, pq::Alarm, pq::Metronome, pq::PeakDetector, pq::DigitalSource, pq::Ramp, pq::StreamIn, and pq::TimeSliceField< COUNT >.

◆ get()

virtual float pq::AnalogSource::get ( )
inlinevirtualinherited

Returns value in [0, 1].

Reimplemented from pq::Chainable.

Reimplemented in pq::AbstractWave.

◆ infiniteTimeWindow()

virtual void pq::MovingFilter::infiniteTimeWindow ( )
pure virtual

Sets time window to infinite.

Implemented in pq::MinMaxScaler, and pq::Normalizer.

◆ mapTo()

virtual float pq::AnalogSource::mapTo ( float  toLow,
float  toHigh 
)
inlinevirtualinherited

Maps value to new range.

Reimplemented from pq::Chainable.

Reimplemented in pq::Normalizer, pq::StreamIn, and pq::StreamOut.

◆ put()

virtual float pq::Chainable::put ( float  value)
inlinevirtualinherited

Pushes value into the unit.

Parameters
valuethe value sent to the unit
Returns
the new value of the unit

Reimplemented in pq::Chronometer, pq::MinMaxScaler, pq::Normalizer, pq::PeakDetector, pq::DigitalUnit, pq::AnalogOut, pq::AbstractServoOut, pq::Ramp, pq::Smoother, pq::StreamOut, pq::PivotField, and pq::TimeSliceField< COUNT >.

◆ reset()

void pq::MovingFilter::reset ( )
virtual

Resets the moving filter.

Reimplemented in pq::MinMaxScaler, and pq::Normalizer.

◆ resumeCalibrating()

void pq::MovingFilter::resumeCalibrating ( )
virtual

Switches to calibration mode (default).

Calls to put(value) will return filtered value AND update the normalization statistics.

◆ timeWindow() [1/2]

virtual float pq::MovingFilter::timeWindow ( ) const
pure virtual

Returns the time window (expressed in seconds).

Implemented in pq::MinMaxScaler, and pq::Normalizer.

◆ timeWindow() [2/2]

virtual void pq::MovingFilter::timeWindow ( float  seconds)
pure virtual

Changes the time window (expressed in seconds).

Implemented in pq::MinMaxScaler, and pq::Normalizer.

◆ timeWindowIsInfinite()

virtual bool pq::MovingFilter::timeWindowIsInfinite ( ) const
pure virtual

Returns true if time window is infinite.

Implemented in pq::MinMaxScaler, and pq::Normalizer.


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