Spark max motor controller help

My team is trying to run the controller in other modes then just kDutyCycle and were wondering how.

Here is a snippet from our code library.

public void setMode(ControlMode mode) {
    	switch (mode) {
		    case PercentOutput:
		    	_ctrlType = ControlType.kDutyCycle; // percentage of input
			    break;
		    case Position:
		    	_ctrlType = ControlType.kPosition;
			    break;
		    case Velocity:
		    	_ctrlType = ControlType.kVelocity;
			    break;
		    case Current:
		    case Follower:
		    case MotionProfile:
		    case MotionMagic:
		    case MotionProfileArc:
		    case Disabled:
		    	// Not supported
			    break;
	    }
	    _sparkMax.getPIDController().setReference(0, _ctrlType);
    }

In this example we use the ControlMode Enum from Phoenix to keep this method compatible across motor controllers, set the matching modes, and just ignore the modes not supported by the SPARK MAX.

In short, the first parameter is the setpoint for the mode, and the second parameter is the mode.

Bear in mind we’ve not yet tested this, but this is my understanding of how to access the alternate control modes on the SPARK MAX.