001/* Copyright (C) Cross The Road Electronics 2024 */ 002/* 003 * Software License Agreement 004 * 005 * Copyright (C) Cross The Road Electronics. All rights 006 * reserved. 007 * 008 * Cross The Road Electronics (CTRE) licenses to you the right to 009 * use, publish, and distribute copies of CRF (Cross The Road) firmware files (*.crf) and Software 010 * API Libraries ONLY when in use with Cross The Road Electronics hardware products. 011 * 012 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT 013 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT 014 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A 015 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL 016 * CROSS THE ROAD ELECTRONICS BE LIABLE FOR ANY INCIDENTAL, SPECIAL, 017 * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF 018 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS 019 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE 020 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER 021 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT 022 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE 023 */ 024package com.ctre.phoenix.unmanaged; 025 026/** 027 * Handles enabling when used in a non-FRC manner 028 */ 029public class Unmanaged { 030 /** 031 * Feed the robot enable. 032 * This function does nothing on a roborio during FRC use. 033 * <p> 034 * If running an application in simulation, creating a WPI_* 035 * object automatically enables actuators. 036 * Otherwise, call this to enable actuators. 037 * 038 * @param timeoutMs Timeout before disabling 039 */ 040 public static void feedEnable(int timeoutMs) { 041 UnmanagedJNI.JNI_FeedEnable(timeoutMs); 042 } 043 044 /** 045 * @return true if non-FRC enabled 046 */ 047 public static boolean getEnableState() { 048 return UnmanagedJNI.JNI_GetEnableState(); 049 } 050 051 /** 052 * @return Phoenix version 053 */ 054 public static int getPhoenixVersion() { 055 return UnmanagedJNI.JNI_GetPhoenixVersion(); 056 } 057 058 /** 059 * Calling this function will load and start 060 * the Phoenix background tasks. 061 * 062 * This can be useful if you need the 063 * Enable/Disable functionality for CAN devices 064 * but aren't using any of the CAN device classes. 065 * 066 * This function does NOT need to be called if 067 * you are using any of the Phoenix CAN device classes. 068 */ 069 public static void loadPhoenix() { 070 UnmanagedJNI.JNI_LoadPhoenix(); 071 } 072 073 /** 074 * Sets the duration of the delay before starting 075 * the Phoenix diagnostics server. 076 * 077 * @param startTimeSeconds Magnitude of the delay (in seconds) before 078 * starting the server. 079 * A value of 0 will start the server immediately. 080 * A negative value will signal the server 081 * to shutdown or never start. 082 */ 083 public static void setPhoenixDiagnosticsStartTime(int startTimeSeconds){ 084 UnmanagedJNI.JNI_SetPhoenixDiagnosticsStartTime(startTimeSeconds); 085 } 086}