Enum Class MCP23S17.Pin

java.lang.Object
java.lang.Enum<MCP23S17.Pin>
ch.ladestation.connectncharge.pui.MCP23S17.Pin
All Implemented Interfaces:
Serializable, Comparable<MCP23S17.Pin>, Constable
Enclosing class:
MCP23S17

public static enum MCP23S17.Pin extends Enum<MCP23S17.Pin>

Enum for each physical GPIO pin on the MCP23S17 chip.

The pins are renumbered so that port A's pins are in order as PIN0 through PIN7 and port B's pins are in order as PIN8 through PIN15.

Author:
Robert Russell
  • Enum Constant Details

  • Method Details

    • values

      public static MCP23S17.Pin[] 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 MCP23S17.Pin 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
    • getPinNumber

      public int getPinNumber()

      Get the pin number.

      The pins are numbered so that port A's pins are in order as 0 through 7 and port B's pins are in order as 8 through 15.

      Returns:
      the pin number.
    • isPortA

      public boolean isPortA()
      Get whether or not this Pin is in port A.
      Returns:
      whether or not this Pin is in port A.
    • isPortB

      public boolean isPortB()
      Get whether or not this Pin is in port B.
      Returns:
      whether or not this Pin is in port B.
    • fromPinNumber

      public static MCP23S17.Pin fromPinNumber(int pinNumber)
      Get the Pin corresponding to the given pin number.
      Parameters:
      pinNumber - the pin number.
      Returns:
      the Pin corresponding to the given pin number.
      Throws:
      IllegalArgumentException - if the given pin number is invalid (i.e. less than 0 or greater than 15).