56 #define MCP23017_REG_IODIRA 0x00
57 #define MCP23017_REG_IODIRB 0x01
58 #define MCP23017_REG_IPOLA 0x02
59 #define MCP23017_REG_IPOLB 0x03
60 #define MCP23017_REG_GPINTENA 0x04
61 #define MCP23017_REG_GPINTENB 0x05
62 #define MCP23017_REG_DEFVALA 0x06
63 #define MCP23017_REG_DEFVALB 0x07
64 #define MCP23017_REG_INTCONA 0x08
65 #define MCP23017_REG_INTCONB 0x09
66 #define MCP23017_REG_IOCON 0x0A
67 #define MCP23017_REG_GPPUA 0x0C
68 #define MCP23017_REG_GPPUB 0x0D
69 #define MCP23017_REG_INTFA 0x0E
70 #define MCP23017_REG_INTFB 0x0F
71 #define MCP23017_REG_INTCAPA 0x10
72 #define MCP23017_REG_INTCAPB 0x11
73 #define MCP23017_REG_GPIOA 0x12
74 #define MCP23017_REG_GPIOB 0x13
75 #define MCP23017_REG_OLATA 0x14
76 #define MCP23017_REG_OLATB 0x15
102 #define MCP23017_ADDRESS 0x40
105 #define MCP23017_GPA0 0
106 #define MCP23017_GPA1 1
107 #define MCP23017_GPA2 2
108 #define MCP23017_GPA3 3
109 #define MCP23017_GPA4 4
110 #define MCP23017_GPA5 5
111 #define MCP23017_GPA6 6
112 #define MCP23017_GPA7 7
113 #define MCP23017_GPB0 8
114 #define MCP23017_GPB1 9
115 #define MCP23017_GPB2 10
116 #define MCP23017_GPB3 11
117 #define MCP23017_GPB4 12
118 #define MCP23017_GPB5 13
119 #define MCP23017_GPB6 14
120 #define MCP23017_GPB7 15
122 #define MCP23017_SETPIN 0x80
123 #define MCP23017_CLEARPIN 0
129 typedef struct __attribute__((aligned(2), packed))
_MCP23017
163 INT8 mcp23017_ConfigDir(
MCP23017* obj, UINT16 dir);
177 INT8 mcp23017_ConfigDirMask(
MCP23017* obj, UINT16 dir, UINT16 mask);
190 INT8 mcp23017_ConfigPullups(
MCP23017* obj, UINT16 pullUps);
205 INT8 mcp23017_ConfigIntPins(
MCP23017* obj, UINT16 intPins);
238 INT8 mcp23017_WriteMask(
MCP23017* obj, UINT16 val, UINT16 mask);
251 #define mcp23017_WritePin(obj, pin) mcp23017_WritePin(obj, pin | 0x80)
264 #define mcp23017_ClearPin(obj, pin) mcp23017_WritePin(obj, pin & 0x7f)
289 #define mcp23017_ReadPins(obj) ((obj)->pin.Val)