001/*----------------------------------------------------------------------------*/
002/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
003/* Open Source Software - may be modified and shared by FRC teams. The code   */
004/* must be accompanied by the FIRST BSD license file in the root directory of */
005/* the project.                                                               */
006/*----------------------------------------------------------------------------*/
007
008package edu.wpi.first.wpilibj;
009
010import edu.wpi.first.wpilibj.hal.PowerJNI;
011
012public class ControllerPower {
013  /**
014   * Get the input voltage to the robot controller.
015   *
016   * @return The controller input voltage value in Volts
017   */
018  public static double getInputVoltage() {
019    return PowerJNI.getVinVoltage();
020  }
021
022  /**
023   * Get the input current to the robot controller.
024   *
025   * @return The controller input current value in Amps
026   */
027  public static double getInputCurrent() {
028    return PowerJNI.getVinCurrent();
029  }
030
031  /**
032   * Get the voltage of the 3.3V rail.
033   *
034   * @return The controller 3.3V rail voltage value in Volts
035   */
036  public static double getVoltage3V3() {
037    return PowerJNI.getUserVoltage3V3();
038  }
039
040  /**
041   * Get the current output of the 3.3V rail.
042   *
043   * @return The controller 3.3V rail output current value in Volts
044   */
045  public static double getCurrent3V3() {
046    return PowerJNI.getUserCurrent3V3();
047  }
048
049  /**
050   * Get the enabled state of the 3.3V rail. The rail may be disabled due to a controller brownout,
051   * a short circuit on the rail, or controller over-voltage.
052   *
053   * @return The controller 3.3V rail enabled value
054   */
055  public static boolean getEnabled3V3() {
056    return PowerJNI.getUserActive3V3();
057  }
058
059  /**
060   * Get the count of the total current faults on the 3.3V rail since the controller has booted.
061   *
062   * @return The number of faults
063   */
064  public static int getFaultCount3V3() {
065    return PowerJNI.getUserCurrentFaults3V3();
066  }
067
068  /**
069   * Get the voltage of the 5V rail.
070   *
071   * @return The controller 5V rail voltage value in Volts
072   */
073  public static double getVoltage5V() {
074    return PowerJNI.getUserVoltage5V();
075  }
076
077  /**
078   * Get the current output of the 5V rail.
079   *
080   * @return The controller 5V rail output current value in Amps
081   */
082  public static double getCurrent5V() {
083    return PowerJNI.getUserCurrent5V();
084  }
085
086  /**
087   * Get the enabled state of the 5V rail. The rail may be disabled due to a controller brownout, a
088   * short circuit on the rail, or controller over-voltage.
089   *
090   * @return The controller 5V rail enabled value
091   */
092  public static boolean getEnabled5V() {
093    return PowerJNI.getUserActive5V();
094  }
095
096  /**
097   * Get the count of the total current faults on the 5V rail since the controller has booted.
098   *
099   * @return The number of faults
100   */
101  public static int getFaultCount5V() {
102    return PowerJNI.getUserCurrentFaults5V();
103  }
104
105  /**
106   * Get the voltage of the 6V rail.
107   *
108   * @return The controller 6V rail voltage value in Volts
109   */
110  public static double getVoltage6V() {
111    return PowerJNI.getUserVoltage6V();
112  }
113
114  /**
115   * Get the current output of the 6V rail.
116   *
117   * @return The controller 6V rail output current value in Amps
118   */
119  public static double getCurrent6V() {
120    return PowerJNI.getUserCurrent6V();
121  }
122
123  /**
124   * Get the enabled state of the 6V rail. The rail may be disabled due to a controller brownout, a
125   * short circuit on the rail, or controller over-voltage.
126   *
127   * @return The controller 6V rail enabled value
128   */
129  public static boolean getEnabled6V() {
130    return PowerJNI.getUserActive6V();
131  }
132
133  /**
134   * Get the count of the total current faults on the 6V rail since the controller has booted.
135   *
136   * @return The number of faults
137   */
138  public static int getFaultCount6V() {
139    return PowerJNI.getUserCurrentFaults6V();
140  }
141}