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 applied output of the bridge.
013 */
014public enum BridgeOutputValue
015{
016    BridgeReq_Coast(0),
017    BridgeReq_Brake(1),
018    BridgeReq_Trapez(6),
019    BridgeReq_FOCTorque(7),
020    BridgeReq_MusicTone(8),
021    BridgeReq_FOCEasy(9),
022    BridgeReq_FaultBrake(12),
023    BridgeReq_FaultCoast(13),
024    BridgeReq_ActiveBrake(14),;
025
026    public final int value;
027
028    BridgeOutputValue(int initValue)
029    {
030        this.value = initValue;
031    }
032
033    private static HashMap<Integer, BridgeOutputValue> _map = null;
034    static
035    {
036        _map = new HashMap<Integer, BridgeOutputValue>();
037        for (BridgeOutputValue type : BridgeOutputValue.values())
038        {
039            _map.put(type.value, type);
040        }
041    }
042
043    /**
044     * Gets BridgeOutputValue from specified value
045     * @param value Value of BridgeOutputValue
046     * @return BridgeOutputValue of specified value
047     */
048    public static BridgeOutputValue valueOf(int value)
049    {
050        BridgeOutputValue retval = _map.get(value);
051        if (retval != null) return retval;
052        return BridgeOutputValue.values()[0];
053    }
054}