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.phoenixpro.signals; 008 009import java.util.HashMap; 010 011/** 012 * The active control mode of the motor controller 013 * 014 * @deprecated Classes in the phoenixpro package will be removed in 2024. 015 * Users should instead use classes from the phoenix6 package. 016 */ 017@Deprecated(forRemoval = true) 018public enum ControlModeValue 019{ 020 DisabledOutput(0), 021 NeutralOut(1), 022 StaticBrake(2), 023 DutyCycleOut(3), 024 PositionDutyCycle(4), 025 VelocityDutyCycle(5), 026 MotionMagicDutyCycle(6), 027 DutyCycleFOC(7), 028 PositionDutyCycleFOC(8), 029 VelocityDutyCycleFOC(9), 030 MotionMagicDutyCycleFOC(10), 031 VoltageOut(11), 032 PositionVoltage(12), 033 VelocityVoltage(13), 034 MotionMagicVoltage(14), 035 VoltageFOC(15), 036 PositionVoltageFOC(16), 037 VelocityVoltageFOC(17), 038 MotionMagicVoltageFOC(18), 039 TorqueCurrentFOC(19), 040 PositionTorqueCurrentFOC(20), 041 VelocityTorqueCurrentFOC(21), 042 MotionMagicTorqueCurrentFOC(22), 043 Follower(23), 044 Reserved(24), 045 CoastOut(25),; 046 047 public final int value; 048 049 ControlModeValue(int initValue) 050 { 051 this.value = initValue; 052 } 053 054 private static HashMap<Integer, ControlModeValue> _map = null; 055 static 056 { 057 _map = new HashMap<Integer, ControlModeValue>(); 058 for (ControlModeValue type : ControlModeValue.values()) 059 { 060 _map.put(type.value, type); 061 } 062 } 063 064 /** 065 * Gets ControlModeValue from specified value 066 * @param value Value of ControlModeValue 067 * @return ControlModeValue of specified value 068 */ 069 public static ControlModeValue valueOf(int value) 070 { 071 ControlModeValue retval = _map.get(value); 072 if(retval != null) return retval; 073 return ControlModeValue.values()[0]; 074 } 075}