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