PU2CLR MCP23008 Arduino Library  1.0.7
Arduino Library for MCP23008 Device - By Ricardo Lima Caratti
MCP Class Reference

#include <pu2clr_mcp23008.h>

Public Member Functions

uint8_t lookForDevice ()
 Look for MCP23008 device I2C Address. More...
 
void reset ()
 Resets the MCP23008. More...
 
void setup (uint8_t i2c=0x20, uint8_t io=GPIO_OUTPUT, int reset_pint=-1, long i2c_freq=100000)
 Starts the MCP23008. More...
 
uint8_t getRegister (uint8_t reg)
 Gets the corrent register information. More...
 
void setRegister (uint8_t reg, uint8_t value)
 Sets a value to a given register. More...
 
void turnGpioOn (uint8_t gpio)
 Turns a given GPIO port on (high level) More...
 
void turnGpioOff (uint8_t gpio)
 Turns a given GPIO port off (low level) More...
 
void pullUpGpioOn (uint8_t gpio)
 Turns intenal pull up resistor ON to a given GPIO PIN (high level) More...
 
void pullUpGpioOff (uint8_t gpio)
 Turns intenal pull up resistor OFF to a given GPIO PIN (low level) More...
 
void setIoCon (uint8_t INTPOL, uint8_t ODR, uint8_t HAEN, uint8_t DISSLW, uint8_t SEQOP)
 Sets the IO Configurarion gerister. More...
 
mcp23008_ioncon getIoCon ()
 Returns the IOCON content. More...
 
void invertGpioPolarity ()
 Inverts the polarity of the all GPIO port bits. More...
 
void setInterrupt (uint8_t polatity=0, uint8_t openDrainOutput=0)
 Configures the MCP23008 interrupt feature. More...
 
void interruptGpioOn (uint8_t gpio, uint8_t bitCompare=1)
 Sets the interrupt-on-change feature to a given GPIO pin. More...
 
bool gpioRead (uint8_t gpio)
 Reads the status (high or low) of a given GPIO. More...
 
void gpioWrite (uint8_t gpio, uint8_t value)
 Sets a given value (high(1) or low(0) ) to a given gpio pin. More...
 
bool registerDigitalRead (uint8_t mcp_register, uint8_t bit_position)
 Reads the status (high or low) of a given bit (position) of a given MCP23008 register. More...
 
void registerDigitalWrite (uint8_t mcp_register, uint8_t bit_position, uint8_t value)
 Sets High or Low to a given position in a given MCP23008 register. More...
 
uint8_t getGPIOS ()
 Returns the current MCP GPIO pin levels. More...
 
void setGPIOS (uint8_t value)
 Sets a value to the GPIO Register. More...
 
uint8_t getINTCAP ()
 Returns the last value of INTCAP register (value immediately after the last interrupt event) More...
 
uint8_t getINTF ()
 Returns the last value of INTF register. More...
 
bool isBitValueHigh (uint8_t byteValue, uint8_t bitNumber)
 Checks if the Bit Value of a given bit position is high. More...
 
void setClock (long freq)
 Sets I2C bus to a given frequency. More...
 

Protected Attributes

uint8_t i2cAddress = 0x20
 Default i2c address. More...
 
uint8_t gpios = 0
 REG_GPIO shadow register. More...
 
uint8_t intcap = 0
 
uint8_t intf = 0
 
int reset_pin = -1
 Digital Arduino pin to control the MCP2300 RESET. More...
 

Field Documentation

◆ i2cAddress

uint8_t MCP::i2cAddress = 0x20
protected

Default i2c address.

◆ gpios

uint8_t MCP::gpios = 0
protected

REG_GPIO shadow register.

◆ intcap

uint8_t MCP::intcap = 0
protected

◆ intf

uint8_t MCP::intf = 0
protected

◆ reset_pin

int MCP::reset_pin = -1
protected

Digital Arduino pin to control the MCP2300 RESET.

Referenced by reset(), and setup().


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