REVLib - C++
rev::spark::LimitSwitchConfig Class Reference

#include <LimitSwitchConfig.h>

Inherits rev::BaseConfig.

Public Types

enum  Behavior : uint32_t { kKeepMovingMotor = 0 , kStopMovingMotor = 1 , kKeepMovingMotorAndSetPosition = 2 , kStopMovingMotorAndSetPosition = 3 }
 
enum  Type { kNormallyOpen = 0 , kNormallyClosed = 1 }
 

Public Member Functions

 LimitSwitchConfig ()=default
 
 ~LimitSwitchConfig () override=default
 
 LimitSwitchConfig (const LimitSwitchConfig &)=delete
 
LimitSwitchConfigoperator= (const LimitSwitchConfig &)=delete
 
 LimitSwitchConfig (LimitSwitchConfig &&) noexcept=delete
 
LimitSwitchConfigoperator= (LimitSwitchConfig &&) noexcept=delete
 
LimitSwitchConfigApply (LimitSwitchConfig &config)
 
LimitSwitchConfigSetSparkMaxDataPortConfig ()
 
LimitSwitchConfigForwardLimitSwitchEnabled (bool enabled)
 
LimitSwitchConfigForwardLimitSwitchTriggerBehavior (Behavior behavior)
 
LimitSwitchConfigForwardLimitSwitchType (Type type)
 
LimitSwitchConfigForwardLimitSwitchPosition (double position)
 
LimitSwitchConfigReverseLimitSwitchEnabled (bool enabled)
 
LimitSwitchConfigReverseLimitSwitchTriggerBehavior (Behavior behavior)
 
LimitSwitchConfigReverseLimitSwitchType (Type type)
 
LimitSwitchConfigReverseLimitSwitchPosition (double position)
 
LimitSwitchConfigLimitSwitchPositionSensor (FeedbackSensor sensor)
 
- Public Member Functions inherited from rev::BaseConfig
virtual ~BaseConfig ()=default
 
virtual std::string Flatten ()
 

Additional Inherited Members

- Protected Types inherited from rev::BaseConfig
using REVLibConfig_t = std::variant< int32_t, uint32_t, float, bool >
 
- Protected Member Functions inherited from rev::BaseConfig
 BaseConfig ()=default
 
 BaseConfig (const BaseConfig &)=delete
 
BaseConfigoperator= (const BaseConfig &)=delete
 
 BaseConfig (BaseConfig &&) noexcept=delete
 
BaseConfigoperator= (BaseConfig &&) noexcept=delete
 
template<typename ConfigType >
void PutParameter (uint8_t parameterId, ConfigType value)
 
std::optional< REVLibConfig_tGetParameter (uint8_t parameterId)
 
void RemoveParameter (uint8_t parameterId)
 
void Apply (BaseConfig &config)
 
- Static Protected Member Functions inherited from rev::BaseConfig
static std::optional< REVLibConfig_tGetParameter (BaseConfig &fromConfig, uint8_t parameterId)
 
static void RemoveParameter (BaseConfig &fromConfig, uint8_t parameterId)
 

Member Enumeration Documentation

◆ Behavior

Enumerator
kKeepMovingMotor 
kStopMovingMotor 
kKeepMovingMotorAndSetPosition 
kStopMovingMotorAndSetPosition 

◆ Type

Enumerator
kNormallyOpen 
kNormallyClosed 

Constructor & Destructor Documentation

◆ LimitSwitchConfig() [1/3]

rev::spark::LimitSwitchConfig::LimitSwitchConfig ( )
default

◆ ~LimitSwitchConfig()

rev::spark::LimitSwitchConfig::~LimitSwitchConfig ( )
overridedefault

◆ LimitSwitchConfig() [2/3]

rev::spark::LimitSwitchConfig::LimitSwitchConfig ( const LimitSwitchConfig )
delete

◆ LimitSwitchConfig() [3/3]

rev::spark::LimitSwitchConfig::LimitSwitchConfig ( LimitSwitchConfig &&  )
deletenoexcept

Member Function Documentation

◆ operator=() [1/2]

LimitSwitchConfig & rev::spark::LimitSwitchConfig::operator= ( const LimitSwitchConfig )
delete

◆ operator=() [2/2]

