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 * Update mode of the CANrange. The CANrange supports short-range and long-range 013 * detection at various update frequencies. 014 */ 015public enum UpdateModeValue 016{ 017 /** 018 * Updates distance/proximity at 100hz using short-range detection mode. 019 */ 020 ShortRange100Hz(0), 021 /** 022 * Uses short-range detection mode for improved detection under high ambient 023 * infrared light conditions. Uses user-specified update frequency. 024 */ 025 ShortRangeUserFreq(1), 026 /** 027 * Uses long-range detection mode and user-specified update frequency. 028 */ 029 LongRangeUserFreq(2),; 030 031 public final int value; 032 033 UpdateModeValue(int initValue) 034 { 035 this.value = initValue; 036 } 037 038 private static HashMap<Integer, UpdateModeValue> _map = null; 039 static 040 { 041 _map = new HashMap<Integer, UpdateModeValue>(); 042 for (UpdateModeValue type : UpdateModeValue.values()) 043 { 044 _map.put(type.value, type); 045 } 046 } 047 048 /** 049 * Gets UpdateModeValue from specified value 050 * @param value Value of UpdateModeValue 051 * @return UpdateModeValue of specified value 052 */ 053 public static UpdateModeValue valueOf(int value) 054 { 055 UpdateModeValue retval = _map.get(value); 056 if (retval != null) return retval; 057 return UpdateModeValue.values()[0]; 058 } 059}