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.platform.can; 025 026/** 027 * Configures the can interface for API 028 */ 029public class PlatformCAN { 030 /** 031 * Set CAN interface 032 * @param canInterface Can interface to set, example "can0". 033 * @return ErrorCode generated by function 034 * @deprecated pass the CAN interface to device constructors instead, 035 * or call registerCANbus 036 */ 037 @Deprecated 038 public static int setCANInterface(char[] canInterface) { 039 return registerCANbus(canInterface); 040 } 041 /** 042 * Registers a non-compliant CANbus 043 * @param canbus CANbus to register. Linux example: "can0". 044 * @return ErrorCode generated by function 045 */ 046 public static int registerCANbus(char[] canbus) { 047 return PlatformCANJNI.JNI_RegisterCANbus(canbus); 048 } 049 /** 050 * Set Autocache state 051 * @param state state of autocache 052 */ 053 public static void setAutocacheLevel(AutocacheState state){ 054 PlatformCANJNI.JNI_SetAutocacheLevel(state.value); 055 } 056}