A generic class representing a simple PWM output. More...
#include <PqOutputs.h>


Public Member Functions | |
| AnalogOut (uint8_t pin, Engine &engine=Engine::primary()) | |
| Constructor with default mode DIRECT. | |
| AnalogOut (uint8_t pin, uint8_t mode, Engine &engine=Engine::primary()) | |
| Constructor. | |
| virtual float | put (float value) |
| Pushes value into the component and returns its (possibly filtered) value. | |
| virtual void | invert () |
Inverts value by calling put(1-get()) (eg. 0.2 becomes 0.8). | |
| void | write (float value) |
| Direclty writes value in [0, 1] to the pin (bypasses mode and engine). | |
| void | rawWrite (int value) |
| Direclty writes raw value to the pin (bypasses mode and engine). | |
| 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. | |
| operator bool () | |
| Operator that allows usage in conditional expressions. | |
| uint8_t | pin () const |
| Returns the pin this component is attached to. | |
| uint8_t | mode () const |
| Returns the mode of the component. | |
| virtual void | mode (uint8_t mode) |
| Changes the mode of the component. | |
Protected Member Functions | |
| virtual void | step () |
| virtual void | begin () |
| 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. | |
| Engine * | engine () const |
| Returns the engine that owns this unit. | |
Protected Attributes | |
| float | _value |
| uint8_t | _pin |
| uint8_t | _mode |
A generic class representing a simple PWM output.
| pq::AnalogOut::AnalogOut | ( | uint8_t | pin, |
| Engine & | engine = Engine::primary() |
||
| ) |
Constructor with default mode DIRECT.
| pin | the pin number |
| pq::AnalogOut::AnalogOut | ( | uint8_t | pin, |
| uint8_t | mode, | ||
| Engine & | engine = Engine::primary() |
||
| ) |
Constructor.
| pin | the pin number |
| mode | the mode (DIRECT or INVERTED) |
|
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 >.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
Maps value to new range.
Reimplemented from pq::Chainable.
Reimplemented in pq::Normalizer, pq::StreamIn, and pq::StreamOut.
|
inlinevirtualinherited |
Changes the mode of the component.
Reimplemented in pq::DigitalIn, and pq::DigitalOut.
|
virtual |
Pushes value into the component and returns its (possibly filtered) value.
Reimplemented from pq::Chainable.
|
protectedvirtual |
Reimplemented from pq::Unit.