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 applied output of the bridge.
013 */
014public enum BridgeOuputValue
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
025    public final int value;
026
027    BridgeOuputValue(int initValue)
028    {
029        this.value = initValue;
030    }
031
032    private static HashMap<Integer, BridgeOuputValue> _map = null;
033    static
034    {
035        _map = new HashMap<Integer, BridgeOuputValue>();
036        for (BridgeOuputValue type : BridgeOuputValue.values())
037        {
038            _map.put(type.value, type);
039        }
040    }
041
042    /**
043     * Gets BridgeOuputValue from specified value
044     * @param value Value of BridgeOuputValue
045     * @return BridgeOuputValue of specified value
046     */
047    public static BridgeOuputValue valueOf(int value)
048    {
049        BridgeOuputValue retval = _map.get(value);
050        if(retval != null) return retval;
051        return BridgeOuputValue.values()[0];
052    }
053}