|
LCC Fusion Project 1.0
LCC Automation
|
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... | |
MCP23017 main class.
Definition at line 24 of file Adafruit_MCP23017.h.
| void Adafruit_MCP23017::begin | ( | TwoWire * | theWire = &Wire | ) |
Initializes the default MCP23017, with 000 for the configurable part of the address
| theWire | the I2C object to use, defaults to &Wire |
Definition at line 147 of file Adafruit_MCP23017.cpp.

| void Adafruit_MCP23017::begin | ( | uint8_t | addr, |
| TwoWire * | theWire = &Wire |
||
| ) |
Initializes the MCP23017 given its HW selected address, see datasheet for Address selection.
| addr | Selected address |
| theWire | the I2C object to use, defaults to &Wire |
Definition at line 119 of file Adafruit_MCP23017.cpp.

| uint8_t Adafruit_MCP23017::digitalRead | ( | uint8_t | pin | ) |
Reads the specified pin.
| pin | Pin to read |
Definition at line 247 of file Adafruit_MCP23017.cpp.

| void Adafruit_MCP23017::digitalWrite | ( | uint8_t | pin, |
| uint8_t | d | ||
| ) |
Writes to a pin on the MCP23017.
| pin | Pin to write to |
| d | What to write to the pin |
Definition at line 217 of file Adafruit_MCP23017.cpp.
| void Adafruit_MCP23017::disableInterruptPin | ( | uint8_t | pin | ) |
Disable a pin for interrupt.
| pin | Pin to set |
Definition at line 313 of file Adafruit_MCP23017.cpp.
| uint8_t Adafruit_MCP23017::getLastInterruptPin | ( | ) |
Gets the last interrupt pin.
Definition at line 322 of file Adafruit_MCP23017.cpp.

| uint8_t Adafruit_MCP23017::getLastInterruptPinValue | ( | ) |
Gets the value of the last interrupt pin.
Definition at line 343 of file Adafruit_MCP23017.cpp.

| void Adafruit_MCP23017::pinMode | ( | uint8_t | p, |
| uint8_t | d | ||
| ) |
Sets the pin mode to either INPUT or OUTPUT
| p | Pin to set |
| d | Mode to set the pin |
Definition at line 154 of file Adafruit_MCP23017.cpp.

| void Adafruit_MCP23017::pullUp | ( | uint8_t | p, |
| uint8_t | d | ||
| ) |
Enables the pull-up resistor on the specified pin.
| p | Pin to set |
| d | Value to set the pin |
Definition at line 238 of file Adafruit_MCP23017.cpp.

| uint8_t Adafruit_MCP23017::readGPIO | ( | uint8_t | b | ) |
Read a single port, A or B, and return its current 8 bit value.
| b | Decided what gpio to use. Should be 0 for GPIOA, and 1 for GPIOB. |
Definition at line 185 of file Adafruit_MCP23017.cpp.
| uint16_t Adafruit_MCP23017::readGPIOAB | ( | ) |
Reads all 16 pins (port A and B) into a single 16 bits variable.
Definition at line 162 of file Adafruit_MCP23017.cpp.
| 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.
| pin | Pin to set |
| mode | Mode to set the pin |
Definition at line 290 of file Adafruit_MCP23017.cpp.
| 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.
| mirroring | Mirroring will OR both INTA and INTB pins. |
| openDrain | Opendrain will set the INT pin to value or open drain. |
| polarity | polarity 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.
| 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.