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

#include <LimitSwitchConfig.h>

Inherits rev::spark::BaseConfig.

Public Types

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)
 
LimitSwitchConfigForwardLimitSwitchType (Type type)
 
LimitSwitchConfigReverseLimitSwitchEnabled (bool enabled)
 
LimitSwitchConfigReverseLimitSwitchType (Type type)
 
- Public Member Functions inherited from rev::spark::BaseConfig
virtual ~BaseConfig ()=default
 
virtual std::string Flatten ()
 

Additional Inherited Members

- Protected Types inherited from rev::spark::BaseConfig
using SparkConfig_t = std::variant< int32_t, uint32_t, float, bool >
 
- Protected Member Functions inherited from rev::spark::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< SparkConfig_tGetParameter (uint8_t parameterId)
 
std::optional< SparkConfig_tGetParameter (BaseConfig &fromConfig, uint8_t parameterId)
 
void RemoveParameter (uint8_t parameterId)
 
void RemoveParameter (BaseConfig &fromConfig, uint8_t parameterId)
 
void Apply (BaseConfig &config)
 

Member Enumeration Documentation

◆ 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 or disable motor shutdown based on the forward limit switch state. This does not not affect the result of the isPressed() command.

Parameters
enabledTrue to enable motor shutdown 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

◆ ReverseLimitSwitchEnabled()

LimitSwitchConfig & LimitSwitchConfig::ReverseLimitSwitchEnabled ( bool  enabled)

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

Parameters
enabledTrue to enable motor shutdown 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

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