001/* 002 * Copyright (C) Cross The Road Electronics. All rights reserved. 003 * License information can be found in CTRE_LICENSE.txt 004 * For support and suggestions contact support@ctr-electronics.com or file 005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases 006 */ 007package com.ctre.phoenix6.signals; 008 009import java.util.HashMap; 010 011/** 012 * The active control mode of the differential controller 013 */ 014public enum DifferentialControlModeValue 015{ 016 DisabledOutput(0), 017 NeutralOut(1), 018 StaticBrake(2), 019 DutyCycleOut(3), 020 PositionDutyCycle(4), 021 VelocityDutyCycle(5), 022 MotionMagicDutyCycle(6), 023 DutyCycleFOC(7), 024 PositionDutyCycleFOC(8), 025 VelocityDutyCycleFOC(9), 026 MotionMagicDutyCycleFOC(10), 027 VoltageOut(11), 028 PositionVoltage(12), 029 VelocityVoltage(13), 030 MotionMagicVoltage(14), 031 VoltageFOC(15), 032 PositionVoltageFOC(16), 033 VelocityVoltageFOC(17), 034 MotionMagicVoltageFOC(18), 035 TorqueCurrentFOC(19), 036 PositionTorqueCurrentFOC(20), 037 VelocityTorqueCurrentFOC(21), 038 MotionMagicTorqueCurrentFOC(22), 039 Follower(23), 040 Reserved(24), 041 CoastOut(25),; 042 043 public final int value; 044 045 DifferentialControlModeValue(int initValue) 046 { 047 this.value = initValue; 048 } 049 050 private static HashMap<Integer, DifferentialControlModeValue> _map = null; 051 static 052 { 053 _map = new HashMap<Integer, DifferentialControlModeValue>(); 054 for (DifferentialControlModeValue type : DifferentialControlModeValue.values()) 055 { 056 _map.put(type.value, type); 057 } 058 } 059 060 /** 061 * Gets DifferentialControlModeValue from specified value 062 * @param value Value of DifferentialControlModeValue 063 * @return DifferentialControlModeValue of specified value 064 */ 065 public static DifferentialControlModeValue valueOf(int value) 066 { 067 DifferentialControlModeValue retval = _map.get(value); 068 if (retval != null) return retval; 069 return DifferentialControlModeValue.values()[0]; 070 } 071}