37 #define IODIRA 0x00 // I/O direction A
38 #define IODIRB 0x01 // I/O direction B
39 #define IPOLA 0x02 // I/O polarity A
40 #define IPOLB 0x03 // I/O polarity B
41 #define GPINTENA 0x04 // interupt enable A
42 #define GPINTENB 0x05 // interupt enable B
43 #define DEFVALA 0x06 // register default value A (interupts)
44 #define DEFVALB 0x07 // register default value B (interupts)
45 #define INTCONA 0x08 // interupt control A
46 #define INTCONB 0x09 // interupt control B
47 #define IOCON 0x0A // I/O config (also 0x0B)
48 #define GPPUA 0x0C // port A pullups
49 #define GPPUB 0x0D // port B pullups
50 #define INTFA 0x0E // interupt flag A (where the interupt came from)
51 #define INTFB 0x0F // interupt flag B
52 #define INTCAPA 0x10 // interupt capture A (value at interupt is saved here)
53 #define INTCAPB 0x11 // interupt capture B
54 #define GPIOA 0x12 // port A
55 #define GPIOB 0x13 // port B
56 #define OLATA 0x14 // output latch A
57 #define OLATB 0x15 // output latch B
60 #define BANK_OFF 0x00 // addressing mode
62 #define INT_MIRROR_ON 0x40 // interupt mirror (INTa|INTb)
63 #define INT_MIRROR_OFF 0x00
64 #define SEQOP_OFF 0x20 // incrementing address pointer
66 #define DISSLW_ON 0x10 // slew rate
67 #define DISSLW_OFF 0x00
68 #define HAEN_ON 0x08 // hardware addressing
70 #define ODR_ON 0x04 // open drain for interupts
72 #define INTPOL_HIGH 0x02 // interupt polarity
73 #define INTPOL_LOW 0x00
75 #define GPIO_INTERRUPT_PIN 25
84 int mcp23s17_open(
int bus,
int chip_select);
94 uint8_t mcp23s17_read_reg(uint8_t reg, uint8_t hw_addr,
int fd);
105 void mcp23s17_write_reg(uint8_t data, uint8_t reg, uint8_t hw_addr,
int fd);
116 uint8_t mcp23s17_read_bit(uint8_t bit_num,
131 void mcp23s17_write_bit(uint8_t data,
144 int mcp23s17_enable_interrupts();
153 int mcp23s17_disable_interrupts();
173 int mcp23s17_wait_for_interrupt(
int timeout);