edu.wpi.first.wpilibj

## Class SensorBase

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

- Direct Known Subclasses:
    ADXL345_I2C, ADXL345_SPI, ADXL362, AnalogAccelerometer, AnalogInput, AnalogOutput, Compressor, Counter, DigitalGlitchFilter, Encoder, GyroBase, I2C, InterruptableSensorBase, PowerDistributionPanel, PWM, Relay, SolenoidBase, SPI, Ultrasonic

      public abstract class SensorBase
      extends java.lang.Object

  Base class for all sensors. Stores most recent status information as well as containing utility functions for checking channels and error processing.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `kAnalogInputChannels` Number of analog input channels per roboRIO.
    `static int` | `kAnalogOutputChannels` Number of analog output channels per roboRIO.
    `static int` | `kDigitalChannels` Number of digital channels per roboRIO.
    `static int` | `kPCMModules` Number of PCM Modules.
    `static int` | `kPDPChannels` Number of power distribution channels per PDP.
    `static int` | `kPDPModules` Number of power distribution modules per PDP.
    `static int` | `kPwmChannels` Number of PWM channels per roboRIO.
    `static int` | `kRelayChannels` Number of relay channels per roboRIO.
    `static int` | `kSolenoidChannels` Number of solenoid channels per module.
    `static int` | `kSystemClockTicksPerMicrosecond` Ticks per microsecond.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SensorBase()` Creates an instance of the sensor base and gets an FPGA handle.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static void` | `checkAnalogInputChannel(int channel)` Check that the analog input number is value.
    `protected static void` | `checkAnalogOutputChannel(int channel)` Check that the analog input number is value.
    `protected static void` | `checkDigitalChannel(int channel)` Check that the digital channel number is valid.
    `protected static void` | `checkPDPChannel(int channel)` Verify that the power distribution channel number is within limits.
    `protected static void` | `checkPDPModule(int module)` Verify that the PDP module number is within limits.
    `protected static void` | `checkPWMChannel(int channel)` Check that the digital channel number is valid.
    `protected static void` | `checkRelayChannel(int channel)` Check that the digital channel number is valid.
    `protected static void` | `checkSolenoidChannel(int channel)` Verify that the solenoid channel number is within limits.
    `protected static void` | `checkSolenoidModule(int moduleNumber)` Verify that the solenoid module is correct.
    `void` | `free()` Free the resources used by this object.
    `static int` | `getDefaultSolenoidModule()` Get the number of the default solenoid module.
    `static void` | `setDefaultSolenoidModule(int moduleNumber)` Set the default location for the Solenoid module.

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

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

- - ### Field Detail

    - #### kSystemClockTicksPerMicrosecond

          public static final int kSystemClockTicksPerMicrosecond

      Ticks per microsecond.

    - #### kDigitalChannels

          public static final int kDigitalChannels

      Number of digital channels per roboRIO.

    - #### kAnalogInputChannels

          public static final int kAnalogInputChannels

      Number of analog input channels per roboRIO.

    - #### kAnalogOutputChannels

          public static final int kAnalogOutputChannels

      Number of analog output channels per roboRIO.

    - #### kSolenoidChannels

          public static final int kSolenoidChannels

      Number of solenoid channels per module.

    - #### kPwmChannels

          public static final int kPwmChannels

      Number of PWM channels per roboRIO.

    - #### kRelayChannels

          public static final int kRelayChannels

      Number of relay channels per roboRIO.

    - #### kPDPChannels

          public static final int kPDPChannels

      Number of power distribution channels per PDP.

    - #### kPDPModules

          public static final int kPDPModules

      Number of power distribution modules per PDP.

    - #### kPCMModules

          public static final int kPCMModules

      Number of PCM Modules.

  - ### Constructor Detail

    - #### SensorBase

          public SensorBase()

      Creates an instance of the sensor base and gets an FPGA handle.

  - ### Method Detail

    - #### setDefaultSolenoidModule

          public static void setDefaultSolenoidModule(int moduleNumber)

      Set the default location for the Solenoid module.
      Parameters:
        `moduleNumber` - The number of the solenoid module to use.

    - #### checkSolenoidModule

          protected static void checkSolenoidModule(int moduleNumber)

      Verify that the solenoid module is correct.
      Parameters:
        `moduleNumber` - The solenoid module module number to check.

    - #### checkDigitalChannel

          protected static void checkDigitalChannel(int channel)

      Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 0-based.
      Parameters:
        `channel` - The channel number to check.

    - #### checkRelayChannel

          protected static void checkRelayChannel(int channel)

      Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 0-based.
      Parameters:
        `channel` - The channel number to check.

    - #### checkPWMChannel

          protected static void checkPWMChannel(int channel)

      Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 0-based.
      Parameters:
        `channel` - The channel number to check.

    - #### checkAnalogInputChannel

          protected static void checkAnalogInputChannel(int channel)

      Check that the analog input number is value. Verify that the analog input number is one of the legal channel numbers. Channel numbers are 0-based.
      Parameters:
        `channel` - The channel number to check.

    - #### checkAnalogOutputChannel

          protected static void checkAnalogOutputChannel(int channel)

      Check that the analog input number is value. Verify that the analog input number is one of the legal channel numbers. Channel numbers are 0-based.
      Parameters:
        `channel` - The channel number to check.

    - #### checkSolenoidChannel

          protected static void checkSolenoidChannel(int channel)

      Verify that the solenoid channel number is within limits. Channel numbers are 0-based.
      Parameters:
        `channel` - The channel number to check.

    - #### checkPDPChannel

          protected static void checkPDPChannel(int channel)

      Verify that the power distribution channel number is within limits. Channel numbers are 0-based.
      Parameters:
        `channel` - The channel number to check.

    - #### checkPDPModule

          protected static void checkPDPModule(int module)

      Verify that the PDP module number is within limits. module numbers are 0-based.
      Parameters:
        `module` - The module number to check.

    - #### getDefaultSolenoidModule

          public static int getDefaultSolenoidModule()

      Get the number of the default solenoid module.
      Returns:
        The number of the default solenoid module.

    - #### free

          public void free()

      Free the resources used by this object.