]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/nek_type_a/mcp23017.h
Remove more commented out MCUs
[qmk_firmware.git] / keyboards / nek_type_a / mcp23017.h
1 /* Copyright 2018 Mike Roberts
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 #ifndef MAP23017_H
17 #define MAP23017_H
18
19 #define EXPANDER_ADDR 0x27
20 #define I2C_TIMEOUT 200 // milliseconds
21 #define EXPANDER_PAUSE 0 // microseconds
22
23 enum EXPANDER_REGISTERS {
24     EXPANDER_REG_IODIRA = 0x00,
25     EXPANDER_REG_IODIRB = 0x01,
26     EXPANDER_REG_IPOLA = 0x02,
27     EXPANDER_REG_IPOLB = 0x03,
28     EXPANDER_REG_GPINTENA = 0x04,
29     EXPANDER_REG_GPINTENB = 0x05,
30     EXPANDER_REG_DEFVALA = 0x06,
31     EXPANDER_REG_DEFVALB = 0x07,
32     EXPANDER_REG_INTCONA = 0x08,
33     EXPANDER_REG_INTCONB = 0x09,
34     EXPANDER_REG_IOCONA = 0x0A,
35     EXPANDER_REG_IOCONB = 0x0B,
36     EXPANDER_REG_GPPUA = 0x0C,
37     EXPANDER_REG_GPPUB = 0x0D,
38     EXPANDER_REG_INTFA = 0x0E,
39     EXPANDER_REG_INTFB = 0x0F,
40     EXPANDER_REG_INTCAPA = 0x10,
41     EXPANDER_REG_INTCAPB = 0x11,
42     EXPANDER_REG_GPIOA = 0x12,
43     EXPANDER_REG_GPIOB = 0x13,
44     EXPANDER_REG_OLATA = 0x14,
45     EXPANDER_REG_OLATB = 0x15
46 };
47
48 #define GPA0 0x0
49 #define GPA1 0x1
50 #define GPA2 0x2
51 #define GPA3 0x3
52 #define GPA4 0x4
53 #define GPA5 0x5
54 #define GPA6 0x6
55 #define GPA7 0x7
56 #define GPB0 0x8
57 #define GPB1 0x9
58 #define GPB2 0xA
59 #define GPB3 0xB
60 #define GPB4 0xC
61 #define GPB5 0xD
62 #define GPB6 0xE
63 #define GPB7 0xF
64
65
66 void expander_init(void);
67 void expander_select(uint8_t pin);
68 void expander_unselect(uint8_t pin);
69 void expander_unselect_all(void);
70
71 #endif