Plaquette
 
Loading...
Searching...
No Matches
pq::Plotter Class Reference
Inheritance diagram for pq::Plotter:
Collaboration diagram for pq::Plotter:

Public Member Functions

 Plotter (unsigned long baudRate, const char *labels=nullptr, Engine &engine=Engine::primary())
 
 Plotter (SerialType &serial, unsigned long baudRate, const char *labels=nullptr, Engine &engine=Engine::primary())
 
 Plotter (Print &out, const char *labels=nullptr, Engine &engine=Engine::primary())
 
const char * labels () const
 Returns labels.
 
void format (PlotterFormatPreset preset)
 Sets format based on preset.
 
void format (PlotterFormat format)
 Sets format based on custom format.
 
PlotterFormat format ()
 Returns current format.
 
void precision (uint8_t digits)
 Sets decimal precision of values.
 
uint8_t precision () const
 Returns the decimal precision of values.
 
float put (float value) override
 Pushes value into the unit.
 
float get () override
 Returns last value.
 
void beginPlot ()
 Begins new plot.
 
void endPlot ()
 Ends current plot.
 
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 mapTo (float toLow, float toHigh)
 Maps value to new range.
 
 operator bool ()
 Operator that allows usage in conditional expressions.
 

Static Public Member Functions

static PlotterFormat formatFromPreset (PlotterFormatPreset preset, const char *labelsSchema=nullptr)
 Returns a PlotterFormat based on presets and labels.
 
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

void begin () override
 
void step () override
 
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.
 

Member Function Documentation

◆ begin()

void pq::Plotter::begin ( )
overrideprotectedvirtual

Reimplemented from pq::Unit.

◆ 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()

float pq::Plotter::get ( )
inlineoverridevirtual

Returns last value.

Reimplemented from pq::Flowable.

◆ mapTo()

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

Maps value to new range.

This function guarantees that the value is within [toLow, toHigh]. If the unit's values are unbounded, returns get() constrained to [toLow, toHigh].

Reimplemented in pq::Normalizer, pq::DigitalUnit, pq::AnalogSource, pq::AnalogIn, pq::Ramp, pq::StreamIn, and pq::StreamOut.

◆ precision()

void pq::Plotter::precision ( uint8_t  digits)
inline

Sets decimal precision of values.

Parameters
digitsthe number of digits after the point

◆ put()

float pq::Plotter::put ( float  value)
overridevirtual

Pushes value into the unit.

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

Reimplemented from pq::Flowable.

◆ step()

void pq::Plotter::step ( )
overrideprotectedvirtual

Reimplemented from pq::Unit.


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