3 * Copyright (c) 2012-2013 Gordon Henderson
5 * Header file for code using the MCP23x17 GPIO expander chip.
6 * This comes in 2 flavours: MCP23017 which has an I2C interface,
7 * an the MXP23S17 which has an SPI interface.
8 ***********************************************************************
9 * This file is part of wiringPi:
10 * https://projects.drogon.net/raspberry-pi/wiringpi/
12 * wiringPi is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
17 * wiringPi is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with wiringPi.
24 * If not, see <http://www.gnu.org/licenses/>.
25 ***********************************************************************
55 // Bits in the IOCON register
57 #define IOCON_UNUSED 0x01
58 #define IOCON_INTPOL 0x02
59 #define IOCON_ODR 0x04
60 #define IOCON_HAEN 0x08
61 #define IOCON_DISSLW 0x10
62 #define IOCON_SEQOP 0x20
63 #define IOCON_MIRROR 0x40
64 #define IOCON_BANK_MODE 0x80
66 // Default initialisation mode
68 #define IOCON_INIT (IOCON_SEQOP)
72 #define CMD_WRITE 0x40