RCKit
Public Member Functions | Protected Attributes | List of all members
Setter Class Reference

Virtual base class for classes that receive a value, maybe transform it and then do something with it. More...

#include <Setter.h>

Inheritance diagram for Setter:
Inheritance graph
[legend]
Collaboration diagram for Setter:
Collaboration graph
[legend]

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
 

Detailed Description

Virtual base class for classes that receive a value, maybe transform it and then do something with it.

Author
Mike McCauley (mikem.nosp@m.@air.nosp@m.spayc.nosp@m.e.co.nosp@m.m)

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.

Constructor & Destructor Documentation

◆ Setter()

Setter::Setter ( )

Constructor.

Author
Mike McCauley (mikem.nosp@m.@air.nosp@m.spayc.nosp@m.e.co.nosp@m.m)

References _failsafeValue, and _target.

Member Function Documentation

◆ failsafe()

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 DifferentialSetter, MotorControllerSetter, HBridgeSetter, DigitalSetter, SetterDebug, AnalogSetter, and ServoSetter.

References _target, and failsafe().

Referenced by failsafe(), HBridgeSetter::failsafe(), MotorControllerSetter::failsafe(), DifferentialSetter::failsafe(), and RCRx::failsafe().

◆ failsafeValue()

int Setter::failsafeValue ( )

Returns the most recently set failsafe value. Base class does not use this

References _failsafeValue.

Referenced by SetterDebug::failsafe(), and setFailsafeValue().

◆ input()

void Setter::input ( int  value)
virtual

◆ setTarget()

void Setter::setTarget ( Setter target)
virtual

Connects this Setter to a downstream Setter

Parameters
[in]targetPointer 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().

Member Data Documentation

◆ _failsafeValue

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 AnalogSetter::failsafe(), DigitalSetter::failsafe(), failsafeValue(), setFailsafeValue(), and Setter().


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