edu.wpi.first.wpilibj

## Class SolenoidBase

- java.lang.Object
- - edu.wpi.first.wpilibj.SensorBase
  - - edu.wpi.first.wpilibj.SolenoidBase

- Direct Known Subclasses:
    DoubleSolenoid, Solenoid

      public abstract class SolenoidBase
      extends SensorBase

  SolenoidBase class is the common base class for the `Solenoid` and `DoubleSolenoid` classes.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `m_moduleNumber`

    - ### Fields inherited from class edu.wpi.first.wpilibj.SensorBase

      `kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SolenoidBase(int moduleNumber)` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearAllPCMStickyFaults()` Clear ALL sticky faults inside PCM that Compressor is wired to.
    `static void` | `clearAllPCMStickyFaults(int moduleNumber)` Clear ALL sticky faults inside PCM that Compressor is wired to.
    `int` | `getAll()` Read all 8 solenoids from the module used by this solenoid as a single byte.
    `static int` | `getAll(int moduleNumber)` Read all 8 solenoids from the specified module as a single byte.
    `int` | `getPCMSolenoidBlackList()` Reads complete solenoid blacklist for all 8 solenoids as a single byte.
    `static int` | `getPCMSolenoidBlackList(int moduleNumber)` Reads complete solenoid blacklist for all 8 solenoids as a single byte.
    `boolean` | `getPCMSolenoidVoltageFault()` The common highside solenoid voltage rail is too low, most likely a solenoid channel is shorted.
    `static boolean` | `getPCMSolenoidVoltageFault(int moduleNumber)` The common highside solenoid voltage rail is too low, most likely a solenoid channel is shorted.
    `boolean` | `getPCMSolenoidVoltageStickyFault()` If true, the common highside solenoid voltage rail is too low, most likely a solenoid channel is shorted.
    `static boolean` | `getPCMSolenoidVoltageStickyFault(int moduleNumber)` If true, the common highside solenoid voltage rail is too low, most likely a solenoid channel is shorted.

    - ### Methods inherited from class edu.wpi.first.wpilibj.SensorBase

      `checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, free, getDefaultSolenoidModule, setDefaultSolenoidModule`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### m_moduleNumber

          protected final int m_moduleNumber

  - ### Constructor Detail

    - #### SolenoidBase

          public SolenoidBase(int moduleNumber)

      Constructor.
      Parameters:
        `moduleNumber` - The PCM CAN ID

  - ### Method Detail

    - #### getAll

          public static int getAll(int moduleNumber)

      Read all 8 solenoids from the specified module as a single byte.
      Parameters:
        `moduleNumber` - the module number to read
      Returns:
        The current value of all 8 solenoids on the module.

    - #### getAll

          public int getAll()

      Read all 8 solenoids from the module used by this solenoid as a single byte.
      Returns:
        The current value of all 8 solenoids on this module.

    - #### getPCMSolenoidBlackList

          public static int getPCMSolenoidBlackList(int moduleNumber)

      Reads complete solenoid blacklist for all 8 solenoids as a single byte. If a solenoid is shorted, it is added to the blacklist and disabled until power cycle, or until faults are cleared.
      Parameters:
        `moduleNumber` - the module number to read
      Returns:
        The solenoid blacklist of all 8 solenoids on the module.
      See Also:
        `clearAllPCMStickyFaults()`

    - #### getPCMSolenoidBlackList

          public int getPCMSolenoidBlackList()

      Reads complete solenoid blacklist for all 8 solenoids as a single byte. If a solenoid is shorted, it is added to the blacklist and disabled until power cycle, or until faults are cleared.
      Returns:
        The solenoid blacklist of all 8 solenoids on the module.
      See Also:
        `clearAllPCMStickyFaults()`

    - #### getPCMSolenoidVoltageStickyFault

          public static boolean getPCMSolenoidVoltageStickyFault(int moduleNumber)

      If true, the common highside solenoid voltage rail is too low, most likely a solenoid channel is shorted.
      Parameters:
        `moduleNumber` - the module number to read
      Returns:
        true if PCM sticky fault is set

    - #### getPCMSolenoidVoltageStickyFault

          public boolean getPCMSolenoidVoltageStickyFault()

      If true, the common highside solenoid voltage rail is too low, most likely a solenoid channel is shorted.
      Returns:
        true if PCM sticky fault is set

    - #### getPCMSolenoidVoltageFault

          public static boolean getPCMSolenoidVoltageFault(int moduleNumber)

      The common highside solenoid voltage rail is too low, most likely a solenoid channel is shorted.
      Parameters:
        `moduleNumber` - the module number to read
      Returns:
        true if PCM is in fault state.

    - #### getPCMSolenoidVoltageFault

          public boolean getPCMSolenoidVoltageFault()

      The common highside solenoid voltage rail is too low, most likely a solenoid channel is shorted.
      Returns:
        true if PCM is in fault state.

    - #### clearAllPCMStickyFaults

          public static void clearAllPCMStickyFaults(int moduleNumber)

      Clear ALL sticky faults inside PCM that Compressor is wired to.

      If a sticky fault is set, then it will be persistently cleared. Compressor drive maybe momentarily disable while flags are being cleared. Care should be taken to not call this too frequently, otherwise normal compressor functionality may be prevented.

      If no sticky faults are set then this call will have no effect.

      Parameters:
        `moduleNumber` - the module number to read

    - #### clearAllPCMStickyFaults

          public void clearAllPCMStickyFaults()

      Clear ALL sticky faults inside PCM that Compressor is wired to.

      If a sticky fault is set, then it will be persistently cleared. Compressor drive maybe momentarily disable while flags are being cleared. Care should be taken to not call this too frequently, otherwise normal compressor functionality may be prevented.

      If no sticky faults are set then this call will have no effect.