#include <Setter.h>
Public Member Functions | |
Setter () | |
Constructor. | |
Setter (Setter *target) | |
Constructor with setting the target. | |
virtual void | input (int value) |
This is where incoming values are set. | |
virtual void | setTarget (Setter *target) |
virtual void | failsafe () |
void | setFailsafeValue (int failsafeValue) |
Sets the failsafeValue. | |
int | failsafeValue () |
Protected Attributes | |
Setter * | _target |
This is the instance of Setter that will be given the transfotmed output value. | |
int | _failsafeValue |
Setters (ie different subclasses of Setter) are designed to be chained together. Each Setter in a chain transforms its input value in some way and then maybe passes it on to its output Setter. Setters can be designed to do almost any transformation with a number, including changing it, sending it to some device, using the value to set a physical output etc. Each setter can accept as input an int (ie a 16 bit signed number) although some Setters may be more constrained as to which value ranges make physical sense.
Setter::Setter | ( | ) |
void Setter::input | ( | int | value | ) | [virtual] |
This is where incoming values are set.
[in] | value | The input value |
Reimplemented in AccelStepperPositionSetter, AccelStepperSpeedSetter, AnalogSetter, DifferentialSetter, DifferentialLRSetter, DigitalSetter, HBridgeSetter, Inverter, Limiter, Linear, ServoSetter, and SetterDebug.
References _target, and input().
Referenced by DifferentialSetter::doOutput(), input(), Linear::input(), Limiter::input(), Inverter::input(), HBridgeSetter::input(), and RCRx::setAnalogOutput().
void Setter::setTarget | ( | Setter * | target | ) | [virtual] |
Connects this Setter to a downstream Setter
[in] | target | Pointer to a sublass of Setter, whose input() function will be called when a new value is available from this Setter. |
References _target.
Referenced by HBridgeSetter::setTargets(), and DifferentialSetter::setTargets().
void Setter::failsafe | ( | ) | [virtual] |
Called when the source of input data is lost, and the Setter is required to fail in a safe way. Subclasses can override. Default is to send to next Setter in the chain.
Reimplemented in AnalogSetter, DifferentialSetter, DigitalSetter, HBridgeSetter, ServoSetter, and SetterDebug.
References _target, and failsafe().
Referenced by failsafe(), RCRx::failsafe(), HBridgeSetter::failsafe(), and DifferentialSetter::failsafe().
int Setter::failsafeValue | ( | ) |
Returns the most recently set failsafe value. Base class does not use this
References _failsafeValue.
Referenced by SetterDebug::failsafe().
int Setter::_failsafeValue [protected] |
This is the failsafe value, which some setters use to set the output when a failsafe call is made
Referenced by DigitalSetter::failsafe(), AnalogSetter::failsafe(), failsafeValue(), setFailsafeValue(), and Setter().