Dilbert
Firmware for the Dilbert interactive badge.
|
Public Member Functions | |
void | begin (uint8_t addr) |
void | begin (void) |
void | pinMode (uint8_t p, uint8_t d) |
void | digitalWrite (uint8_t p, uint8_t d) |
void | pullUp (uint8_t p, uint8_t d) |
uint8_t | digitalRead (uint8_t p) |
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 p, uint8_t mode) |
uint8_t | getLastInterruptPin () |
uint8_t | getLastInterruptPinValue () |
void Adafruit_MCP23017::begin | ( | uint8_t | addr | ) |
Initializes the MCP23017 given its HW selected address, see datasheet for Address selection.
void Adafruit_MCP23017::begin | ( | void | ) |
Initializes the default MCP23017, with 000 for the configurable part of the address
void Adafruit_MCP23017::pinMode | ( | uint8_t | p, |
uint8_t | d | ||
) |
Sets the pin mode to either INPUT or OUTPUT
uint8_t Adafruit_MCP23017::readGPIO | ( | uint8_t | b | ) |
Read a single port, A or B, and return its current 8 bit value. Parameter b should be 0 for GPIOA, and 1 for GPIOB.
uint16_t Adafruit_MCP23017::readGPIOAB | ( | ) |
Reads all 16 pins (port A and B) into a single 16 bits variable.
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.
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 will OR both INTA and INTB pins. Opendrain will set the INT pin to value or open drain. polarity will set LOW or HIGH on interrupt. Default values after Power On Reset are: (false,flase, 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.
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.