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("MemberName")
008public class REVPHFaults {
009  public final boolean Channel0Fault;
010
011  public final boolean Channel1Fault;
012
013  public final boolean Channel2Fault;
014
015  public final boolean Channel3Fault;
016
017  public final boolean Channel4Fault;
018
019  public final boolean Channel5Fault;
020
021  public final boolean Channel6Fault;
022
023  public final boolean Channel7Fault;
024
025  public final boolean Channel8Fault;
026
027  public final boolean Channel9Fault;
028
029  public final boolean Channel10Fault;
030
031  public final boolean Channel11Fault;
032
033  public final boolean Channel12Fault;
034
035  public final boolean Channel13Fault;
036
037  public final boolean Channel14Fault;
038
039  public final boolean Channel15Fault;
040
041  public final boolean CompressorOverCurrent;
042
043  public final boolean CompressorOpen;
044
045  public final boolean SolenoidOverCurrent;
046
047  public final boolean Brownout;
048
049  public final boolean CanWarning;
050
051  public final boolean HardwareFault;
052
053  /**
054   * Called from HAL to construct.
055   *
056   * @param faults the fault bitfields
057   */
058  public REVPHFaults(int faults) {
059    Channel0Fault = (faults & 0x1) != 0;
060    Channel1Fault = (faults & 0x2) != 0;
061    Channel2Fault = (faults & 0x4) != 0;
062    Channel3Fault = (faults & 0x8) != 0;
063    Channel4Fault = (faults & 0x10) != 0;
064    Channel5Fault = (faults & 0x20) != 0;
065    Channel6Fault = (faults & 0x40) != 0;
066    Channel7Fault = (faults & 0x80) != 0;
067    Channel8Fault = (faults & 0x100) != 0;
068    Channel9Fault = (faults & 0x200) != 0;
069    Channel10Fault = (faults & 0x400) != 0;
070    Channel11Fault = (faults & 0x800) != 0;
071    Channel12Fault = (faults & 0x1000) != 0;
072    Channel13Fault = (faults & 0x2000) != 0;
073    Channel14Fault = (faults & 0x4000) != 0;
074    Channel15Fault = (faults & 0x8000) != 0;
075    CompressorOverCurrent = (faults & 0x8000) != 0;
076    CompressorOpen = (faults & 0x10000) != 0;
077    SolenoidOverCurrent = (faults & 0x20000) != 0;
078    Brownout = (faults & 0x40000) != 0;
079    CanWarning = (faults & 0x80000) != 0;
080    HardwareFault = (faults & 0x100000) != 0;
081  }
082}