LCC Fusion Project 1.0
LCC Automation
Loading...
Searching...
No Matches
Adafruit_MCP23017 Class Reference

MCP23017 main class. More...

#include <Adafruit_MCP23017.h>

Public Member Functions

void begin (uint8_t addr, TwoWire *theWire=&Wire)
 
void begin (TwoWire *theWire=&Wire)
 
void pinMode (uint8_t p, uint8_t d)
 
void digitalWrite (uint8_t p, uint8_t d)
 Writes to a pin on the MCP23017. More...
 
void pullUp (uint8_t p, uint8_t d)
 Enables the pull-up resistor on the specified pin. More...
 
uint8_t digitalRead (uint8_t p)
 Reads the specified pin. More...
 
void writeGPIOAB (uint16_t)
 
uint16_t readGPIOAB ()
 
uint8_t readGPIO (uint8_t b)
 
void setupInterrupts (uint8_t mirroring, uint8_t open, uint8_t polarity)
 
void setupInterruptPin (uint8_t pin, uint8_t mode)
 
void disableInterruptPin (uint8_t pin)
 
uint8_t getLastInterruptPin ()
 Gets the last interrupt pin. More...
 
uint8_t getLastInterruptPinValue ()
 Gets the value of the last interrupt pin. More...
 

Detailed Description

MCP23017 main class.

Definition at line 24 of file Adafruit_MCP23017.h.

Member Function Documentation

◆ begin() [1/2]

void Adafruit_MCP23017::begin ( TwoWire *  theWire = &Wire)

Initializes the default MCP23017, with 000 for the configurable part of the address

Parameters
theWirethe I2C object to use, defaults to &Wire

Definition at line 147 of file Adafruit_MCP23017.cpp.

Here is the call graph for this function:

◆ begin() [2/2]

void Adafruit_MCP23017::begin ( uint8_t  addr,
TwoWire *  theWire = &Wire 
)

Initializes the MCP23017 given its HW selected address, see datasheet for Address selection.

Parameters
addrSelected address
theWirethe I2C object to use, defaults to &Wire

Definition at line 119 of file Adafruit_MCP23017.cpp.

Here is the caller graph for this function:

◆ digitalRead()

uint8_t Adafruit_MCP23017::digitalRead ( uint8_t  pin)

Reads the specified pin.

Parameters
pinPin to read
Returns
Value of the pin

Definition at line 247 of file Adafruit_MCP23017.cpp.

Here is the caller graph for this function:

◆ digitalWrite()

void Adafruit_MCP23017::digitalWrite ( uint8_t  pin,
uint8_t  d 
)

Writes to a pin on the MCP23017.

Parameters
pinPin to write to
dWhat to write to the pin

Definition at line 217 of file Adafruit_MCP23017.cpp.

◆ disableInterruptPin()

void Adafruit_MCP23017::disableInterruptPin ( uint8_t  pin)

Disable a pin for interrupt.

Parameters
pinPin to set

Definition at line 313 of file Adafruit_MCP23017.cpp.

◆ getLastInterruptPin()

uint8_t Adafruit_MCP23017::getLastInterruptPin ( )

Gets the last interrupt pin.

Returns
Returns the last interrupt pin

Definition at line 322 of file Adafruit_MCP23017.cpp.

Here is the caller graph for this function:

◆ getLastInterruptPinValue()

uint8_t Adafruit_MCP23017::getLastInterruptPinValue ( )

Gets the value of the last interrupt pin.

Returns
Returns the value of the last interrupt pin

Definition at line 343 of file Adafruit_MCP23017.cpp.

Here is the call graph for this function:

◆ pinMode()

void Adafruit_MCP23017::pinMode ( uint8_t  p,
uint8_t  d 
)

Sets the pin mode to either INPUT or OUTPUT

Parameters
pPin to set
dMode to set the pin

Definition at line 154 of file Adafruit_MCP23017.cpp.

Here is the caller graph for this function:

◆ pullUp()

void Adafruit_MCP23017::pullUp ( uint8_t  p,
uint8_t  d 
)

Enables the pull-up resistor on the specified pin.

Parameters
pPin to set
dValue to set the pin

Definition at line 238 of file Adafruit_MCP23017.cpp.

Here is the caller graph for this function:

◆ readGPIO()

uint8_t Adafruit_MCP23017::readGPIO ( uint8_t  b)

Read a single port, A or B, and return its current 8 bit value.

Parameters
bDecided what gpio to use. Should be 0 for GPIOA, and 1 for GPIOB.
Returns
Returns the b bit value of the port

Definition at line 185 of file Adafruit_MCP23017.cpp.

◆ readGPIOAB()

uint16_t Adafruit_MCP23017::readGPIOAB ( )

Reads all 16 pins (port A and B) into a single 16 bits variable.

Returns
Returns the 16 bit variable representing all 16 pins

Definition at line 162 of file Adafruit_MCP23017.cpp.

◆ setupInterruptPin()

void Adafruit_MCP23017::setupInterruptPin ( uint8_t  pin,
uint8_t  mode 
)

Set's up a pin for interrupt. uses arduino MODEs: CHANGE, FALLING, RISING.

Note that the interrupt condition finishes when you read the information about the port / value that caused the interrupt or you read the port itself. Check the datasheet can be confusing.

Parameters
pinPin to set
modeMode to set the pin

Definition at line 290 of file Adafruit_MCP23017.cpp.

◆ setupInterrupts()

void Adafruit_MCP23017::setupInterrupts ( uint8_t  mirroring,
uint8_t  openDrain,
uint8_t  polarity 
)

Configures the interrupt system. both port A and B are assigned the same configuration.

Parameters
mirroringMirroring will OR both INTA and INTB pins.
openDrainOpendrain will set the INT pin to value or open drain.
polaritypolarity will set LOW or HIGH on interrupt. Default values after Power On Reset are: (false, false, LOW) If you are connecting the INTA/B pin to arduino 2/3, you should configure the interupt handling as FALLING with the default configuration.

Definition at line 263 of file Adafruit_MCP23017.cpp.

◆ writeGPIOAB()

void Adafruit_MCP23017::writeGPIOAB ( uint16_t  ba)

Writes all the pins in one go. This method is very useful if you are implementing a multiplexed matrix and want to get a decent refresh rate.

Definition at line 204 of file Adafruit_MCP23017.cpp.


The documentation for this class was generated from the following files: