Enum Class DataSource

java.lang.Object
java.lang.Enum<DataSource>
com.reduxrobotics.sensors.canandcolor.DataSource
All Implemented Interfaces:
DigoutPinConfig, Serializable, Comparable<DataSource>, Constable

public enum DataSource extends Enum<DataSource> implements DigoutPinConfig
Data sources that digout channels can use to perform comparisons or output data directly as a duty cycle on GPIO pin DIG-2.

All values are typically considered to be scaled between 0.0 and 1.0. For proximity, red, green, blue, white, and HSV, the values that digout slots consider (and what the Rio would read if it read the PWM outputs), they are generally equivalent to the values read through functions like Canandcolor.getProximity() or Canandcolor.getColor().

  • Enum Constant Details

    • kZero

      public static final DataSource kZero
      Zero value (always reads zero)
    • kProximity

      public static final DataSource kProximity
      Proximity value
    • kRed

      public static final DataSource kRed
      Red reading
    • kGreen

      public static final DataSource kGreen
      Green reading
    • kBlue

      public static final DataSource kBlue
      Blue reading
    • kHue

      public static final DataSource kHue
      Hue reading
    • kSaturation

      public static final DataSource kSaturation
      Saturation reading
    • kValue

      public static final DataSource kValue
      Value reading
  • Method Details

    • values

      public static DataSource[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DataSource valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getIndex

      public int getIndex()
      Returns the associated index number for the enum (used in serialization)
      Returns:
      the associated index number for the enum.
    • fromIndex

      public static DataSource fromIndex(int v)
      Fetches the enum associated with the index value.
      Parameters:
      v - int containing index value -- if index > max value, the modulo is used
      Returns:
      corresponding enum
    • toOutputSettingData

      public long toOutputSettingData()
      Description copied from interface: DigoutPinConfig
      Serializes the digout config into a value writeable to device settings.
      Specified by:
      toOutputSettingData in interface DigoutPinConfig
      Returns:
      48-bit long
    • equals

      public boolean equals(DigoutPinConfig other)
      Description copied from interface: DigoutPinConfig
      Returns if two configurations are equivalent.
      Specified by:
      equals in interface DigoutPinConfig
      Parameters:
      other - other config
      Returns:
      true if equal