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