 |
PU2CLR MCP23008 Arduino Library
1.0.3
Arduino Library for MCP23008 Device - By Ricardo Lima Caratti
|
Go to the documentation of this file.
18 #define REG_IODIR 0x00
20 #define REG_GPINTEN 0x02
21 #define REG_DEFVAL 0x03
22 #define REG_INTCON 0x04
23 #define REG_IOCON 0x05
26 #define REG_INTCAP 0x08
30 #define GPIO_INPUT 0xFF
31 #define GPIO_OUTPUT 0x00
70 void setIoCon(uint8_t INTPOL, uint8_t ODR, uint8_t HAEN, uint8_t DISSLW, uint8_t SEQOP);
72 void setInterrupt(uint8_t polatity = 0, uint8_t openDrainOutput = 0);
75 void gpioWrite(uint8_t gpio, uint8_t value);
void setRegister(uint8_t reg, uint8_t value)
Sets a value to a given register.
Definition: pu2clr_mcp23008.cpp:84
#define REG_INTCAP
The INTCAP register captures the GPIO port value at the time the interrupt occurred.
Definition: pu2clr_mcp23008.h:26
uint8_t intcap
Definition: pu2clr_mcp23008.h:58
void gpioWrite(uint8_t gpio, uint8_t value)
Sets a given value (high(1) or low(0) ) to a given gpio pin.
Definition: pu2clr_mcp23008.cpp:144
#define REG_DEFVAL
The default comparison value is configured in the DEFVAL register.
Definition: pu2clr_mcp23008.h:21
void setIoCon(uint8_t INTPOL, uint8_t ODR, uint8_t HAEN, uint8_t DISSLW, uint8_t SEQOP)
Sets the IO Configurarion gerister.
Definition: pu2clr_mcp23008.cpp:203
Definition: pu2clr_mcp23008.h:52
uint8_t getINTCAP()
Returns the last value of INTCAP register (value immediately after the last interrupt event)
Definition: pu2clr_mcp23008.h:105
uint8_t getINTF()
Returns the last value of INTCAP register (value immediately after the last interrupt event)
Definition: pu2clr_mcp23008.h:117
void interruptGpioOn(uint8_t gpio, uint8_t bitCompare=1)
Sets the interrupt-on-change feature to a given GPIO pin.
Definition: pu2clr_mcp23008.cpp:260
#define GPIO_OUTPUT
Definition: pu2clr_mcp23008.h:31
void pullUpGpioOff(uint8_t gpio)
Turns intenal pull up resistor OFF to a given GPIO PIN (low level)
Definition: pu2clr_mcp23008.cpp:175
uint8_t intf
Definition: pu2clr_mcp23008.h:59
#define REG_GPIO
The GPIO register reflects the value on the port.
Definition: pu2clr_mcp23008.h:27
uint8_t getRegister(uint8_t reg)
Gets the corrent register information.
Definition: pu2clr_mcp23008.cpp:68
void setGPIOS(uint8_t value)
Sets a value to the GPIO Register.
Definition: pu2clr_mcp23008.h:95
#define REG_IOCON
The IOCON register contains several bits for configuring the device. See method: setIoCon.
Definition: pu2clr_mcp23008.h:23
bool gpioRead(uint8_t gpio)
Reads the status (high or low) or a given GPIO.
Definition: pu2clr_mcp23008.cpp:131
uint8_t gpios
Definition: pu2clr_mcp23008.h:57
uint8_t getGPIOS()
Returns the current MCP GPIO pin levels.
Definition: pu2clr_mcp23008.h:83
void turnGpioOff(uint8_t gpio)
Turns a given GPIO port off (low level)
Definition: pu2clr_mcp23008.cpp:115
#define REG_INTF
The INTF register reflects the interrupt condition on the port pins of any pin that is enabled for in...
Definition: pu2clr_mcp23008.h:25
void setInterrupt(uint8_t polatity=0, uint8_t openDrainOutput=0)
Configures the MCP23008 interrupt feature.
Definition: pu2clr_mcp23008.cpp:240
uint8_t lookForDevice()
Look for MCP23008 device I2C Address.
Definition: pu2clr_mcp23008.cpp:28
void invertGpioPolarity()
Inverts the polarity of the all GPIO port bits.
Definition: pu2clr_mcp23008.cpp:224
void turnGpioOn(uint8_t gpio)
Turns a given GPIO port on (high level)
Definition: pu2clr_mcp23008.cpp:99
#define REG_IPOL
The IPOL register allows the user to configure the polarity on the corresponding GPIO port bits.
Definition: pu2clr_mcp23008.h:19
#define REG_GPPU
The GPPU register controls the pull-up resistors for the port pins.
Definition: pu2clr_mcp23008.h:24
uint8_t raw
Definition: pu2clr_mcp23008.h:49
uint8_t i2cAddress
Definition: pu2clr_mcp23008.h:56
void setup(uint8_t i2c=0x20, uint8_t io=GPIO_OUTPUT)
Starts the MCP23008.
Definition: pu2clr_mcp23008.cpp:52
void pullUpGpioOn(uint8_t gpio)
Turns intenal pull up resistor ON to a given GPIO PIN (high level)
Definition: pu2clr_mcp23008.cpp:157
#define REG_IODIR
Controls the direction of the data I/O. When a bit is set, the corresponding pin becomes an input....
Definition: pu2clr_mcp23008.h:18
#define REG_GPINTEN
The GPINTEN register controls the interrupt-on-change feature for each pin.
Definition: pu2clr_mcp23008.h:20