001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.hal; 006 007/** 008 * Power HAL JNI Functions. 009 * 010 * @see "Power.h" 011 */ 012public class PowerJNI extends JNIWrapper { 013 /** 014 * Gets the roboRIO input voltage. 015 * 016 * @return the input voltage (volts) 017 * @see "HAL_GetVinVoltage" 018 */ 019 public static native double getVinVoltage(); 020 021 /** 022 * Gets the roboRIO input current. 023 * 024 * @return the input current (amps) 025 * @see "HAL_GetVinCurrent" 026 */ 027 public static native double getVinCurrent(); 028 029 /** 030 * Gets the 6V rail voltage. 031 * 032 * @return the 6V rail voltage (volts) 033 * @see "HAL_GetUserVoltage6V" 034 */ 035 public static native double getUserVoltage6V(); 036 037 /** 038 * Gets the 6V rail current. 039 * 040 * @return the 6V rail current (amps) 041 * @see "HAL_GetUserCurrent6V" 042 */ 043 public static native double getUserCurrent6V(); 044 045 /** 046 * Gets the active state of the 6V rail. 047 * 048 * @return true if the rail is active, otherwise false 049 * @see "HAL_GetUserActive6V" 050 */ 051 public static native boolean getUserActive6V(); 052 053 /** 054 * Gets the fault count for the 6V rail. 055 * 056 * @return the number of 6V fault counts 057 * @see "HAL_GetUserCurrentFaults6V" 058 */ 059 public static native int getUserCurrentFaults6V(); 060 061 /** 062 * Gets the 5V rail voltage. 063 * 064 * @return the 5V rail voltage (volts) 065 * @see "HAL_GetUserVoltage5V" 066 */ 067 public static native double getUserVoltage5V(); 068 069 /** 070 * Gets the 5V rail current. 071 * 072 * @return the 5V rail current (amps) 073 * @see "HAL_GetUserCurrent5V" 074 */ 075 public static native double getUserCurrent5V(); 076 077 /** 078 * Gets the active state of the 5V rail. 079 * 080 * @return true if the rail is active, otherwise false 081 * @see "HAL_GetUserActive5V" 082 */ 083 public static native boolean getUserActive5V(); 084 085 /** 086 * Gets the fault count for the 5V rail. 087 * 088 * @return the number of 5V fault counts 089 * @see "HAL_GetUserCurrentFaults5V" 090 */ 091 public static native int getUserCurrentFaults5V(); 092 093 /** 094 * Gets the 3V3 rail voltage. 095 * 096 * @return the 3V3 rail voltage (volts) 097 * @see "HAL_GetUserVoltage3V3" 098 */ 099 public static native double getUserVoltage3V3(); 100 101 /** 102 * Gets the 3V3 rail current. 103 * 104 * @return the 3V3 rail current (amps) 105 * @see "HAL_GetUserCurrent3V3" 106 */ 107 public static native double getUserCurrent3V3(); 108 109 /** 110 * Gets the active state of the 3V3 rail. 111 * 112 * @return true if the rail is active, otherwise false 113 * @see "HAL_GetUserActive3V3" 114 */ 115 public static native boolean getUserActive3V3(); 116 117 /** 118 * Gets the fault count for the 3V3 rail. 119 * 120 * @return the number of 3V3 fault counts 121 * @see "HAL_GetUserCurrentFaults3V3" 122 */ 123 public static native int getUserCurrentFaults3V3(); 124 125 /** 126 * Set the voltage the roboRIO will brownout and disable all outputs. 127 * 128 * <p>Note that this only does anything on the roboRIO 2. On the roboRIO it is a no-op. 129 * 130 * @param voltage The brownout voltage 131 * @see "HAL_SetBrownoutVoltage" 132 */ 133 public static native void setBrownoutVoltage(double voltage); 134 135 /** 136 * Get the current brownout voltage setting. 137 * 138 * @return The brownout voltage 139 * @see "HAL_GetBrownoutVoltage" 140 */ 141 public static native double getBrownoutVoltage(); 142}