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@SuppressWarnings("AbbreviationAsWordInName")
008public class REVPHStickyFaults {
009  @SuppressWarnings("MemberName")
010  public final boolean CompressorOverCurrent;
011
012  @SuppressWarnings("MemberName")
013  public final boolean CompressorOpen;
014
015  @SuppressWarnings("MemberName")
016  public final boolean SolenoidOverCurrent;
017
018  @SuppressWarnings("MemberName")
019  public final boolean Brownout;
020
021  @SuppressWarnings("MemberName")
022  public final boolean CanWarning;
023
024  @SuppressWarnings("MemberName")
025  public final boolean CanBusOff;
026
027  @SuppressWarnings("MemberName")
028  public final boolean HasReset;
029
030  /**
031   * Called from HAL.
032   *
033   * @param faults sticky fault bit mask
034   */
035  public REVPHStickyFaults(int faults) {
036    CompressorOverCurrent = (faults & 0x1) != 0;
037    CompressorOpen = (faults & 0x2) != 0;
038    SolenoidOverCurrent = (faults & 0x4) != 0;
039    Brownout = (faults & 0x8) != 0;
040    CanWarning = (faults & 0x10) != 0;
041    CanBusOff = (faults & 0x20) != 0;
042    HasReset = (faults & 0x40) != 0;
043  }
044}