RCKit
|
Virtual base class for classes that receive a value, maybe transform it and then do something with it. More...
#include <Setter.h>
Public Member Functions | |
Setter () | |
Constructor. More... | |
Setter (Setter *target) | |
Constructor with setting the target. | |
virtual void | input (int value) |
This is where incoming values are set. More... | |
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 |
Virtual base class for classes that receive a value, maybe transform it and then do something with it.
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 | ( | ) |
Constructor.
References _failsafeValue, and _target.
|
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 DifferentialSetter, MotorControllerSetter, HBridgeSetter, DigitalSetter, SetterDebug, AnalogSetter, and ServoSetter.
References _target, and failsafe().
Referenced by failsafe(), HBridgeSetter::failsafe(), MotorControllerSetter::failsafe(), DifferentialSetter::failsafe(), and RCRx::failsafe().
int Setter::failsafeValue | ( | ) |
Returns the most recently set failsafe value. Base class does not use this
References _failsafeValue.
Referenced by SetterDebug::failsafe(), and setFailsafeValue().
|
virtual |
This is where incoming values are set.
[in] | value | The input value |
Reimplemented in DifferentialLRSetter, DifferentialSetter, MotorControllerSetter, HBridgeSetter, DigitalSetter, AnalogSetter, AccelStepperPositionSetter, AccelStepperSpeedSetter, ServoSetter, Limiter, Linear, SetterDebug, and Inverter.
References _target, and input().
Referenced by DifferentialSetter::doOutput(), Inverter::input(), Limiter::input(), Linear::input(), input(), HBridgeSetter::input(), MotorControllerSetter::input(), and RCRx::setAnalogOutput().
|
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(), MotorControllerSetter::setTargets(), and DifferentialSetter::setTargets().
|
protected |
This is the failsafe value, which some setters use to set the output when a failsafe call is made
Referenced by AnalogSetter::failsafe(), DigitalSetter::failsafe(), failsafeValue(), setFailsafeValue(), and Setter().