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 type of motor attached to the Talon FX 013 * <p> 014 * This can be used to determine what motor is attached to the Talon FX. Return 015 * will be "Unknown" if firmware is too old or device is not present. 016 */ 017public enum MotorTypeValue 018{ 019 Unknown(0), 020 Falcon500(1), 021 KrakenX60(2),; 022 023 public final int value; 024 025 MotorTypeValue(int initValue) 026 { 027 this.value = initValue; 028 } 029 030 private static HashMap<Integer, MotorTypeValue> _map = null; 031 static 032 { 033 _map = new HashMap<Integer, MotorTypeValue>(); 034 for (MotorTypeValue type : MotorTypeValue.values()) 035 { 036 _map.put(type.value, type); 037 } 038 } 039 040 /** 041 * Gets MotorTypeValue from specified value 042 * @param value Value of MotorTypeValue 043 * @return MotorTypeValue of specified value 044 */ 045 public static MotorTypeValue valueOf(int value) 046 { 047 MotorTypeValue retval = _map.get(value); 048 if (retval != null) return retval; 049 return MotorTypeValue.values()[0]; 050 } 051}