14#define SELECT_MCP23S08 SPI_SELECT_IO_EXP
15#define DESELECT_MCP23S08 SPI_DESELECT_IO_EXP
18#define MCP23S08_IODIR 0x00
19#define MCP23S08_IPOL 0x01
20#define MCP23S08_GPINTEN 0x02
21#define MCP23S08_DEFVAL 0x03
22#define MCP23S08_INTCON 0x04
23#define MCP23S08_IOCON 0x05
24#define MCP23S08_GPPU 0x06
25#define MCP23S08_INTF 0x07
26#define MCP23S08_INTCAP 0x08
27#define MCP23S08_GPIO 0x09
28#define MCP23S08_OLAT 0x0A
45 MCP23S08(uint8_t deviceAddr);
51 bool digitalReadIO(uint8_t pin);
52 void digitalWriteIO(uint8_t pin,
bool state);
56 void setOutputStates(uint8_t states);
57 void setPinModes(uint8_t modes);
58 void enablePullups(uint8_t enables);
59 void setInterruptOnChange(uint8_t mask);
60 void setInterruptOnChangeDefaultCompare(uint8_t mask);
61 void setInterruptControl(uint8_t mask);
62 void setINTPinPushPullActiveState(
bool activeLow);
65 uint8_t getInputStates();
66 uint8_t getOutputStates();
67 uint8_t getPinModes();
68 uint8_t getEnabledPullups();
99 uint8_t deviceOpcode = 0x40;
102 void writeRegister(uint8_t address, uint8_t data);
103 uint8_t readRegister(uint8_t address);
enum MCP23S08_PinModes MCP23S08_PinModes_t
Enumeration with all MCP23S08 pin modes.
MCP23S08_PinModes
Enumeration with all MCP23S08 pin modes.
Definition MCP23S08.h:34
@ MCP23S08_PINMODE_INPUT
MCP23S08 pin is input.
Definition MCP23S08.h:36
@ MCP23S08_PINMODE_OUTPUT
MCP23S08 pin is output.
Definition MCP23S08.h:35
@ MCP23S08_PINMODE_INPUT_PULLUP
MCP23S08 pin is input with enabled pullup.
Definition MCP23S08.h:37
uint8_t getInterruptOnChange()
The GPINTEN register controls the interrupt-onchange feature for each pin.
Definition MCP23S08.cpp:157
uint8_t getInterruptOnChangeDefaultCompare()
The default comparison value is configured in the DEFVAL register.
Definition MCP23S08.cpp:162
uint8_t getInterruptFlags()
The INTF register reflects the interrupt condition on the port pins of any pin that is enabled for in...
Definition MCP23S08.cpp:172
uint8_t getInterruptControl()
The INTCON register controls how the associated pin value is compared for the interrupt-on-change fea...
Definition MCP23S08.cpp:167
uint8_t getInterruptCaptures()
The INTCAP register captures the GPIO port value at the time the interrupt occurred.
Definition MCP23S08.cpp:177