001/* Copyright (C) Cross The Road Electronics 2024 */
002package com.ctre.phoenix.motorcontrol;
003
004/**
005 * Choose the invert type of the motor controller.
006 * None is the equivalent of SetInverted(false), where positive request yields positive voltage on M+.
007 * InvertMotorOutput is the equivelant of SetInverted(true), where positive request yields positive voltage on M-.
008 * FollowMaster/OpposeMaster will match/oppose a master Talon/Victor.  This requires device to be configured as a follower.
009 *
010 * @deprecated This device's Phoenix 5 API is deprecated for removal in the
011 * 2025 season. Users should update to Phoenix 6 firmware and migrate to the
012 * Phoenix 6 API. A migration guide is available at
013 * https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html.
014 * <p>
015 * If the Phoenix 5 API must be used for this device, the device must have 22.X
016 * firmware. This firmware is available in Tuner X after selecting Phoenix 5 in
017 * the firmware year dropdown.
018 */
019@Deprecated(since = "2024", forRemoval = true)
020public enum TalonFXInvertType {
021        /** Same as SetInverted(false) */
022        CounterClockwise(0),
023        /** Same as SetInverted(true) */
024        Clockwise(1),
025        /** Follow the invert of the master this MC is following */
026        FollowMaster(2),
027        /** Oppose the invert of the master this MC is following */
028    OpposeMaster(3);
029        
030        /**
031         * Value of Invert Type
032         */
033        public int value;
034        /**
035         * Create TalonFXInvertType of specified value
036         * @param value Value of Invert Type
037         */
038        TalonFXInvertType(int value)
039        {
040                this.value = value;
041        }
042
043        /**
044         * Helper method to convert to generic InvertType enum.
045         * @return value cast as InvertType
046         */
047        public InvertType toInvertType(){
048                switch(value){
049                        case 0: return InvertType.None;
050                        case 1: return InvertType.InvertMotorOutput;
051                        case 2: return InvertType.FollowMaster;
052                        case 3: return InvertType.OpposeMaster;
053                        default: return InvertType.None;
054                }
055        }
056};