Adafruit MCP23017 Library
|
Class for MCP23008 I2C and MCP23S08 SPI variants. More...
#include <Adafruit_MCP23X08.h>
Public Member Functions | |
Adafruit_MCP23X08 () | |
default ctor. | |
void | enableAddrPins () |
Enable usage of HW address pins (A0, A1) on MCP23S08. More... | |
![]() | |
bool | begin_I2C (uint8_t i2c_addr=MCP23XXX_ADDR, TwoWire *wire=&Wire) |
Initialize MCP using I2C. More... | |
bool | begin_SPI (uint8_t cs_pin, SPIClass *theSPI=&SPI, uint8_t _hw_addr=0x00) |
Initialize MCP using hardware SPI. More... | |
bool | begin_SPI (int8_t cs_pin, int8_t sck_pin, int8_t miso_pin, int8_t mosi_pin, uint8_t _hw_addr=0x00) |
Initialize MCP using software SPI. More... | |
void | pinMode (uint8_t pin, uint8_t mode) |
Configures the specified pin to behave either as an input or an output. More... | |
uint8_t | digitalRead (uint8_t pin) |
Reads the value from a specified digital pin, either HIGH or LOW. More... | |
void | digitalWrite (uint8_t pin, uint8_t value) |
Write a HIGH or a LOW value to a digital pin. More... | |
uint8_t | readGPIO (uint8_t port=0) |
Bulk read all pins on a port. More... | |
void | writeGPIO (uint8_t value, uint8_t port=0) |
Bulk write all pins on a port. More... | |
void | setupInterrupts (bool mirroring, bool openDrain, uint8_t polarity) |
Configure the interrupt system. More... | |
void | setupInterruptPin (uint8_t pin, uint8_t mode=CHANGE) |
Enable interrupt and set mode for given pin. More... | |
void | disableInterruptPin (uint8_t pin) |
Disable interrupt for given pin. More... | |
void | clearInterrupts () |
Clear interrupts. NOTE:If using DEFVAL, INT clears only if interrupt condition does not exist. See Fig 1-7 in datasheet. | |
uint8_t | getLastInterruptPin () |
Gets the pin that caused the latest interrupt, from INTF, without clearing any interrupt flags. More... | |
uint16_t | getCapturedInterrupt () |
Get pin states captured at time of interrupt. More... | |
Additional Inherited Members | |
![]() | |
uint16_t | getRegister (uint8_t baseAddress, uint8_t port=0) |
helper to get register address More... | |
![]() | |
Adafruit_I2CDevice * | i2c_dev = nullptr |
Pointer to I2C bus interface. | |
Adafruit_SPIDevice * | spi_dev = nullptr |
Pointer to SPI bus interface. | |
uint8_t | pinCount |
Total number of GPIO pins. | |
uint8_t | hw_addr |
HW address matching A2/A1/A0 pins. | |
Class for MCP23008 I2C and MCP23S08 SPI variants.
void Adafruit_MCP23X08::enableAddrPins | ( | ) |
Enable usage of HW address pins (A0, A1) on MCP23S08.
Send this message as first message after chip init.
By default HW address pins are disabled. (Register IOCON, bit HAEN = 0 on chip reset)