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 PowerDistributionFaults {
009  public final boolean Channel0BreakerFault;
010
011  public final boolean Channel1BreakerFault;
012
013  public final boolean Channel2BreakerFault;
014
015  public final boolean Channel3BreakerFault;
016
017  public final boolean Channel4BreakerFault;
018
019  public final boolean Channel5BreakerFault;
020
021  public final boolean Channel6BreakerFault;
022
023  public final boolean Channel7BreakerFault;
024
025  public final boolean Channel8BreakerFault;
026
027  public final boolean Channel9BreakerFault;
028
029  public final boolean Channel10BreakerFault;
030
031  public final boolean Channel11BreakerFault;
032
033  public final boolean Channel12BreakerFault;
034
035  public final boolean Channel13BreakerFault;
036
037  public final boolean Channel14BreakerFault;
038
039  public final boolean Channel15BreakerFault;
040
041  public final boolean Channel16BreakerFault;
042
043  public final boolean Channel17BreakerFault;
044
045  public final boolean Channel18BreakerFault;
046
047  public final boolean Channel19BreakerFault;
048
049  public final boolean Channel20BreakerFault;
050
051  public final boolean Channel21BreakerFault;
052
053  public final boolean Channel22BreakerFault;
054
055  public final boolean Channel23BreakerFault;
056
057  public final boolean Brownout;
058
059  public final boolean CanWarning;
060
061  public final boolean HardwareFault;
062
063  /**
064   * Constructs from a bitfield.
065   *
066   * @param faults faults
067   */
068  public PowerDistributionFaults(int faults) {
069    Channel0BreakerFault = (faults & 0x1) != 0;
070    Channel1BreakerFault = (faults & 0x2) != 0;
071    Channel2BreakerFault = (faults & 0x4) != 0;
072    Channel3BreakerFault = (faults & 0x8) != 0;
073    Channel4BreakerFault = (faults & 0x10) != 0;
074    Channel5BreakerFault = (faults & 0x20) != 0;
075    Channel6BreakerFault = (faults & 0x40) != 0;
076    Channel7BreakerFault = (faults & 0x80) != 0;
077    Channel8BreakerFault = (faults & 0x100) != 0;
078    Channel9BreakerFault = (faults & 0x200) != 0;
079    Channel10BreakerFault = (faults & 0x400) != 0;
080    Channel11BreakerFault = (faults & 0x800) != 0;
081    Channel12BreakerFault = (faults & 0x1000) != 0;
082    Channel13BreakerFault = (faults & 0x2000) != 0;
083    Channel14BreakerFault = (faults & 0x4000) != 0;
084    Channel15BreakerFault = (faults & 0x8000) != 0;
085    Channel16BreakerFault = (faults & 0x10000) != 0;
086    Channel17BreakerFault = (faults & 0x20000) != 0;
087    Channel18BreakerFault = (faults & 0x40000) != 0;
088    Channel19BreakerFault = (faults & 0x80000) != 0;
089    Channel20BreakerFault = (faults & 0x100000) != 0;
090    Channel21BreakerFault = (faults & 0x200000) != 0;
091    Channel22BreakerFault = (faults & 0x400000) != 0;
092    Channel23BreakerFault = (faults & 0x800000) != 0;
093    Brownout = (faults & 0x1000000) != 0;
094    CanWarning = (faults & 0x2000000) != 0;
095    HardwareFault = (faults & 0x4000000) != 0;
096  }
097}