REVLib - C++
|
#include <SparkMax.h>
Inherits rev::spark::SparkBase.
Public Attributes | |
SparkMaxConfigAccessor | configAccessor |
Friends | |
class | SparkMaxAlternateEncoder |
|
explicit |
Create a new object to control a SPARK MAX motor Controller
deviceID | The device ID. |
type | The motor type connected to the controller. Brushless motor wires must be connected to their matching colors, and the hall sensor must be plugged in. Brushed motors must be connected to the Red and Black terminals only. |
|
overridedefault |
Closes the SPARK MAX Controller
|
overridevirtual |
Set the configuration for the SPARK.
If resetMode
is ResetMode::kResetSafeParameters, this method will reset safe writable parameters to their default values before setting the given configuration. The following parameters will not be reset by this action: CAN ID, Motor Type, Idle Mode, PWM Input Deadband, and Duty Cycle Offset.
If persistMode
is PersistMode::kPersistParameters, this method will save all parameters to the SPARK's non-volatile memory after setting the given configuration. This will allow parameters to persist across power cycles.
config | The desired SPARK configuration |
resetMode | Whether to reset safe parameters before setting the configuration |
persistMode | Whether to persist the parameters after setting the configuration |
Reimplemented from rev::spark::SparkBase.
SparkMaxAlternateEncoder & SparkMax::GetAlternateEncoder | ( | ) |
Returns an object for interfacing with a quadrature encoder connected to the alternate encoder mode data port pins. These are defined as:
Pin 4 (Forward Limit Switch): Index Pin 6 (Multi-function): Encoder A Pin 8 (Reverse Limit Switch): Encoder B
This call will disable support for the limit switch inputs.
|
overridevirtual |
Returns an object for interfacing with a connected absolute encoder.
The default encoder type is assumed to be a duty cycle sensor.
Reimplemented from rev::spark::SparkBase.
|
overridevirtual |
Returns an object for interfacing with the forward limit switch connected to the appropriate pins on the data port.
This call will disable support for the alternate encoder.
Reimplemented from rev::spark::SparkBase.
|
overridevirtual |
Returns an object for interfacing with the reverse limit switch connected to the appropriate pins on the data port.
This call will disable support for the alternate encoder.
Reimplemented from rev::spark::SparkBase.
|
friend |
SparkMaxConfigAccessor rev::spark::SparkMax::configAccessor |
Accessor for SPARK parameter values. This object contains fields and methods to retrieve parameters that have been applied to the device. To set parameters, see SparkBaseConfig and SparkBase::Configure.
NOTE: This uses calls that are blocking to retrieve parameters and should be used infrequently.