LimitSwitchConfig & rev::spark::LimitSwitchConfig::operator= ( LimitSwitchConfig &&  )
deletenoexcept

◆ Apply()

LimitSwitchConfig & LimitSwitchConfig::Apply ( LimitSwitchConfig config)

Applies settings from another LimitSwitchConfig to this one.

Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.

Parameters
configThe LimitSwitchConfig to copy settings from
Returns
The updated LimitSwitchConfig for method chaining

◆ SetSparkMaxDataPortConfig()

LimitSwitchConfig & LimitSwitchConfig::SetSparkMaxDataPortConfig ( )

Configures the data port to use limit switches, which is specifically required for SPARK MAX.

NOTE: This method is only necessary when using limit switches with a SPARK MAX without configuring any of its settings

IMPORTANT: SPARK MAX does not support using limit switches in conjunction with an alternate encoder.

Returns
The modified LimitSwitchConfig object for method chaining

◆ ForwardLimitSwitchEnabled()

LimitSwitchConfig & LimitSwitchConfig::ForwardLimitSwitchEnabled ( bool  enabled)

Set whether to enable/disable motor shutdown based on the forward limit switch state. This does not not affect the result of the isPressed() command.

Parameters
enabledTrue for halting the motor when triggered
Returns
The modified LimitSwitchConfig object for method chaining

◆ ForwardLimitSwitchTriggerBehavior()

LimitSwitchConfig & LimitSwitchConfig::ForwardLimitSwitchTriggerBehavior ( Behavior  behavior)

Set the trigger behavior based on the forward limit switch state. This does not not affect the result of the isPressed() command.

Parameters
behaviorThe trigger behavior
Returns
The modified LimitSwitchConfig object for method chaining

◆ ForwardLimitSwitchType()

LimitSwitchConfig & LimitSwitchConfig::ForwardLimitSwitchType ( Type  type)

Set the normal state of the forward limit switch.

Parameters
typekNormallyOpen or kNormallyClosed
Returns
The modified LimitSwitchConfig object for method chaining

◆ ForwardLimitSwitchPosition()

LimitSwitchConfig & LimitSwitchConfig::ForwardLimitSwitchPosition ( double  position)

Set the triggered position value of the forward limit switch (used when the enable mode is set to kEnabled_SetValueOnTrigger).

Parameters
positionuser specified position value
Returns
The modified LimitSwitchConfig object for method chaining

◆ ReverseLimitSwitchEnabled()

LimitSwitchConfig & LimitSwitchConfig::ReverseLimitSwitchEnabled ( bool  enabled)

Set whether to enable/disable motor shutdown based on the reverse limit switch state. This does not not affect the result of the isPressed() command.

Parameters
enabledTrue for halting the motor when triggered
Returns
The modified LimitSwitchConfig object for method chaining

◆ ReverseLimitSwitchTriggerBehavior()

LimitSwitchConfig & LimitSwitchConfig::ReverseLimitSwitchTriggerBehavior ( Behavior  behavior)

Set the trigger behavior based on the reverse limit switch state. This does not not affect the result of the isPressed() command.

Parameters
behaviorThe trigger behavior
Returns
The modified LimitSwitchConfig object for method chaining

◆ ReverseLimitSwitchType()

LimitSwitchConfig & LimitSwitchConfig::ReverseLimitSwitchType ( Type  type)

Set the normal state of the reverse limit switch.

Parameters
typekNormallyOpen or kNormallyClosed
Returns
The modified LimitSwitchConfig object for method chaining

◆ ReverseLimitSwitchPosition()

LimitSwitchConfig & LimitSwitchConfig::ReverseLimitSwitchPosition ( double  position)

Set the triggered position value of the reverse limit switch (used when the enable mode is set to kEnabled_SetValueOnTrigger).

Parameters
positionuser specified position value
Returns
The modified LimitSwitchConfig object for method chaining

◆ LimitSwitchPositionSensor()

LimitSwitchConfig & LimitSwitchConfig::LimitSwitchPositionSensor ( FeedbackSensor  sensor)

Specifies the feedback sensor that the triggered position value is set on. This applies for both forward and reverse limit switches.

Parameters
sensorThe feedback sensor to set the position value on
Returns
The modified LimitSwitchConfig object for method chaining

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