sumotoy / gpio_expander

A library for drive a lot of GPIO chips with Arduino/Teensy3.x or LC
66 stars 29 forks source link

Mirroring error on mcl in chain higher than 6 #6

Closed mortonkopf closed 7 years ago

mortonkopf commented 7 years ago

Hi there,

It seems that the addressing bits do not prevent mirroring when using addresses seven and eight. I am using the following for all mcl (mcp0 to mcp7) with mixed input and output. A simple test I ran showed that not declaring mcl.begin still allowed mirrored bits. mcp5.gpioRegisterWriteByte(mcp0.IOCON, 0b00101000);//HAEN,SEQOP,MIRROR -remove mirror (ie INT pin connection) mcp5.gpioRegisterWriteByte(mcp0.GPPU, 0xff, true);//pull-up only required input pins??? mcp5.gpioRegisterWriteWord(mcp0.GPINTEN, 0x1f1f);// enable interrupts on these mcp5.gpioRegisterReadByte(mcp0.INTCAP); //read interrupt capture port A (it clear port) mcp5.gpioRegisterReadByte(mcp0.INTCAP + 1);//read interrupt capture port B (it clear port)

mortonkopf commented 7 years ago

looks like user error. Have run further tests and chips 6,7, and 8 do seem to work independently.