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 * Direction of the sensor to determine positive facing the LED side of the 013 * CANcoder. 014 * 015 * @deprecated Classes in the phoenixpro package will be removed in 2024. 016 * Users should instead use classes from the phoenix6 package. 017 */ 018@Deprecated(forRemoval = true) 019public enum SensorDirectionValue 020{ 021 CounterClockwise_Positive(0), 022 Clockwise_Positive(1),; 023 024 public final int value; 025 026 SensorDirectionValue(int initValue) 027 { 028 this.value = initValue; 029 } 030 031 private static HashMap<Integer, SensorDirectionValue> _map = null; 032 static 033 { 034 _map = new HashMap<Integer, SensorDirectionValue>(); 035 for (SensorDirectionValue type : SensorDirectionValue.values()) 036 { 037 _map.put(type.value, type); 038 } 039 } 040 041 /** 042 * Gets SensorDirectionValue from specified value 043 * @param value Value of SensorDirectionValue 044 * @return SensorDirectionValue of specified value 045 */ 046 public static SensorDirectionValue valueOf(int value) 047 { 048 SensorDirectionValue retval = _map.get(value); 049 if(retval != null) return retval; 050 return SensorDirectionValue.values()[0]; 051 } 052}