Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MCP23017

This class drives a single MCP23017 GPIO extender

Hierarchy

  • MCP23017

Index

Constructors

constructor

  • Constructor.

    Parameters

    • bus: BusInterface

      an instance of i2c bus. May be closed at this point

    • Default value options: Options = {}

      options for the driver.

    Returns MCP23017

Methods

handle

  • Handle interupts received.

    Parameters

    Returns Promise<void>

init

  • init(): Promise<void>
  • Initialize the class

    Must be called with an open bus

    Returns Promise<void>

read

  • read(): Promise<number>
  • Reads the GPIO

    Returns Promise<number>

    the value of the GPIO Pin in a promise.

readConfigByte

  • readConfigByte(): Promise<number>
  • Reads the configuration byte of the chip

    Returns Promise<number>

    the value of the configuration as a byte in a promise.

register

setDirection

  • setDirection(pins: number, direction: Direction): Promise<void>
  • Sets the direction of a set of GPI/O pins and eventually pull-up status.

    Parameters

    Returns Promise<void>

    a promisse fullfilled when the operation is performed.

setPolarity

  • setPolarity(pins: number): Promise<void>
  • Set the polarity of the output (ie XOR with it)

    Parameters

    • pins: number

    Returns Promise<void>

setSeparate

  • setSeparate(separate: boolean): Promise<void>
  • Change the way register banks are organize.

    Parameters

    • separate: boolean

      set to true for registers organized as two independent banks and false for interleaved (default)

    Returns Promise<void>

    a promisse fullfilled when the operation is performed.

write

  • write(set: number, unset: number): Promise<void>
  • Modify the GPIO

    Parameters

    • set: number
    • unset: number

    Returns Promise<void>

Generated using TypeDoc