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.
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 ConnectedMotorValue
018{
019    /**
020     * Talon could not determine the type of motor attached.
021     */
022    Unknown(0),
023    /**
024     * Talon is attached to an integrated Falcon motor.
025     */
026    Falcon500_Integrated(1),
027    /**
028     * Talon is attached to an integrated Kraken X60 motor.
029     */
030    KrakenX60_Integrated(2),
031    /**
032     * Talon is attached to an integrated Kraken X44 motor.
033     */
034    KrakenX44_Integrated(3),
035    /**
036     * Talon is connected to a CTR Electronics MinionĀ® brushless three phase motor.
037     */
038    Minion_JST(4),
039    /**
040     * Talon is connected to a third party brushed DC motor with leads A and B.
041     */
042    Brushed_AB(5),
043    /**
044     * Talon is connected to a third party brushed DC motor with leads A and C.
045     */
046    Brushed_AC(6),
047    /**
048     * Talon is connected to a third party brushed DC motor with leads B and C.
049     */
050    Brushed_BC(7),
051    /**
052     * Talon is connected to a third party NEO brushless three phase motor.
053     */
054    NEO_JST(8),
055    /**
056     * Talon is connected to a third party NEO550 brushless three phase motor.
057     */
058    NEO550_JST(9),
059    /**
060     * Talon is connected to a third party VORTEX brushless three phase motor.
061     */
062    VORTEX_JST(10),
063    /**
064     * Talon is connected to a custom brushless three phase motor. This requires
065     * that the device is not FRC-Locked.
066     */
067    CustomBrushless(11),;
068
069    public final int value;
070
071    ConnectedMotorValue(int initValue)
072    {
073        this.value = initValue;
074    }
075
076    private static HashMap<Integer, ConnectedMotorValue> _map = null;
077    static
078    {
079        _map = new HashMap<Integer, ConnectedMotorValue>();
080        for (ConnectedMotorValue type : ConnectedMotorValue.values())
081        {
082            _map.put(type.value, type);
083        }
084    }
085
086    /**
087     * Gets ConnectedMotorValue from specified value
088     * @param value Value of ConnectedMotorValue
089     * @return ConnectedMotorValue of specified value
090     */
091    public static ConnectedMotorValue valueOf(int value)
092    {
093        ConnectedMotorValue retval = _map.get(value);
094        if (retval != null) return retval;
095        return ConnectedMotorValue.values()[0];
096    }
097}